<html>
I've tried to trap message 102 (CLP_SIMPLEX_HOUSE2) since my algorithm
needs to find all feasible extreme points (FEPs) with an objective value
within a limit. However, for a minimization problem,&nbsp; the FEPs
produced an increasing objective value stream like:<br>
0.125<br>
10.4<br>
....<br>
415.8<br>
521.15 (optimal solution)<br>
<br>
Since this was minimization, I expected the FEPs would produce a decrease
objective value stream like (100012.3, 2569.2, ..., 652.0, 521.15). Have
I done something wrong? (please see the description below.)<br>
<br>
Thanks,<br>
<br>
Yiming<br>
<br>
----------------------------------------------------------<br>
<br>
Here's what I've done:<br>
<br>
1. in ClpMessage.cpp, changed<br>
{CLP_SIMPLEX_HOUSE2,102,4,&quot;%d %g In: %c%d Out: %c%d%? dj ratio %g
distance %g%? dj %g distance %g&quot;},<br>
to<br>
{CLP_SIMPLEX_HOUSE2,102,4,&quot;%d %g In: %c%d Out: %c%d%? dj ratio %g
distance %g%? dj %g distance %g&quot;},<br>
<br>
2. Created MlpMessageHandler class by inheriting CoinMessageHandler in a
similar way as the MyMessageHandler class.&nbsp; The main method of this
class looks like the following (I also asked some questions as
comments):<br>
<br>
int <br>
MlpMessageHandler::print()<br>
{<br>
&nbsp; if (currentSource()==&quot;Clp&quot;) {<br>
&nbsp;&nbsp;&nbsp; if (currentMessage().externalNumber()==102) {<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // feasible?<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Is this better way to check
feasibility?<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if
(model_-&gt;numberPrimalInfeasibilities()== intValue(1));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if
(model_-&gt;numberPrimalInfeasibilities()==0) {<br>
<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>// this
seems to give wrong value: double objValue =
model_-&gt;getObjValue();<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // compute objective
value = solution{[]*objCoef[].<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp; int
numberColumns = model_-&gt;numberColumns();<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
double * solutionRaw = model_-&gt;solutionRegion(1);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
const double * columnScale = model_-&gt;columnScale();<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
bool scaleFlag = model_-&gt;columnScale();<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
double *solution = new double[numberColumns];<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp; for
(int i=0;i&lt;numberColumns;i++) {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
if(scaleFlag) {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
solution[i] = solutionRaw[i] * columnScale[i];<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp; }
else {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
solution[i] =
solutionRaw[i];<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
}<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>}<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>const
double *objCoefs = model_-&gt;getObjCoefficients();<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>double
objValue1 = 0;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>for (int
i=0;i&lt;numberColumns;i++) {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
objValue1 += solution[i]*objCoefs[i];<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Observe
objective value. Strange that objValue1 increases iteration after
iteration for minimization.<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>cout
&lt;&lt; objValue1 &lt;&lt; endl;<br>
<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>// Is the
objective value within limit? <br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>if(
objValue1 &gt; 0 &amp;&amp; objValue1 &lt;= artificialBound) { //
artificialBound is an input parameter<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>//twoLevelPtr
points to my algorithm object.<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
twoLevelPtr-&gt;addCut(solution);<br>
<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>}<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>delete []
solution;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp; }<br>
&nbsp; return CoinMessageHandler::print();<br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
At 05:31 PM 7/24/2003 -0400, you wrote:<br>
<br>
<blockquote type=cite class=cite cite><font size=2>Yiming,</font> <br>
<br>
<font size=2>If anything I found a slight bug/feature so that it would
save even when infeasible. </font><br>
<br>
<font size=2>It should be okay, although message 5 is only printed every
re-factorization so on small problems you may not get enough
solutions.&nbsp; One way round that would be to set&nbsp; the
factorization frequency to small for small problems.&nbsp; At present I
am busy with a development branch and don't have code to hand but there
is an example in Samples/driver.cpp.&nbsp;&nbsp;&nbsp; In the development
branch &quot;pre&quot; you would say</font> <br>
<br>
<font size=2>if (model2-&gt;numberRows()&lt;100)</font> <br>
<font size=2>&nbsp;&nbsp; model2-&gt;setFactorizationFrequency(10)</font>
<br>
<br>
<font size=2>I think in the default it would be</font> <br>
<font size=2>if ()</font> <br>
<font size=2>&nbsp; model2-&gt;factorization()-&gt;maximumPivots(10);</font> <br>
<br>
<font size=2>and you would have to include ClpFactorization.hpp</font> <br>
<br>
<font size=2>If that does not help, then one of the beauties of open source is that you can debug it for me :-)</font> <br>
<br>
<font size=2>If it is easy, send me enough to debug it.&nbsp; If not then just put a few printf or std::cout statements - it should be easy to see what is happening.</font> <br>
<br>
<font size=2>If you want every iteration then trap message 102 </font><br>
<br>
<font size=2>John Forrest</font> </blockquote><br>
</html>