If one of the variables in the lb and ub constraints are set to be the 
same,  the calculation will be wrong or complain about unable to set 
the constraints.
Here is an example:
s=-1;
c=[10,6,4]';
a=[1,1,1;...
   10,4,5;...
   2,2,6];
b=[100,600,300]';
ctype=['U','U','U']';
lb=[50 0,0]';
ub=[500, 0, 300]';
vartype=['C','C','C']';
param.msglev=3;
param.lpsolver=1;
param.save=1;
[xmin,fmin,status,extra]=glpk(c,a,b,lb,ub,ctype,vartype,s,param)
-----------------------------------------------

This bug exist in the glpkmex, where the defining type of variables did 
not considered lb[i] == ub[i].
       //-- Define type of the structural variables
      if (! freeLB[i] && ! freeUB[i])
         lpx_set_col_bnds (lp, i+1, LPX_DB, lb[i], ub[i]); // if lb[i] 
== ub[i], then status of LPX_DB, will be incorrect

Change it to       //-- Define type of the structural variables
      if (! freeLB[i] && ! freeUB[i])
         if (lb[i] != ub[i])    lpx_set_col_bnds (lp, i+1, LPX_DB, 
lb[i], ub[i]);
         else                    lpx_set_col_bnds (lp, i+1, LPX_FX, 
lb[i], ub[i]);
will solve the problem.

Zhi.





_______________________________________________
Bug-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-glpk

Reply via email to