<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello everyone,</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you so much for all your responses. Everything is much clearer now.</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best regards,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Enrico</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Da:</b> Ambros Gleixner <ambros.gleixner@HTW-Berlin.de><br>
<b>Inviato:</b> lunedì 27 gennaio 2025 23:18<br>
<b>A:</b> scip@zib.de <scip@zib.de>; Enrico Calandrini <e.calandrini@studenti.unipi.it><br>
<b>Oggetto:</b> Re: [SCIP] R: Access Dual Values with SCIP</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi Enrico,<br>
<br>
Marco is right that the transformed constraint is the one for which SCIP <br>
stores the dual, but the method SCIPgetDualSolVal() internally already <br>
converts original to transformed constraints automatically.  So using <br>
SCIPgetTransformedCons() is correct, but should be unnecessary.<br>
<br>
The real problem is indeed presolving.  You are right that for LPs it is <br>
possible to retrieve dual solutions for the original constraints after a <br>
stack of LP presolve reductions, and all decent LP solvers provide this <br>
functionality.  However, SCIP's presolvers do not, since SCIP focuses on <br>
the case that the input problem is nonconvex.<br>
<br>
The option to retrieve duals from the underlying LP solver is hence only <br>
safely possible if no other algorithms are configured to run before SCIP <br>
calls the LP solver, i.e., presolving, propagation, and heuristics <br>
should be disabled:<br>
<br>
SCIP_CALL( SCIPsetPresolving(scip, SCIP_PARAMSETTING_OFF, TRUE) );<br>
SCIP_CALL( SCIPsetIntParam("propagating/maxroundsroot", 0) );<br>
SCIP_CALL( SCIPsetIntParam("propagating/maxrounds", 0) );<br>
SCIP_CALL( SCIPsetHeuristics(scip, SCIP_PARAMSETTING_OFF, TRUE) );<br>
<br>
Then SCIP channels the duals of the LP solver to the user.  This is not <br>
too bad if parameter lp/presolving=TRUE (by default), because then the <br>
underlying LP solver (in your case SoPlex) will apply its own presolving.<br>
<br>
However, what will really not be possible with SCIP is to warm start the <br>
LP solver from a previous basis after slightly modifying the problem. <br>
If you are planning to solve a sequence of many LPs, then the overhead <br>
through SCIP will be rather large.  As Alex said, it will then be best <br>
to interface to SoPlex or an alternative LP solver directly.<br>
<br>
Hope that helps,<br>
Ambros<br>
<br>
<br>
Am 27.01.2025 um 22:39 schrieb Marco Lübbecke:<br>
> Hi Enrico,<br>
> <br>
> when I am not totally mistaken: yes, this is a classical source of <br>
> errors: <a href="http://listserv.zib.de/pipermail/scip/2013-March/001314.html">
http://listserv.zib.de/pipermail/scip/2013-March/001314.html</a> <br>
> <<a href="http://listserv.zib.de/pipermail/scip/2013-March/001314.html">http://listserv.zib.de/pipermail/scip/2013-March/001314.html</a>><br>
> <br>
> Take care, Marco<br>
> <br>
> <br>
> Am Mo., 27. Jan. 2025 um 22:26 Uhr schrieb Enrico Calandrini <br>
> <e.calandrini@studenti.unipi.it <<a href="mailto:e.calandrini@studenti.unipi.it">mailto:e.calandrini@studenti.unipi.it</a>>>:<br>
> <br>
>     Dear Marco,<br>
> <br>
>     Thank you for your quick reply.<br>
> <br>
>     To clarify, I am currently storing the constraints I initially<br>
>     created in a structure called /cons/, and I retrieve the dual values<br>
>     of the i-th constraint using the following approach:<br>
> <br>
>     /SCIPgetDualSolVal(scip, cons[i], &pi[i], NULL);/<br>
> <br>
>     So, I am not querying the /transformed/ constraint for dual<br>
>     variables. Would it be more appropriate to first use the method /<br>
>     SCIPgetTransformedCons/ to retrieve the transformed constraints and<br>
>     then query the dual values? This is why I am not getting any dual<br>
>     values?<br>
> <br>
>     Thank you for your help!<br>
> <br>
>     Best regards,<br>
>     Enrico<br>
> <br>
>     ------------------------------------------------------------------------<br>
>     *Da:* Marco Lübbecke <marco.luebbecke@rwth-aachen.de<br>
>     <<a href="mailto:marco.luebbecke@rwth-aachen.de">mailto:marco.luebbecke@rwth-aachen.de</a>>><br>
>     *Inviato:* lunedì 27 gennaio 2025 22:12<br>
>     *A:* Enrico Calandrini <e.calandrini@studenti.unipi.it<br>
>     <<a href="mailto:e.calandrini@studenti.unipi.it">mailto:e.calandrini@studenti.unipi.it</a>>><br>
>     *Cc:* Hoen, Alexander <hoen@zib.de <<a href="mailto:hoen@zib.de">mailto:hoen@zib.de</a>>>;<br>
>     scip@zib.de <<a href="mailto:scip@zib.de">mailto:scip@zib.de</a>> <scip@zib.de <<a href="mailto:scip@zib.de">mailto:scip@zib.de</a>>><br>
>     *Oggetto:* Re: [SCIP] R: Access Dual Values with SCIP<br>
>     Hi Enrico,<br>
> <br>
>     do you query the *transformed* constraints for dual variables?<br>
> <br>
>     All the best, Marco<br>
> <br>
> <br>
>     Am Mo., 27. Jan. 2025 um 21:26 Uhr schrieb Enrico Calandrini<br>
>     <e.calandrini@studenti.unipi.it<br>
>     <<a href="mailto:e.calandrini@studenti.unipi.it">mailto:e.calandrini@studenti.unipi.it</a>>>:<br>
> <br>
>         Dear Alexander,<br>
> <br>
>         First of all, thank you very much for your response.<br>
> <br>
>         To provide a bit more context, I’m working with the SCIP C-API<br>
>         and creating the LP model using the basic methods (e.g., /<br>
>         SCIPcreateConsBasicLinear/, /SCIPaddCoefLinear/, etc.). After<br>
>         constructing the model, I simply call /SCIPSolve/ to solve it.<br>
>         As far as I understand, this should automatically use /<br>
>         Soplex/ to solve the problem.<br>
> <br>
>         However, I’ve encountered an issue: when I run the model without<br>
>         disabling presolve, SCIP is unable to provide dual solutions. In<br>
>         contrast, when I disable presolving, the computation slows down,<br>
>         but I do receive the dual values. I’m curious to understand<br>
>         whether it is always necessary to disable presolve in order to<br>
>         retrieve the dual solutions, or if there is another way to<br>
>         obtain them.<br>
> <br>
>         Thank you again for your time and assistance!<br>
> <br>
>         Best regards,<br>
>         Enrico<br>
> <br>
>         ------------------------------------------------------------------------<br>
>         *Da:* Hoen, Alexander <hoen@zib.de <<a href="mailto:hoen@zib.de">mailto:hoen@zib.de</a>>><br>
>         *Inviato:* lunedì 27 gennaio 2025 20:34<br>
>         *A:* Enrico Calandrini <e.calandrini@studenti.unipi.it<br>
>         <<a href="mailto:e.calandrini@studenti.unipi.it">mailto:e.calandrini@studenti.unipi.it</a>>>; scip@zib.de<br>
>         <<a href="mailto:scip@zib.de">mailto:scip@zib.de</a>> <scip@zib.de <<a href="mailto:scip@zib.de">mailto:scip@zib.de</a>>><br>
>         *Oggetto:* Re: Access Dual Values with SCIP<br>
> <br>
>         Dear Enrico,<br>
> <br>
>         for pure LP dual values are well-defined. Dual values represent<br>
>         the change in the objective function per unit increase in the<br>
>         right-hand side of a constraint, assuming the constraint remains<br>
>         binding.<br>
> <br>
> <br>
>         For MIP, the situation is more complex and the definition of the<br>
>         duality no longer holds due to the variables' integrality.<br>
>         Therefore, SCIP typically does not care about these dual values.<br>
> <br>
> <br>
>         If you want to solve LPs directly you can use the underlying LP<br>
>         Solver Soplex to obtain the dual solution of the LP.<br>
> <br>
>         Best,<br>
>         Alexander<br>
> <br>
>         ------------------------------------------------------------------------<br>
>         *From:* Scip <scip-bounces@zib.de <<a href="mailto:scip-bounces@zib.de">mailto:scip-bounces@zib.de</a>>><br>
>         on behalf of Enrico Calandrini <e.calandrini@studenti.unipi.it<br>
>         <<a href="mailto:e.calandrini@studenti.unipi.it">mailto:e.calandrini@studenti.unipi.it</a>>><br>
>         *Sent:* Monday, January 27, 2025 6:52:18 PM<br>
>         *To:* scip@zib.de <<a href="mailto:scip@zib.de">mailto:scip@zib.de</a>><br>
>         *Subject:* [SCIP] Access Dual Values with SCIP<br>
>         Hi everyone,<br>
>         I hope this message finds you well.<br>
> <br>
>         I am currently working with SCIP and have a question regarding<br>
>         the retrieval of dual values. Specifically, I would like to<br>
>         confirm whether it is necessary to disable presolve in order to<br>
>         access dual values reliably.<br>
> <br>
>         Could you kindly clarify how presolve interacts with dual value<br>
>         computation and if there are any recommended settings to ensure<br>
>         the dual values can be retrieved without issue?<br>
> <br>
>         Thank you very much for your time and assistance. I appreciate<br>
>         the incredible work you’ve done with SCIP!<br>
> <br>
>         Looking forward to your response.<br>
> <br>
>         Best regards,<br>
>         Enrico Calandrini<br>
>         University of Pisa, Department of Computer Science<br>
> <br>
>         _______________________________________________<br>
>         Scip mailing list<br>
>         Scip@zib.de <<a href="mailto:Scip@zib.de">mailto:Scip@zib.de</a>><br>
>         <a href="https://listserv.zib.de/mailman/listinfo/scip">https://listserv.zib.de/mailman/listinfo/scip</a> <https://<br>
>         listserv.zib.de/mailman/listinfo/scip><br>
> <br>
> <br>
> <br>
>     -- <br>
>     Prof. Dr. Marco Lübbecke<br>
>     RWTH Aachen University<br>
>     Chair of Operations Research<br>
>     Kackertstrasse 7<br>
>     D-52072 Aachen<br>
>     Germany<br>
> <br>
>     fon / fax: +49 241 80-93362 / 92369<br>
>     marco.luebbecke@rwth-aachen.de <<a href="mailto:marco.luebbecke@rwth-aachen.de">mailto:marco.luebbecke@rwth-aachen.de</a>><br>
>     <a href="http://www.or.rwth-aachen.de/luebbecke">www.or.rwth-aachen.de/luebbecke</a> <<a href="http://www.or.rwth-aachen.de/luebbecke">http://www.or.rwth-aachen.de/luebbecke</a>><br>
> <br>
> <br>
> <br>
> -- <br>
> Prof. Dr. Marco Lübbecke<br>
> RWTH Aachen University<br>
> Chair of Operations Research<br>
> Kackertstrasse 7<br>
> D-52072 Aachen<br>
> Germany<br>
> <br>
> fon / fax: +49 241 80-93362 / 92369<br>
> marco.luebbecke@rwth-aachen.de <<a href="mailto:marco.luebbecke@rwth-aachen.de">mailto:marco.luebbecke@rwth-aachen.de</a>><br>
> <a href="http://www.or.rwth-aachen.de/luebbecke">www.or.rwth-aachen.de/luebbecke</a> <<a href="http://www.or.rwth-aachen.de/luebbecke">http://www.or.rwth-aachen.de/luebbecke</a>><br>
> <br>
> <br>
> _______________________________________________<br>
> Scip mailing list<br>
> Scip@zib.de<br>
> <a href="https://listserv.zib.de/mailman/listinfo/scip">https://listserv.zib.de/mailman/listinfo/scip</a><br>
<br>
-- <br>
Prof. Dr. Ambros Gleixner - HTW & Zuse Institute Berlin<br>
<a href="https://www.htw-berlin.de/hochschule/personen/person/?eid=12822">https://www.htw-berlin.de/hochschule/personen/person/?eid=12822</a><br>
<br>
</div>
</span></font></div>
</body>
</html>