[Cbc] How to add cuts?
Haroldo Gambini Santos
haroldo.santos at gmail.com
Sun Mar 13 21:17:51 EDT 2016
Hi,
You should specialize a CglCutGenerator class to implement cut generation.
Then you need to implement:
generateCuts( const OsiSolverInterface &si, OsiCuts &cs, const
CglTreeInfo info )
Use /si/ to obtain the fractional solution and add discovered cuts in /cs/.
Cheers,
Haroldo
Em 13-03-2016 22:07, 不入角蜗牛 escreveu:
> Hello.
> I try to use the class CbcEventHandler to add cuts to solve my
> problem, but it doesn't work.
> for example :
> min: x2
> s.t. x0 + x1 >= 1;
> x1 + x2 >= 1;
> x0,x1,x2 in {0,1}
> 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:
> <\code
> auto refSolver = model->referenceSolver();
> CoinPackedVector solution_cut;
> solution_cut.setVector(len, &cols[cols.size()-len],
> &values[values.size()-len]);
> refSolver->addRow(solution_cut, rhs_lower.back(),
> rhs_upper.back());
> model->resetToReferenceSolver();
> code\>
> But failed. I save the model as mps file and it can be read as:
> TITLE BLANK;
> [ OBJROW] MIN = C0000002;
> [ R0000000] C0000000 + C0000001 >= 1;
> [ R0000001] C0000001 + C0000002 >= 1;
> [ R0000002] C0000000 = 0;
> @BND( 0, C0000000, 0); @BND( 0, C0000001, 0);
> @BND( 0, C0000002, 0);
> Thanks.
>
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cbc
--
==================================================
Haroldo Gambini Santos
D.Sc, Computer Science
Universidade Federal de Ouro Preto
http://www.decom.ufop.br/haroldo/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20160313/0b1ce78f/attachment.html>
More information about the Cbc
mailing list