Skip to content

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

@Alizak97

Description

@Alizak97

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions