Originally posted by: Skapur
Good afternoon,
I am using CPLEX through the Python API and I'm trying to define some indicator constraints for a mixed-integer linear programming problem. The constraints I'm trying to setup in LP file format are similar to this:
v1_indicator = 0 <-> v1 = 0
v1_indicator = 1 <-> v1 >= 1
There are other variables v2,v3, etc... to be constrained in this manner and I'm minimizing the sum of these binary indicators. However, when using the add method in the indicator_constraints sub-interface, the LP file shows constraints with only a forward arrow. After successive optimizations, I'm finding that the solutions contain some indicators that are set to 1 despite their associated variables being 0. All of the solutions display and 'optimal' status.
The constraints built by the API do not result in the double <-> arrow in LP format, rather coming as a single -> arrow. I have also loaded a modified LP with the double arrows and the solutions come out as expected. Is it possible to generate such constraints with the Python API?
I should also add I implemented a similar problem using the Java library with the IfThen function and the results are correct. Is there any Python equivalent?
Thanks in advance!
#CPLEXOptimizers#DecisionOptimization