<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, 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,"%d %g In: %c%d Out: %c%d%? dj ratio %g
distance %g%? dj %g distance %g"},<br>
to<br>
{CLP_SIMPLEX_HOUSE2,102,4,"%d %g In: %c%d Out: %c%d%? dj ratio %g
distance %g%? dj %g distance %g"},<br>
<br>
2. Created MlpMessageHandler class by inheriting CoinMessageHandler in a
similar way as the MyMessageHandler class. 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>
if (currentSource()=="Clp") {<br>
if (currentMessage().externalNumber()==102) {<br>
<br>
// feasible?<br>
// Is this better way to check
feasibility?<br>
// if
(model_->numberPrimalInfeasibilities()== intValue(1));<br>
if
(model_->numberPrimalInfeasibilities()==0) {<br>
<br>
<x-tab> </x-tab>// this
seems to give wrong value: double objValue =
model_->getObjValue();<br>
<br>
// compute objective
value = solution{[]*objCoef[].<br>
<x-tab> </x-tab> int
numberColumns = model_->numberColumns();<br>
<x-tab> </x-tab>
double * solutionRaw = model_->solutionRegion(1);<br>
<x-tab> </x-tab>
const double * columnScale = model_->columnScale();<br>
<x-tab> </x-tab>
bool scaleFlag = model_->columnScale();<br>
<x-tab> </x-tab>
double *solution = new double[numberColumns];<br>
<x-tab> </x-tab> for
(int i=0;i<numberColumns;i++) {<br>
<x-tab> </x-tab>
if(scaleFlag) {<br>
<x-tab> </x-tab>
solution[i] = solutionRaw[i] * columnScale[i];<br>
<x-tab> </x-tab> }
else {<br>
<x-tab> </x-tab>
solution[i] =
solutionRaw[i];<x-tab> </x-tab><br>
<x-tab> </x-tab>
}<br>
<x-tab> </x-tab>}<br>
<x-tab> </x-tab>const
double *objCoefs = model_->getObjCoefficients();<br>
<x-tab> </x-tab>double
objValue1 = 0;<br>
<x-tab> </x-tab>for (int
i=0;i<numberColumns;i++) {<br>
<x-tab> </x-tab>
objValue1 += solution[i]*objCoefs[i];<br>
<x-tab> </x-tab>}<br>
<br>
//Observe
objective value. Strange that objValue1 increases iteration after
iteration for minimization.<br>
<x-tab> </x-tab>cout
<< objValue1 << endl;<br>
<br>
<x-tab> </x-tab>// Is the
objective value within limit? <br>
<x-tab> </x-tab>if(
objValue1 > 0 && objValue1 <= artificialBound) { //
artificialBound is an input parameter<br>
<x-tab> </x-tab>//twoLevelPtr
points to my algorithm object.<br>
<x-tab> </x-tab>
twoLevelPtr->addCut(solution);<br>
<br>
<x-tab> </x-tab>}<br>
<x-tab> </x-tab>delete []
solution;<br>
}<br>
}<br>
}<br>
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. One way round that would be to set the
factorization frequency to small for small problems. 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. In the development
branch "pre" you would say</font> <br>
<br>
<font size=2>if (model2->numberRows()<100)</font> <br>
<font size=2> model2->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> model2->factorization()->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. 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>