Originally posted by: BerkUstun
I'm currently trying to solve a MIP with indicator constraints using in the CPLEX 12.8.0 Python API.
I'm having some trouble understanding how set the complemented parameter for the mip.indicator_constraints.add function.
The online documentation for the Python API describes the parameter as:
complemented : whether the constraint is active when the variable indvar is equal to 0 or 1: default is 0.
But this is somewhat different from the documentation for the C API, which describes it as:
Boolean value that specifies whether the indicator variable is complemented. The linear constraint must be satisfied when the indicator takes a value of 1 (one) if the indicator is not complemented, and similarly, the linear constraint must be satisfied when the indicator takes a value of 0 (zero) if the indicator is complemented
Just to make sure that I have it right, take this example, where complemented = 0:
# mip.indicator_constraints.add(indvar="x1",
# complemented=0,
# rhs=1.0,
# sense="G",
# lin_expr=cplex.SparsePair(ind=["x2"], val=[2.0]),
# name="ind1")
Does this mean:
- if "x1 = 0" then the constraint "2*x2 >= 1.0" must be active
- if "x1 = 1" then the constraint "2*x2 >= 1.0" could either be active or inactive?
Or rather?
- if "x1 = 1" then the constraint "2*x2 >= 1.0" must be active
- if "x1 = 0" then the constraint "2*x2 >= 1.0" could either be active or inactive?
#CPLEXOptimizers#DecisionOptimization