3110https://www.ibm.com/developerworks/community/forums/atom/replies?topicUuid=77777777-0000-0000-0000-000014491258How to "set lpmethod" in MATLAB? Replies2013-02-05T06:49:30.219ZIBM Connections - Discussion Forumurn:lsid:ibm.com:forum:77777777-0000-0000-0000-000014937066Re: How to "set lpmethod" in MATLAB?2013-02-05T06:49:30.219ZSystemAdmin110000D4XKactive2013-02-05T06:49:30.219Z
> <span class="jive-quote-header">Ronny81 wrote:</span><br />
> I tried the second way. When I check the output variable returned, output.algorithm=2. When I try lpmethod=2, the algorithm is also 2, but if I change the lpmethod=1, it uses algorithm 1. How can I verify that it is using the network simplex method?<br />
><br />
I don't understand. Isn't it expected that algorithm 1 is used if you set lpmethod to 1? What is the problem here? The network simplex method is algorithm 3.<br />
<br />
> Additionally, I tried this on a much larger problem with thousands of variables and constraints. The output.time was less than 1 second but the actual time, which I computed using tic/toc around the cplexlp function, was almost 20 seconds. Any reason for such overhead or why the big difference?<br />
><br />
What time did you measure with tic/toc? The time reported by CPLEX does not include the time to setup the internal CPLEX problem from the data provided in matlab. If this transformation takes very long then time spent in the solve() call may be significantly larger than the time required for the actual solve itself.<br />
<br />
> <br />
> Thank you for your help.
none, view_forum, view_categoryurn:lsid:ibm.com:forum:77777777-0000-0000-0000-000014935328Re: How to "set lpmethod" in MATLAB?2013-01-30T20:23:52.371ZSystemAdmin110000D4XKactive2013-01-30T20:23:52.371Z
I tried the second way. When I check the output variable returned, output.algorithm=2. When I try lpmethod=2, the algorithm is also 2, but if I change the lpmethod=1, it uses algorithm 1. How can I verify that it is using the network simplex method?<br />
<br />
Additionally, I tried this on a much larger problem with thousands of variables and constraints. The output.time was less than 1 second but the actual time, which I computed using tic/toc around the cplexlp function, was almost 20 seconds. Any reason for such overhead or why the big difference?<br />
<br />
Thank you for your help.
none, view_forum, view_categoryurn:lsid:ibm.com:forum:77777777-0000-0000-0000-000014491287Re: How to "set lpmethod" in MATLAB?2010-07-28T07:23:34.109ZJohn Cui27000203RUactive2010-07-28T07:23:34.109Z2014-03-25T00:32:27.410Ziron-man270000AK5Mactive
OK, <br />
<br />
2 ways: <br />
1. Use Cplex class. <br />
<pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">
>> cplex=Cplex();
>> cplex.addCols(1);
>> cplex.Param.lpmethod.Cur = 3;
>> cplex.solve();
</pre>
<br />
2. Use toolbox function <br />
<pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">
f = [-1 -2 -3]';
Aineq = [-1 1 1; 1 -3 1];
bineq = [20 30]';
lb = [0 0 0]';
ub = [40 inf inf]';
options = cplexoptimset('cplex');
options.lpmethod = 3;
[x, fval, exitflag, output] = cplexlp ...
(f, Aineq, bineq, [], [], lb, ub, [], options);
</pre>
<br />
<br />
John Cui
none, view_forum, view_category