Originally posted by: pfaut
HI,
Is there any way to use the IloAbs absolute value variables in the python api (apart from a manual implementation)?
And if not:
Is there any better way apart from splitting the variable into a negative and positive variable and adding integer activity constraints to do so?
What I would need is abs(x) in the optimization function (which works in c++ (by IloAbs) but not python).
The only way I know is blowing the whole problem up with loads of additional integer variables by splitting x int x_pos and x_neg:
i.e. x + z would become x_pos - x_neg + z
while having the additional constraints:
(1) eps * y+ <= x_pos <= x_max * y+
(2) y-*eps <= x_neg <= -x_min * y-
(3) y- + y+ <=1
with a small eps and y+ and y- as integer variables.
Where (1) ensures, that if y+ = 1 then x_pos is larger than epsilon and if y+ = 0 x_pos is = 0
(2) ensures, that if y- = 1 then x_neg is larger than epsilon and if y- = 0 x_neg is = 0
(3) ensures that EITHER y+ is 1 or y- is 1, so that x is either positive or negative or 0 (if both are zero)
However this adds an awful lot of additional constraints...
#CPLEXOptimizers#DecisionOptimization