'Constraint based on Boolean Decision Variable
Working on an assignment for my Masters program and am running into an issue with CPLEX
Without copy/pasting entire problem, the gist is an optimization problem regarding Farms and Plants with transportation and fixed costs etc.
One of the parts of the problem is Farm4 and Farm5 are a package deal (Either buy both, or buy neither) and I am not sure how to code that in CPLEX
Below is the code for the Farm Strings
{string} Farm = {"F1", "F2", "F3", "F4", "F5", "F6"};
And below is the code the the boolean decision variable to include each farm's fixed cost
dvar boolean Purchase[Farm];
I have tried a few things, but CPLEX doesn't allow me to do a constraint based upon a dvar.
Does anyone know anyway I can make this work?
Thanks in advance!
Solution 1:[1]
Purchase["F4"]==Purchase["F5"];
Works fine for buy both or neither
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Alex Fleischer |