I am using GLPK and I am struggling in understanding why an upper bound constraint is not respected. I have something like this:
param n0;
param n1;
param n2;
param start_0{i in 0..n0};
param end_0{i in 0..n0};
param start_1{i in 0..n1};
param end_1{i in 0..n1};
param start_2{i in 0..n2};
param end_2{i in 0..n2};
var y0 {k in 0..n0} binary;
var y1 {k in 0..n1} binary;
var y2 {k in 0..n2} binary;
[...]
minimize obj: (sum{k in 0..n2}(end_2[k]*y2[k] + 600*y2[k]) - (sum{k in 0..n0} (start_0[k]*y0[k])));
[...]
s.t. c1: (sum{k in 0..n2} (end_2[k]*y2[k] ) - (sum{k in 0..n0} (start_0[k]*y0[k] ))) <= 7000;
s.t. c2_1: sum{k in 0..n0} y0[k] = 1 ;
s.t. c2_2: sum{k in 0..n1} y1[k] = 1 ;
s.t. c2_3: sum{k in 0..n2} y2[k] = 1 ;
[...]
solve;
[...]
printf (sum{k in 0..n2} (end_2[k]*y2[k] ) - (sum{k in 0..n0} (start_0[k]*y0[k] )));
The last printf gives me 7200. But the constraint c1 above should ensure that the difference is not greater than 7000.
The solver output is the following:
GLPK Integer Optimizer, v4.65
7 rows, 353 columns, 1332 non-zeros
353 integer variables, all of which are binary
Preprocessing...
6 rows, 353 columns, 1059 non-zeros
353 integer variables, all of which are binary
Scaling...
A: min|aij| = 1.000e+00 max|aij| = 1.625e+09 ratio = 1.625e+09
GM: min|aij| = 9.998e-01 max|aij| = 1.000e+00 ratio = 1.000e+00
EQ: min|aij| = 9.996e-01 max|aij| = 1.000e+00 ratio = 1.000e+00
2N: min|aij| = 7.561e-01 max|aij| = 1.000e+00 ratio = 1.323e+00
Constructing initial basis...
Size of triangular part is 6
Solving LP relaxation...
GLPK Simplex Optimizer, v4.65
6 rows, 353 columns, 1059 non-zeros
0: obj = -2.232000000e+05 inf = 1.329e-04 (2)
2: obj = 6.210000000e+04 inf = 0.000e+00 (0)
* 5: obj = 7.097321429e+03 inf = 0.000e+00 (0)
OPTIMAL LP SOLUTION FOUND
Integer optimization begins...
Long-step dual simplex will be used
+ 5: mip = not found yet >= -inf (1; 0)
+ 272: >>>>> 1.320000000e+04 >= 1.140000000e+04 13.6% (237; 2)
+ 304: mip = 1.320000000e+04 >= tree is empty 0.0% (0; 477)
INTEGER OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 0.8 Mb (851464 bytes)
Display statement at line 22
[...]
Model has been successfully processed
What I am doing wrong? Thanks a lot for your help,