var X;
var Z binary;
subject to EitherOr1: 20 + 30*Z <= X;
subject to EitherOr2: X <= 40 + 60*Z;
Alternatively, you can define X to lie in the union of two disjoint
intervals, by writing:
var X in interval[20,40] union [50,100];
Then AMPL will introduce define the needed binary variable automatically
when it generates the problem for the solver. (The currently implemented
transformation tends to create a larger number of variables, however.)
Either way, you will need to use a solver that can handle mixed-integer
optimization problems -- for example CPLEX or Gurobi, but not MINOS.
Bob Fourer
4...@ampl.com