Originally posted by: 2EH8_Bruno_Maffei
Hi, I´m really new in opl cplex and are struggling in simplifying the following lines of code:
int NofX = ...; // NofX = 9;
range X = 1..NofX;
dvar float+ Qt[X];
subject to {
Qt[9] == (13 -Qt[8]-Qt[7]-Qt[6]-Qt[5]-Qt[4]-Qt[3]-Qt[2]-Qt[1]);
Qt[8] == (12 -Qt[7]-Qt[6]-Qt[5]-Qt[4]-Qt[3]-Qt[2]-Qt[1]) || Qt[8] == 0;
Qt[7] == (11 -Qt[6]-Qt[5]-Qt[4]-Qt[3]-Qt[2]-Qt[1]) || Qt[7] == 0;
Qt[6] == (8 -Qt[5]-Qt[4]-Qt[3]-Qt[2]-Qt[1]) || Qt[6] == 0;
Qt[5] == (8 -Qt[4]-Qt[3]-Qt[2]-Qt[1]) || Qt[5] == 0;
Qt[4] == (6 -Qt[3]-Qt[2]-Qt[1]) || Qt[4] == 0;
Qt[3] == (5 -Qt[2]-Qt[1]) || Qt[3] == 0;
Qt[2] == (3 -Qt[1]) || Qt[2] == 0;
Qt[8] == (10 -Qt[7]-Qt[5]-Qt[4]-Qt[2]-Qt[1]) || Qt[8] == 0;
Qt[7] == (6 -Qt[4]-Qt[1]) || Qt[7] == 0;
Qt[5] == (6 -Qt[4]-Qt[2]-Qt[1]) || Qt[5] == 0;
Qt[4] == (3 -Qt[1]) || Qt[4] == 0;
.... }
I`m looking for a simpler way to write these lines of code (I´m talking about the Qt[x] equations) because I would like to use more than 200 x in X and besides the amount of work it would exceed the number of constrains allowed by the trial version I´m using.
I would really appreciate any help..
Thanks!!
#DecisionOptimization#OPLusingCPLEXOptimizer