Skip to content

Commit

Permalink
Merge pull request opencobra#1017 from lvalcarcelg/problem_infeasible…
Browse files Browse the repository at this point in the history
…_cplex_solveMILP

🐛 Fixing bug for MILP solver using IBM CPLEX
  • Loading branch information
syarra authored Nov 21, 2017
2 parents 9c4db44 + 948781a commit df56d34
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/base/solvers/solveCobraMILP.m
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,11 @@
else
solStat = -1; % Solution not optimal or solver problem
end

case 'ibm_cplex'
% Free academic licenses for the IBM CPLEX solver can be obtained from
% https://www.ibm.com/developerworks/community/blogs/jfp/entry/CPLEX_Is_Free_For_Students?lang=en

cplexlp = Cplex();
if (~isempty(csense))
b_L(csense == 'E') = b(csense == 'E');
Expand Down Expand Up @@ -432,11 +436,12 @@
end

% Get results
x = Result.x;
f = osense*Result.objval;
stat = Result.status;
if (stat == 101 || stat == 102 || stat == 1)
solStat = 1; % Opt integer within tolerance
% Return solution if problem is feasible, bounded and optimal
x = Result.x;
f = osense*Result.objval;
elseif (stat == 103 || stat == 3)
solStat = 0; % Integer infeas
elseif (stat == 118 || stat == 119 || stat == 2)
Expand Down

0 comments on commit df56d34

Please sign in to comment.