Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solver bugs with QP rcost #2376

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/analysis/FBA/optimizeCbModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@
solution.slack = [];

elseif strcmp(minNorm, 'one')
% Optimize the absolute value of fluxes
% Minimise the absolute value of fluxes
% Solve secondary LP to optimize weighted 1-norm of v
% Weight provided by model.g1
% Set up the optimization problem
Expand All @@ -635,9 +635,10 @@
optProblem2.ub = [optProblem.ub;Inf*ones(2*nRxns,1)];
if isempty(objectiveLP)
objectiveLP = 0;
optProblem2.b = [optProblem.b;zeros(2*nRxns,1);objectiveLP];
end

optProblem2.b = [optProblem.b;zeros(2*nRxns,1);objectiveLP];

%csense for 3 & 4 above
optProblem2.csense = [optProblem.csense; repmat('G',2*nRxns,1)];
% constrain the optimal value according to the original problem
Expand All @@ -649,7 +650,7 @@
%LPproblem2.csense(nTotalVars+1) = 'L'; %wrong
end

optProblem2.osense = 1;
optProblem2.osense = 1;%minimise
% Re-solve the problem
if allowLoops
solution = solveCobraLP(optProblem2, param);
Expand Down
4 changes: 2 additions & 2 deletions src/base/solvers/solveCobraQP.m
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@
end

%parse mosek result structure
[stat,origStat,x,y,yl,yu,z,zl,zu,k,basis,pobjval,dobjval] = parseMskResult(res);
w = -(zl - zu);
[stat,origStat,x,y,yl,yu,z,zl,zu,s,basis,pobjval,dobjval] = parseMskResult(res);
w = (zl - zu);

%debugging
if problemTypeParams.printLevel>2
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 24 additions & 0 deletions test/verifiedTests/analysis/testPrint/surfNet.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

Met #1 13dpg[c]

Consuming reactions: none
Producing reactions:
#49 <a href="matlab: surfNet([], 'GAPD', 0, NaN, 0, 1, [], 0, 0.800000);">GAPD</a>
<a href="matlab: surfNet([], 'g3p[c]', 0, NaN, 0, 1, [], 0, 0.800000);">g3p[c]</a> + <a href="matlab: surfNet([], 'nad[c]', 0, NaN, 0, 1, [], 0, 0.800000);">nad[c]</a> + <a href="matlab: surfNet([], 'pi[c]', 0, NaN, 0, 1, [], 0, 0.800000);">pi[c]</a> <=> <a href="matlab: surfNet([], '13dpg[c]', 0, NaN, 0, 1, [], 0, 0.800000);">13dpg[c]</a> + <a href="matlab: surfNet([], 'h[c]', 0, NaN, 0, 1, [], 0, 0.800000);">h[c]</a> + <a href="matlab: surfNet([], 'nadh[c]', 0, NaN, 0, 1, [], 0, 0.800000);">nadh[c]</a>
#75 <a href="matlab: surfNet([], 'PGK', 0, NaN, 0, 1, [], 0, 0.800000);">PGK</a>
<a href="matlab: surfNet([], '3pg[c]', 0, NaN, 0, 1, [], 0, 0.800000);">3pg[c]</a> + <a href="matlab: surfNet([], 'atp[c]', 0, NaN, 0, 1, [], 0, 0.800000);">atp[c]</a> <=> <a href="matlab: surfNet([], '13dpg[c]', 0, NaN, 0, 1, [], 0, 0.800000);">13dpg[c]</a> + <a href="matlab: surfNet([], 'adp[c]', 0, NaN, 0, 1, [], 0, 0.800000);">adp[c]</a>

<a href="matlab: surfNet([], [], 0, NaN, 0, 1, [], 0, 0.800000, struct('showPrev', true));">Show previous steps...</a>

Met #1 13dpg[c]

Consuming reactions: none
Producing reactions:
#49 <a href="matlab: surfNet([], 'GAPD', 0, NaN, 0, 1, [], 0, 0.800000);">GAPD</a>
<a href="matlab: surfNet([], 'g3p[c]', 0, NaN, 0, 1, [], 0, 0.800000);">g3p[c]</a> + <a href="matlab: surfNet([], 'nad[c]', 0, NaN, 0, 1, [], 0, 0.800000);">nad[c]</a> + <a href="matlab: surfNet([], 'pi[c]', 0, NaN, 0, 1, [], 0, 0.800000);">pi[c]</a> <=> <a href="matlab: surfNet([], '13dpg[c]', 0, NaN, 0, 1, [], 0, 0.800000);">13dpg[c]</a> + <a href="matlab: surfNet([], 'h[c]', 0, NaN, 0, 1, [], 0, 0.800000);">h[c]</a> + <a href="matlab: surfNet([], 'nadh[c]', 0, NaN, 0, 1, [], 0, 0.800000);">nadh[c]</a>
#75 <a href="matlab: surfNet([], 'PGK', 0, NaN, 0, 1, [], 0, 0.800000);">PGK</a>
<a href="matlab: surfNet([], '3pg[c]', 0, NaN, 0, 1, [], 0, 0.800000);">3pg[c]</a> + <a href="matlab: surfNet([], 'atp[c]', 0, NaN, 0, 1, [], 0, 0.800000);">atp[c]</a> <=> <a href="matlab: surfNet([], '13dpg[c]', 0, NaN, 0, 1, [], 0, 0.800000);">13dpg[c]</a> + <a href="matlab: surfNet([], 'adp[c]', 0, NaN, 0, 1, [], 0, 0.800000);">adp[c]</a>

<a href="matlab: surfNet([], [], 0, NaN, 0, 1, [], 0, 0.800000, struct('showPrev', true));">Show previous steps...</a>
'NOTEXIST' is not a metabolite, reaction or gene of the model.
Searching for related objects:
Empty file.
13 changes: 13 additions & 0 deletions test/verifiedTests/analysis/testTopology/test.ine
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/home/rfleming/drive/sbgCloud/code/fork-cobratoolbox/test/verifiedTests/analysis/testTopology/test
H-representation
linearity 7 1 2 3 4 5 6 7
begin
7 10 integer
0 -1 0 0 0 0 0 1 0 0
0 1 -2 -2 0 0 0 0 0 0
0 0 1 0 0 -1 -1 0 0 0
0 0 0 1 -1 1 0 0 0 0
0 0 0 0 1 0 1 0 -1 0
0 0 1 1 0 0 0 0 0 -1
0 0 0 -1 1 -1 0 0 0 0
end
13 changes: 13 additions & 0 deletions test/verifiedTests/analysis/testTopology/test_manual.ine
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/home/rfleming/drive/sbgCloud/code/fork-cobratoolbox/test/verifiedTests/analysis/testTopology/test
H-representation
linearity 7 1 2 3 4 5 6 7
begin
7 10 integer
0 -1 0 0 0 0 0 1 0 0
0 1 -2 -2 0 0 0 0 0 0
0 0 1 0 0 -1 -1 0 0 0
0 0 0 1 -1 1 0 0 0 0
0 0 0 0 1 0 1 0 -1 0
0 0 1 1 0 0 0 0 0 -1
0 0 0 -1 1 -1 0 0 0 0
end
Loading