Originally posted by: cplexforMatlabuser
Hello,
I solve mixed integer linear problems with cplex (Version 12.4) and am using the cplex for MATLAB API. After having solved a mip problem (i.e. cplex mip-object) succesfully I create a new cplex object which is identical to the already solved mip-cplex object except for the fact that I set the values of the binary variables of the new cplex object to the values computed for the first (mip) object and declare all variables as continuous. When I try to solve this continuous problem I get an infeasibility error. I noticed that the values computed in the mip object for the binary variables are actually not binary but deviate by e.g. 10^-5. Therefore I rounded all binary variables to 1 or zero, according to which is closer. This helps sometimes, but not always. I wonder whether other rounding errors occur and cause infeasibilities. I often noticed that when I set some variables to values computed by cplex itself and try to resolve I get infeasibility errors. To my understanding cplex should accept the solutions that were computed by itself as accurate enough. Since not many people seem to have this problem I wonder whether it is due to the MATLAB-CPLEX Interface.
Here is the relevant prt of my code. The mixed integer object called cplex was solved succesfully then I enter:
cplex2=Cplex('S');
cplex2.Model.sense='minimize';
cplex2.Model.obj=cplex.Model.obj;
cplex2.Model.A=cplex.Model.A;
cplex2.Model.rhs=cplex.Model.rhs;
cplex2.Model.lhs=cplex.Model.lhs;
cplex2.Model.ub=cplex.Model.ub;
cplex2.Model.lb=cplex.Model.lb;
cplex2.Model.ub(cplex.Model.ctype=='B')=cplex.Solution.x(cplex.Model.ctype=='B');
cplex2.Model.lb(cplex.Model.ctype=='B')=cplex.Solution.x(cplex.Model.ctype=='B');
cplex2.Model.ub(cplex.Model.ctype=='B' & cplex2.Model.ub > 0.5)=1;
cplex2.Model.lb(cplex.Model.ctype=='B' & cplex2.Model.lb < 0.5)=0;
cplex2.Model.ctype=ones(size(cplex.Model.ctype,1),1)*'C';
I also attached my continuous problems as lp file.
I tried setting the simplex tolerance parmeter to make the problem feasible: cplex2.Param.simplex.tolerances.feasibility.Cur=10^-3; This didn't help (propably partly because sometimes the LP is solved by the barrier algorithm and not with the simplex)
I would appreciate help very much!
#CPLEXOptimizers#DecisionOptimization