Skip to content

Commit

Permalink
Remove restriction to actively supported solvers and only display wor…
Browse files Browse the repository at this point in the history
…king solvers
  • Loading branch information
tpfau committed Oct 11, 2018
1 parent c2e2879 commit 381729c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion initCobraToolbox.m
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ function initCobraToolbox(updateToolbox)
end
k = 1;
for j = 1:length(catSolverNames.(OPT_PROB_TYPES{i}))
if SOLVERS.(catSolverNames.(OPT_PROB_TYPES{i}){j}).installed
if SOLVERS.(catSolverNames.(OPT_PROB_TYPES{i}){j}).working
if k == 1
msg = '''%s'' ';
else
Expand Down
38 changes: 16 additions & 22 deletions src/base/solvers/changeCobraSolver.m
Original file line number Diff line number Diff line change
Expand Up @@ -471,31 +471,25 @@
% set solver related global variables (only for actively maintained solver interfaces)
if solverOK
solverInstalled = true;
if strcmpi(SOLVERS.(solverName).categ, 'active')
if validationLevel > 0
cwarn = warning;
warning('off');
eval(['oldval = CBT_', solverType, '_SOLVER;']);
eval(['CBT_', solverType, '_SOLVER = solverName;']);
% validate with a simple problem.
problem = struct('A',[0 1],'b',0,'c',[1;1],'osense',-1,'F',speye(2),'lb',[0;0],'ub',[0;0],'csense','E','vartype',['C';'I'],'x0',[0;0]);
try
eval(['solveCobra' solverType '(problem,''printLevel'', 0);']);
catch ME
if printLevel > 0
disp(ME.message);
end
solverOK = false;
eval(['CBT_', solverType, '_SOLVER = oldval;']);
if validationLevel > 0
cwarn = warning;
warning('off');
eval(['oldval = CBT_', solverType, '_SOLVER;']);
eval(['CBT_', solverType, '_SOLVER = solverName;']);
% validate with a simple problem.
problem = struct('A',[0 1],'b',0,'c',[1;1],'osense',-1,'F',speye(2),'lb',[0;0],'ub',[0;0],'csense','E','vartype',['C';'I'],'x0',[0;0]);
try
eval(['solveCobra' solverType '(problem,''printLevel'',0);']);
catch ME
if printLevel > 0
disp(ME.message);
end
warning(cwarn)
else
% if unvalidated, simply set the solver without testing.
eval(['CBT_', solverType, '_SOLVER = solverName;']);
solverOK = false;
eval(['CBT_', solverType, '_SOLVER = oldval;']);
end
warning(cwarn)
else
% if no active support, we simply set the requested solver, without
% testing.
% if unvalidated, simply set the solver without testing.
eval(['CBT_', solverType, '_SOLVER = solverName;']);
end
end
Expand Down

0 comments on commit 381729c

Please sign in to comment.