I have a minimization problem in which all constraints(x) are continuous. My objective function is linear and there are several objectives with if statements depending on the x's, the optimization choose.

In general:

x(1) >=10

x(1) <=25

x(2) >=10

x(2) <=25

if x(1) >3 then

y1:=2*x(1) + 3*x(2)

else y1:=5*x(1) + 3*x(2)

end-if

minimize (y1)

Can Xpress handle this complexity? If so please advise.

Thanks

Hi,

In your example, the only difference between the two objectives is just the coefficient of the x1 variable. In other words, if x1<15 (or 3 in the original post) then it has cost 5 in the objective, otherwise its cost is 2. In this case, you can use a single objective and model x1 as described in section 3.3 "Price breaks" of the "MIP Formulations and linearizations Quick reference" guide (mipformref.pdf). That is, split x1 in two variables x1=x11+x12, where x11 is the quantity (less than 15) at cost 5 and x12 is the quantity (at least 15) at cost 2, and use a binary variable to enable either quantity band. Then you can write the model as follows:

model test

uses "mmxprs";

declarations

x1,x11,x12,x2,b:mpvar

end-declarations

x1>=10

x1<=25

x2>=10

x2<=25

b is_binary ! 1 for x1 in band 15-25, 0 for x1 in band 10-15

x1=x11+x12

x12>=15*b

x12<=25*b

minimize(5*x11+2*x12+3*x2)

writeln("Min:",getobjval)

writeln("b:",b.sol)

writeln("x1:",x1.sol)

writeln("x2:",x2.sol)

end-model

However this doesn't apply in more general cases with arbitrary objective functions. In the second post, all variables and constraints have been duplicated to essentially find the optimal solution for each of the two objectives with a single "minimize". With n different objectives this would make the model n times larger (in number of non-zeros). Solving the original model n times, each time setting a different objective (and adding the conditions associated with that objective), would be more efficient. But you can also use a single model and discrete variables to activate only one of several objectives. For example, you can use indicator constraints and binary variables s1 and s2 to activate either the y1 or y2 objective, as follows:

model test

uses "mmxprs";

declarations

x1,x2,s1,s2,obj:mpvar

end-declarations

x1>=10

x1<=25

x2>=10

x2<=25

s1 is_binary ! s1 enables first objective and conditions

s2 is_binary ! s2 enables second objective and conditions

s1+s2=1 ! choose only one objective

indicator(1, s1, x1>=15)

indicator(1, s1, obj >= 2*x1 + 3*x2)

indicator(1, s2, x1<=15)

indicator(1, s2, obj >= 5*x1 + 3*x2)

minimize(obj)

writeln("Min:",getobjval)

writeln("x1:",x1.sol)

writeln("x2:",x2.sol)

end-model