<br><font size=2 face="sans-serif">Johan,</font>
<br>
<br><font size=2 face="sans-serif">I will look into it at medium priority
to get things to work - at least on small problems.</font>
<br>
<br><font size=2 face="sans-serif">John Forrest</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Johan Löfberg &lt;loefberg@control.ee.ethz.ch&gt;</b>
</font>
<br><font size=1 face="sans-serif">Sent by: coin-lpsolver-bounces@list.coin-or.org</font>
<p><font size=1 face="sans-serif">01/20/2005 01:06 PM</font>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">&lt;coin-lpsolver@list.coin-or.org&gt;</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">[Coin-lpsolver] Problems
coding mex interface</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt>Hi all,<br>
<br>
I sat down today to finish a mex (MATLAB) interface to the CLP solvers,
but<br>
I seem to get into trouble regarding the QP solver.<br>
<br>
I have essentially two problems<br>
<br>
1: The simplex method for QP does not return any duals, and the dual simplex<br>
fails. This is expected right?, from reading the FAQ.<br>
2: The barrier method for QP gives wrong solutions and crashes. This is<br>
probably due to some mistake by me.<br>
<br>
The pseudo-code below shows the structure of my code. For LP problems,
it<br>
work as expected. I get the correct solution for all different solvers,
and<br>
correct dual variables. For QP problems, simplex method work fine (except<br>
the dual variables) but the barrier method fails.<br>
<br>
Any hints?<br>
<br>
Best,<br>
johan lofberg<br>
<br>
//And yes, IANACP (I am not a C programmer)<br>
<br>
<br>
**** PSEUDO MEX INTERFACE (returns primals in x and duals in lambda)<br>
<br>
if simplex<br>
 &nbsp; &nbsp;ClpSimplex * model = new ClpSimplex();<br>
else<br>
 &nbsp; &nbsp;ClpInterior * model = new ClpInterior();<br>
end<br>
<br>
model-&gt;loadProblem(ncols,nrows,cmatbeg,cmatind,cmatval,lower,upper,obj,lhs,r<br>
hs);<br>
model-&gt;loadQuadraticObjective(ncols,cmatbegQ,cmatindQ,cmatvalQ);<br>
<br>
 switch (solverchoice)<br>
 {<br>
 case simplex primal:<br>
 &nbsp;{<br>
 &nbsp; &nbsp;model-&gt;primal();<br>
 &nbsp;}<br>
 &nbsp; &nbsp;case simplex dual:<br>
 &nbsp;{<br>
 &nbsp; &nbsp;model-&gt;dual();<br>
 &nbsp;}<br>
 case barrier:<br>
 &nbsp;{<br>
 &nbsp; &nbsp;ClpCholeskyDense * cholesky = new ClpCholeskyDense();<br>
 &nbsp; &nbsp;model-&gt;setCholesky(cholesky);<br>
 &nbsp; &nbsp;model-&gt;primalDual();<br>
 }<br>
<br>
<br>
<br>
double *primal;<br>
double *dual;<br>
primal = model-&gt;primalColumnSolution();<br>
dual = model-&gt;dualRowSolution();<br>
*returncode = model-&gt;status();<br>
<br>
for ( i=0;i&lt;ncols;i++)<br>
{<br>
 &nbsp; &nbsp;x[i] = primal[i];<br>
}<br>
<br>
for ( i=0;i&lt;nrows;i++)<br>
{<br>
 &nbsp; &nbsp;lambda[i] = dual[i];<br>
}<br>
<br>
_______________________________________________<br>
Coin-lpsolver mailing list<br>
Coin-lpsolver@list.coin-or.org<br>
http://list.coin-or.org/mailman/listinfo/coin-lpsolver<br>
</tt></font>
<br>