<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Marco,<br>
      <br>
      My mistake (and laziness).  Each branching object should tighten
      the bounds.  This was being done on branching, but when I dug into
      code - not on final check of solution.  I have updated trunk and
      it now works.<br>
      <br>
      John Forrest<br>
      On 28/06/14 11:59, mg wrote:<br>
    </div>
    <blockquote
cite="mid:CAOayR=bH4+2PX0mDJdHp8qkzqASg0EbZ=wvd1uW_MJHP3TFQXQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">Sorry for bothering you again, just one small doubt
        remaining.
        <div>You said that in my lotsize example, the integrality of a
          variable was overridden by the lotsize object. </div>
        <div>In cases like this, when one or more objects give branching
          constraints on the same variable, is there a rule to solve
          these kind of conflicts ?</div>
        <div>e.g. object with higher priority wins ?</div>
        <div><br>
        </div>
        <div>Thanks again</div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">2014-06-28 12:30 GMT+02:00 mg <span
            dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:giunto.cardanico@gmail.com" target="_blank">giunto.cardanico@gmail.com</a>&gt;</span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Thanks a lot John for the bug fixes and
              extensive explanation.
              <div><br>
              </div>
              <div><br>
              </div>
            </div>
            <div class="gmail_extra">
              <br>
              <br>
              <div class="gmail_quote">2014-06-28 10:14 GMT+02:00 John
                Forrest <span dir="ltr">&lt;<a moz-do-not-send="true"
                    href="mailto:john.forrest@fastercoin.com"
                    target="_blank">john.forrest@fastercoin.com</a>&gt;</span>:
                <div>
                  <div class="h5"><br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div text="#000000" bgcolor="#FFFFFF">
                        <div>Marco,<br>
                          <br>
                          I would strongly recommend going to Cbc/trunk
                          as then I can quickly fix things for you.<br>
                          <br>
                          There are three! ways of passing in  SOS to
                          Cbc -<br>
                          1) SOS indicated in an mps file going in via
                          OsiClp.<br>
                          2) SOS set in CbcModel.solver() by OsiSOS<br>
                          3) SOS set in CbcModel by CbcSOS<br>
                          <br>
                          1) and 3) were working but 2) was not being
                          detected (now fixed) - so probably better to
                          have<br>
                          <br>
                              objs[0]= new
                          CbcSOS(&amp;model,3,which,NULL,0,1);<br>
                              model.addObjects(1,objs);<br>
                          <br>
                          in your code.<br>
                          <br>
                          The Lotsizing example does work on stable -
                          but I can see problems with stable.  Osi and
                          OsiClp do not know about lotsizing so again
                          you need to use model.addObjects(1,objs).   <br>
                          <br>
                          This worked on stable if I used
                          model.branchAndBound().  I have fixed in trunk
                          so that callCbc also works correctly.<br>
                          <br>
                          However for safety you need to modify your
                          code a bit - by playing around a bit with
                          bounds I managed to get a solution with x1 at
                          6.33333, even though x1 was declared as
                          integer.  This is because a lotsizing decision
                          overrode the integer decision.  There is no
                          elegant change to code to fix that problem,
                          but the solution is trivial.  If you really
                          want ranges of valid values in a lotsizing
                          variable then do not declare it to be
                          integer.  If you want a subset of points, then
                          again do not declare it as integer but use
                          something like -<br>
                          <br>
                              double points[7] = 
                          {0.0,3.0,4.0,5.0,6.0,8.0,10.0};<br>
                              objs[0] = new
                          CbcLotsize(&amp;model,1,7,points);<br>
                              model.addObjects(1,objs);<br>
                          <br>
                          If you want something even more complicated
                          then it is easy to derive a MyLotsizing object
                          which does exactly what you want.<br>
                          <br>
                          I attach a (much) modified version of your
                          code (adjusted for gcc).<br>
                          <br>
                          I hope this helps.
                          <div><br>
                            <br>
                            John Forrest<br>
                            On 27/06/14 15:50, mg wrote:<br>
                          </div>
                        </div>
                        <blockquote type="cite">
                          <div>
                            <div>
                              <div dir="ltr">Hi all,
                                <div>I'm trying to use SOS and
                                  LotSize/SemiContinuous objects without
                                  success.</div>
                                <div><br>
                                </div>
                                <div>I have created a very simple
                                  program (attached) containing a small
                                  problem with SOS and a small problem
                                  using LotSize objects...  </div>
                                <div><br>
                                </div>
                                <div>The SOS test problem is the
                                  following:</div>
                                <div><br>
                                </div>
                                <div>
                                  <div>max         3 * x0 + 2 * x1 + 4 *
                                    x2</div>
                                  <div>subject to</div>
                                  <div>            x0, x1, x2 binary</div>
                                  <div>            sos1(x0, x1, x2)</div>
                                </div>
                                <div><br>
                                </div>
                                <div>and solving it, I get x0 = 1, x1=
                                  1, x2 = 1 where I expected just one
                                  single 1...</div>
                                <div><br>
                                </div>
                                <div>The LotSize/SemiContinuous test
                                  problem is the following:</div>
                                <div><br>
                                </div>
                                <div>
                                  <div>min         2 * x0 + 3 * x1 + x2</div>
                                  <div>subject to</div>
                                  <div>            3 * x0 + 5 * x1 + 7 *
                                    x2 &lt;= 42</div>
                                  <div>            4 * x0 + 3 * x1 + 2 *
                                    x2 &lt;= 31</div>
                                  <div>            2 * x0 + 1 * x1 + 5 *
                                    x2 &lt;= 23</div>
                                  <div>            x0, x1, x2 integers
                                    [0,4]</div>
                                  <div>            x1 semi-continuous
                                    can be 0 or [3,4]</div>
                                </div>
                                <div><br>
                                </div>
                                <div><span>and solving it, I get x0 = 4,
                                    x1 = 2 where I expected x1 being 0,3
                                    or 4</span><br>
                                </div>
                                <div><span><br>
                                  </span></div>
                                <div>Am I doing something wrong ?</div>
                                <div><br>
                                </div>
                                <div>Thanks in advance,</div>
                                <div>Marco</div>
                              </div>
                              <br>
                              <fieldset></fieldset>
                              <br>
                            </div>
                          </div>
                          <div>
                            <pre>_______________________________________________
Cbc mailing list
<a moz-do-not-send="true" href="mailto:Cbc@list.coin-or.org" target="_blank">Cbc@list.coin-or.org</a>
<a moz-do-not-send="true" href="http://list.coin-or.org/mailman/listinfo/cbc" target="_blank">http://list.coin-or.org/mailman/listinfo/cbc</a>
</pre>
                          </div>
                        </blockquote>
                        <br>
                      </div>
                      <br>
                      _______________________________________________<br>
                      Cbc mailing list<br>
                      <a moz-do-not-send="true"
                        href="mailto:Cbc@list.coin-or.org"
                        target="_blank">Cbc@list.coin-or.org</a><br>
                      <a moz-do-not-send="true"
                        href="http://list.coin-or.org/mailman/listinfo/cbc"
                        target="_blank">http://list.coin-or.org/mailman/listinfo/cbc</a><br>
                      <br>
                    </blockquote>
                  </div>
                </div>
              </div>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>