<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Dear Ahmad, <br>
    <br>
    as you noticed yourself, you can only access the actual reduced
    costs (corresponding to the solved LP at the current focus node)
    during the solving stage. When creating a heuristic, you can set the
    right timing mask such that it is only called when an LP was solved
    at a node, using the timing <a moz-do-not-send="true"
href="http://scip.zib.de/doc/html/type__timing_8h.php#ac4cb022a363958364724303ce7a76897">SCIP_HEURTIMING_AFTERLPNODE.</a><br>
    <br>
    In addition, you must ensure yourself that the LP was solved to
    optimality for correct reduced costs by testing SCIPgetLPSolStat()
    against SCIP_LPSOLSTAT_OPTIMAL.<br>
    <br>
    FYI: You can also access information about the best reduced costs
    (for root reduced cost propagation) that SCIP found during the root
    LP processing using the methods SCIPvarGetBestRootRedcost,
    SCIPvarGetBestRootSol, and SCIPvarGetBestRootLPObjval.<br>
    <br>
    Let me know if this helps you continue, or if you need further
    advice on this.<br>
    <br>
    Have a nice weekend<br>
    Gregor<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 06.09.2017 um 10:27 schrieb Ahmad
      Moradi:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAND0i1YMrqfAhhboQUvAv5a0wKWmd73vnVXMFP9zmf7S7u0gyA@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Dear SCIP community,<br>
                <br>
              </div>
              I am implementing a heuristic algorithm who seeks to find
              a good (primal) solution of a given MILP. The algorithm
              actually starts by looking at reduced-cost value of
              variables after solving LP relaxation of the MILP.<br>
              <br>
            </div>
            I simply coded the LP and solved it. Then I used the method
            <span style="font-family:monospace,monospace">SCIPgetVarRedcost()</span>
            to see reduced-cost value of my original LP variables.
            However, I noticed that some of the values are negative,
            contradicting to optimality as the LP has minimization
            objective sense. Then I found that scip is not in the
            solving stage (SCIP_STAGE_SOLVING) as required by  <span
              style="font-family:monospace,monospace">SCIPgetVarRedcost()</span>...
            is that the why some reduced-costs get negative? if so, how
            can I access correct reduced cost values (according to
            optimal basis).<br>
            <br>
          </div>
          Bests,<br>
        </div>
        Ahmad<br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Scip mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Scip@zib.de">Scip@zib.de</a>
<a class="moz-txt-link-freetext" href="https://listserv.zib.de/mailman/listinfo/scip">https://listserv.zib.de/mailman/listinfo/scip</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>