[Cbc] 回复: How to add cuts?

不入角蜗牛 1164651620 at qq.com
Sun Mar 13 21:22:52 EDT 2016


Thanks, Haroldo. I'll try it later.




------------------ 原始邮件 ------------------
发件人: "Haroldo Gambini Santos"<haroldo.santos at gmail.com>; 
发送时间: 2016年3月14日(星期一) 上午9:17
收件人: "不入角蜗牛"<1164651620 at qq.com>; "cbc"<cbc at list.coin-or.org>; 
主题: Re: [Cbc] How to add cuts?



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/20160314/91c63c77/attachment.html>


More information about the Cbc mailing list