Simple_Linear_Programming_with_CPLEX icon indicating copy to clipboard operation
Simple_Linear_Programming_with_CPLEX copied to clipboard

How can I write an IF condition for my decision variable for Mixed Integer Linear Programming (MILP) using DOCPLEX CP on Python?

Open Alizak97 opened this issue 6 years ago • 0 comments

I am trying to solve an optimization problem using mixed integer linear programming on DOCPLEX CP on Python. For example,

Objective Function:

x1 + x2 + x3 = x4 + x5 + x6

where x1, x2, x3, x4. x5 and x6 are decision variables.

How can I add an if condition constraint, such as:

x2 + x4 >= 0 if x6 - x1 >= 0

and

x2 + x4 < 0 if x6 - x1 < 0

here the sum of x2 and x1 are constrained based on the difference between x6 and x1.

Alizak97 avatar Nov 13 '19 12:11 Alizak97