Skip to content

Commit 0478293

Browse files
authored
Merge pull request opencobra#2376 from rmtfleming/develop
solver bugs with QP rcost
2 parents 73dbe17 + 33c8d11 commit 0478293

File tree

6 files changed

+56
-4
lines changed

6 files changed

+56
-4
lines changed

src/analysis/FBA/optimizeCbModel.m

+4-2
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@
607607
solution.slack = [];
608608

609609
elseif strcmp(minNorm, 'one')
610-
% Optimize the absolute value of fluxes
610+
% Minimise the absolute value of fluxes
611611
% Solve secondary LP to optimize weighted 1-norm of v
612612
% Weight provided by model.g1
613613
% Set up the optimization problem
@@ -637,6 +637,8 @@
637637
end
638638
optProblem2.b = [optProblem.b;zeros(2*nRxns,1);objectiveLP];
639639

640+
optProblem2.b = [optProblem.b;zeros(2*nRxns,1);objectiveLP];
641+
640642
%csense for 3 & 4 above
641643
optProblem2.csense = [optProblem.csense; repmat('G',2*nRxns,1)];
642644
% constrain the optimal value according to the original problem
@@ -648,7 +650,7 @@
648650
%LPproblem2.csense(nTotalVars+1) = 'L'; %wrong
649651
end
650652

651-
optProblem2.osense = 1;
653+
optProblem2.osense = 1;%minimise
652654
% Re-solve the problem
653655
if allowLoops
654656
solution = solveCobraLP(optProblem2, param);

src/base/solvers/solveCobraQP.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@
442442
end
443443

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

448448
%debugging
449449
if problemTypeParams.printLevel>2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
Met #1 13dpg[c]
3+
4+
Consuming reactions: none
5+
Producing reactions:
6+
#49 <a href="matlab: surfNet([], 'GAPD', 0, NaN, 0, 1, [], 0, 0.800000);">GAPD</a>
7+
<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>
8+
#75 <a href="matlab: surfNet([], 'PGK', 0, NaN, 0, 1, [], 0, 0.800000);">PGK</a>
9+
<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>
10+
11+
<a href="matlab: surfNet([], [], 0, NaN, 0, 1, [], 0, 0.800000, struct('showPrev', true));">Show previous steps...</a>
12+
13+
Met #1 13dpg[c]
14+
15+
Consuming reactions: none
16+
Producing reactions:
17+
#49 <a href="matlab: surfNet([], 'GAPD', 0, NaN, 0, 1, [], 0, 0.800000);">GAPD</a>
18+
<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>
19+
#75 <a href="matlab: surfNet([], 'PGK', 0, NaN, 0, 1, [], 0, 0.800000);">PGK</a>
20+
<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>
21+
22+
<a href="matlab: surfNet([], [], 0, NaN, 0, 1, [], 0, 0.800000, struct('showPrev', true));">Show previous steps...</a>
23+
'NOTEXIST' is not a metabolite, reaction or gene of the model.
24+
Searching for related objects:

test/verifiedTests/analysis/testTopology/test.ext

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/home/rfleming/drive/sbgCloud/code/fork-cobratoolbox/test/verifiedTests/analysis/testTopology/test
2+
H-representation
3+
linearity 7 1 2 3 4 5 6 7
4+
begin
5+
7 10 integer
6+
0 -1 0 0 0 0 0 1 0 0
7+
0 1 -2 -2 0 0 0 0 0 0
8+
0 0 1 0 0 -1 -1 0 0 0
9+
0 0 0 1 -1 1 0 0 0 0
10+
0 0 0 0 1 0 1 0 -1 0
11+
0 0 1 1 0 0 0 0 0 -1
12+
0 0 0 -1 1 -1 0 0 0 0
13+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/home/rfleming/drive/sbgCloud/code/fork-cobratoolbox/test/verifiedTests/analysis/testTopology/test
2+
H-representation
3+
linearity 7 1 2 3 4 5 6 7
4+
begin
5+
7 10 integer
6+
0 -1 0 0 0 0 0 1 0 0
7+
0 1 -2 -2 0 0 0 0 0 0
8+
0 0 1 0 0 -1 -1 0 0 0
9+
0 0 0 1 -1 1 0 0 0 0
10+
0 0 0 0 1 0 1 0 -1 0
11+
0 0 1 1 0 0 0 0 0 -1
12+
0 0 0 -1 1 -1 0 0 0 0
13+
end

0 commit comments

Comments
 (0)