<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi,<br>
<br>
You should specialize a CglCutGenerator class to implement cut
generation.<br>
<br>
Then you need to implement:<br>
generateCuts( const OsiSolverInterface &si, OsiCuts &cs,
const CglTreeInfo info )<br>
<br>
Use <i>si</i> to obtain the fractional solution and add discovered
cuts in <i>cs</i>.<br>
<br>
Cheers,<br>
<br>
Haroldo<br>
<br>
<div class="moz-cite-prefix">Em 13-03-2016 22:07, 不入角蜗牛 escreveu:<br>
</div>
<blockquote cite="mid:tencent_13D7ECD60D13356E57750B10@qq.com"
type="cite">
<div>
<div>Hello.</div>
<div>I try to use the class CbcEventHandler to add cuts to solve
my problem, but it doesn't work.</div>
<div>for example :</div>
<div>min: x2</div>
<div>s.t. x0 + x1 >= 1;</div>
<div> x1 + x2 >= 1;</div>
<div>x0,x1,x2 in {0,1}</div>
<div>Add the question normally. I get x0 = 1, x1 = 1 and x2 = 0.
But when I try to add a cut x0 = 0 with codes:</div>
<div><\code</div>
<div> auto refSolver = model->referenceSolver(); </div>
<div> CoinPackedVector solution_cut;</div>
<div> solution_cut.setVector(len,
&cols[cols.size()-len], &values[values.size()-len]);</div>
<div> refSolver->addRow(solution_cut,
rhs_lower.back(), rhs_upper.back());</div>
<div> model->resetToReferenceSolver();</div>
<div>code\> </div>
<div>But failed. I save the model as mps file and it can be read
as:</div>
<div> TITLE BLANK;</div>
<div> [ OBJROW] MIN = C0000002;</div>
<div> [ R0000000] C0000000 + C0000001 >= 1;</div>
<div> [ R0000001] C0000001 + C0000002 >= 1;</div>
<div> [ R0000002] C0000000 = 0;</div>
<div> @BND( 0, C0000000, 0); @BND( 0, C0000001, 0);</div>
<div> @BND( 0, C0000002, 0);</div>
<div>Thanks.</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Cbc mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Cbc@list.coin-or.org">Cbc@list.coin-or.org</a>
<a class="moz-txt-link-freetext" href="http://list.coin-or.org/mailman/listinfo/cbc">http://list.coin-or.org/mailman/listinfo/cbc</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
==================================================
Haroldo Gambini Santos
D.Sc, Computer Science
Universidade Federal de Ouro Preto
<a class="moz-txt-link-freetext" href="http://www.decom.ufop.br/haroldo/">http://www.decom.ufop.br/haroldo/</a></pre>
</body>
</html>