Originally posted by: SystemAdmin
Thanks a lot for your reply. I still have the problem, and I don't understand it.
This is how I define the model (sorry, I don't know how to format the post nicely):
#define EPS 1.0e-3
IloModel genInst (env);
IloNumVarArray Sizes(env,N,0.25+EPS,1.0-EPS);
IloObjective Weight = IloAdd(genInst, IloMaximize(env,IloSum(Sizes)));
Then I have a loop where I add constraints like this (i1,.. are indices):
genInst.add(Sizes
i1 + Sizes
i2 + Sizes
i3<=1);
genInst.add(Sizes
i1 + Sizes
i2 + Sizes
i3 - Sizes[j] >= 1+EPS);
Whenever I don't have any expression for the objectiv function (e.g. just leave it to be 1), I get values in the range ]0.25,1.0[ after I solve the LP, e.g. like this:
Report 5: Best sum of sizes 1
Size values
0.251 0.251 0.251 0.251 0.251 0.251 0.251 0.251 0.251 0.251 0.75 0.75 0.75 0.75 0.75
But when I set the objectiv function to be the sum of the variables, the variables of the solution are outside the range, e.g.
Report 5: Best sum of sizes 2.219
Size values
-0.001 1.517 -1.516 1.262 0.251 -1.516 -1.516 -1.012 -0.76 0.251 2.265 0.243 1.254 0.999 0.498
I tried different possibilities like adding the range restrictions as further constraints, which does not work either so I guess something with the way I add the constraints is wrong. There I tried to follow the populate-by-row solution as in
http://www.tu-chemnitz.de/mathematik/discrete/manuals/cplex/doc/getstart/html/ilocplex13.html.#DecisionOptimization#MathematicalProgramming-General