<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    -- Thank you John,<br>
    <br>
    a,b) this is not a very clean interface... maybe put this into
    postProcess so I can access the correct obj from originalModel()?<br>
    <br>
    c) what do you mean by size? The preprocessed model has always
    smaller NumColumns() than the start model in my examples and
    originalModel() has always the same number. In the meantime I have
    an example where postProcess() crashes, probably on a model which is
    not intended to be post-processed.<br>
    <br>
    How is it with cut generators, do they get LP solution for the
    original model?<br>
    <br>
    I'd be happy to access the current number of open (unexplored) nodes
    by some interface method. Also in the solution callback, assuming we
    get it to work.<br>
    <br>
    I noticed when performing postprocessing in the callback, the
    solution way differs... probably because post-processing calls some
    LP resolving procedures? I tried to create a copy of
    *cbcCglPreProcess each time but the copy crashes.<br>
    <br>
    Gleb<br>
    <br>
    <div class="moz-cite-prefix">On 24/02/2016 8:34 PM, John Forrest
      wrote:<br>
    </div>
    <blockquote cite="mid:56CD793A.7060103@fastercoin.com" type="cite">
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      <div class="moz-cite-prefix">Gleb,<br>
        <br>
        On wrong objective value<br>
        <br>
        a) you need to take into account fixed part of objective<br>
        <br>
        solver->getDblParam(OsiObjOffset, objOffset);<br>
        <br>
        b) internally it is always minimization<br>
        <br>
        c) only report when size of problem is same as preprocessed
        model - first report could come from heuristic on a smaller
        model<br>
        <br>
        John<br>
        <br>
        On 24/02/16 01:09, Gleb Belov wrote:<br>
      </div>
      <blockquote cite="mid:56CD02E6.7000005@monash.edu" type="cite">
        <meta content="text/html; charset=utf-8"
          http-equiv="Content-Type">
        Hi John,<br>
        <br>
        the callBack() function from interrupt.cpp is wrong, my code
        either crashes when using callCbc1, or exits without anything
        when CbcMain1. BTW the NEW_STYLE_SOLVER==1 variant with
        CbcSolver does not use the callBack() at all. I resorted to
        simple callCbc(options, model) as before.<br>
        <br>
        Implemented for now only the objective value conversion as
        follows:<br>
        <br>
        <blockquote><tt>    if
            (whichEvent==solution||whichEvent==heuristicSolution) {</tt><tt><br>
          </tt><tt>      if ( 0!=cbcPreProcessPointer ) {</tt><tt><br>
          </tt><tt>        cbcPreProcessPointer->postProcess(
            *model_->solver(), false );</tt><tt><br>
          </tt><tt>        printf("VALUE of solution is %g\n",</tt><tt><br>
          </tt><tt>              
            cbcPreProcessPointer->originalModel()->getObjValue());</tt><tt><br>
          </tt><tt>      }</tt><tt><br>
          </tt><tt>      return noAction; // carry on</tt><tt><br>
          </tt><tt>    } else {</tt><tt><br>
          </tt><tt>      return noAction; // carry on</tt><tt><br>
          </tt><tt>    }</tt><tt><br>
          </tt></blockquote>
        <br>
        It seems to show a local dual bound sometimes, or I don't know
        where 328 below came from:<br>
        <br>
        <blockquote><tt>Integer solution of 1894 found by RINS after
            30787 iterations and 200 nodes (11.59 seconds)</tt><tt><br>
          </tt><tt>VALUE of solution is 1804</tt><tt><br>
          </tt><tt>VALUE of solution is 328</tt><tt><br>
          </tt><tt>Integer solution of 1680 found by strong branching
            after 42125 iterations and 281 nodes (14.78 seconds)</tt><tt><br>
          </tt><tt>VALUE of solution is 1558</tt><tt><br>
          </tt><tt>Integer solution of 1589 found by strong branching
            after 53959 iterations and 329 nodes (17.41 seconds)</tt><tt><br>
          </tt><tt>VALUE of solution is 1402</tt><tt><br>
          </tt></blockquote>
        <br>
        Moreover, on another problem which is a maximization, it seems
        not to get the current solution at all:<br>
        <br>
        <blockquote><tt>After 0.14 seconds - Feasibility pump exiting
            with objective of -4 - took 0.13 seconds</tt><tt><br>
          </tt><tt>Integer solution of -4 found by feasibility pump
            after 0 iterations and 0 nodes (0.14 seconds)</tt><tt><br>
          </tt><tt>VALUE of solution is 8</tt><tt><br>
          </tt><tt>VALUE of solution is 8</tt><tt><br>
          </tt><tt>Full problem 142 rows 181 columns, reduced to 77 rows
            57 columns</tt><tt><br>
          </tt><tt>........<br>
          </tt><tt>Maximum depth 0, 0 variables fixed on reduced cost</tt><tt><br>
          </tt><tt>VALUE of solution is 8</tt><tt><br>
          </tt><tt>18 added rows had average density of 41.666667</tt><tt><br>
          </tt><tt>At root node, 18 cuts changed objective from -8 to -8
            in 100 passes</tt><tt><br>
          </tt><tt>Cut generator 0 (Probing) - 236 row cuts average 5.1
            elements, 0 column cuts (0 active)  in 0.100 seconds - new
            frequency is -100</tt><tt><br>
          </tt><tt>....<br>
          </tt><tt>Cut generator 6 (TwoMirCuts) - 119 row cuts average
            135.9 elements, 0 column cuts (0 active)  in 0.040 seconds -
            new frequency is -100</tt><tt><br>
          </tt><tt>VALUE of solution is 8</tt><tt><br>
          </tt><tt>After 0 nodes, 1 on tree, -4 best solution, best
            possible -8 (0.85 seconds)</tt><tt><br>
          </tt><tt>Full problem 142 rows 181 columns, reduced to 67 rows
            44 columns</tt><tt><br>
          </tt><tt>The LP relaxation is infeasible or too expensive</tt><tt><br>
          </tt><tt>Solution of 1e+50 already found by heuristic</tt><tt><br>
          </tt><tt>...<br>
          </tt><tt>Maximum depth 0, 0 variables fixed on reduced cost</tt><tt><br>
          </tt><tt>Integer solution of -8 found by strong branching
            after 7137 iterations and 161 nodes (1.26 seconds)</tt><tt><br>
          </tt><tt>VALUE of solution is 8</tt><tt><br>
          </tt></blockquote>
        <br>
        <br>
        Gleb<br>
        <br>
        <div class="moz-cite-prefix">On 23/02/2016 8:45 PM, John Forrest
          wrote:<br>
        </div>
        <blockquote cite="mid:56CC2A45.9020805@fastercoin.com"
          type="cite">
          <meta content="text/html; charset=utf-8"
            http-equiv="Content-Type">
          <div class="moz-cite-prefix">Gleb,<br>
            <br>
            On 23/02/16 05:25, Gleb Belov wrote:<br>
          </div>
          <blockquote cite="mid:56CBED61.1080707@monash.edu" type="cite">
            <meta content="text/html; charset=utf-8"
              http-equiv="Content-Type">
            Hi John,<br>
            <br>
            there is demand for continuous solution output so I am
            trying this. Looks like I need a method to obtain the
            PreProcess object during solving (because it is created in
            CbcMain1). BTW you say postsolve deletes data but the 2nd
            parameter could be used to avoid this?<br>
          </blockquote>
          <br>
          There is a fudge to access the preProcess object.  Add<br>
          <br>
          extern CglPreProcess * cbcPreProcessPointer;<br>
          <br>
          to the event handler.<br>
          <blockquote cite="mid:56CBED61.1080707@monash.edu" type="cite">
            <br>
            What is the usage of the callback function opposed to the
            event handler? I don't see how I can use the callback
            because in interrupt.cpp the MyEventHandler3 class is used
            to print a solution.<br>
          </blockquote>
          <br>
          event handler only works inside CbcModel::branchAndBound.  The
          callback is to handle events before and after.  the most
          common is to add in specialized heuristics after preprocessing
          but before branch and bound<br>
          <br>
          John<br>
          <blockquote cite="mid:56CBED61.1080707@monash.edu" type="cite">
            <br>
            Gleb<br>
          </blockquote>
        </blockquote>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>