[Scip] getting LP dual solutions

Alberto Ceselli ceselli at dti.unimi.it
Mon Jan 26 12:32:34 MET 2009


ok, many many thanks to all of you!

Kind regards,

Alberto

On Fri, 2009-01-23 at 11:00 +0100, Tobias Achterberg wrote:
> One more comment from me:
> 
> I have the impression that you want to do something like this:
> 
> createmyproblem(scip);
> SCIPsetIntParam(scip, "limits/nodes", 1);
> SCIPsolve(scip);
> accessdualsolutionvalues(scip);
> 
> 
> This is not possible. The reason is that SCIP is not an LP solver but a CIP or MIP solver.
> Thus, the concept of a dual is not available for a CIP solution.
> 
> What you want to do is to access the dual solution vector of the root LP relaxation
> (before or after cutting planes). Actually, you might have luck, and the LP solution is
> still present in SCIP's internal data structures such that accessing it via
> SCIProwGetDualsol() and similar methods is possible, but this is not the way it is
> indendet to work.
> 
> In order to access the solution of any LP relaxation, you need to install a plugin. For
> example, you could add a heuristic plugin with timing SCIP_HEURTIMING_AFTERLPLOOP. There,
> you can fetch the dual solution values.
> 
> 
> In any case, you need to be aware of presolving. This means, your original proboem
> formulation is different from the LP relaxation that is solved by SCIP. Hence, you cannot
> map the dual solution of the presolved LP relaxation to your original formulation. Even if
> you turn off presolving, the ordering of the rows may change.
> 
> 
> Best,
> 
> Tobias
> 
> Alberto Ceselli wrote:
> > I see ... so your suggestion is to work with rows and cols instead of
> > constraints and variables whenever possible, and to check the name given
> > by the constraint handler just as a last resort (e.g. you have to check
> > some property of a linear constraint which depends on the dual value,
> > and you really know that the constraint is in the LP), right?
> > 
> > Ok, many thanks!
> > 
> > Alberto
> > 
> > On Thu, 2009-01-22 at 17:13 +0100, Timo Berthold wrote: 
> >> Hi Alberto.
> >>
> >>> Is there a method for getting the dual solution for generic constraints,
> >> There is no such method, since there is no matching constraints <=> dual 
> >> variable.
> >> SCIP is able to handle more general constraints then just linearizable ones, 
> >> therefore it may happen that a constraint is not represented in the LP (e.g. 
> >> bounddisjunction) or even that there are several rows in the LP for a single 
> >> constraint (e.g. AND).
> >>
> >>> or to get the type of a constraint given its pointer?
> >> What you may do to determine the type of a constraint is to ask for the name 
> >> of its corresponding cons handler:
> >> strcmp(SCIPconshdlrGetName(SCIPconsGetHdlr(cons)), "linear" )) == 0
> >>
> >>> . Is there a way of getting the value of the dual variable of each constraint 
> >> in the last LP solution?
> >> However, the method described above is a bit ugly.
> >> If you are just interested in the duals of the LP rows, you may better use
> >> SCIP_Real SCIProwGetDualsol( ) 
> >> The LP rows can be obtained by
> >> SCIPgetLPRowsData()
> >>
> >> Best regards,
> >> Kati and Timo
> >>
> >>
> >> Am Donnerstag 22 Januar 2009 12:18:47 schrieb Alberto Ceselli:
> >>> Hi all!
> >>>
> >>> I'm using SCIP as a general purpose solver, that is I read a problem
> >>> in .mps format and try to optimize it. Let's say I set a nodes limit and
> >>> stop optimization at the root node. Is there a way of getting the value
> >>> of the dual variable of each constraint in the last LP solution?
> >>>
> >>> I've tried to get the vector of problem constraints with
> >>>
> >>> SCIP_CONS ** conss = SCIPgetConss(scip);
> >>>
> >>> guessing there's a method like
> >>>
> >>> SCIPgetDualsol(scip, conss[i])
> >>>
> >>> but all I've been able to find are methods like
> >>>
> >>> SCIPgetDualsolLinear(scip, conss[i]) or
> >>> SCIPgetDualsolSetppc(scip, conss[i])
> >>>
> >>> However, I don't know in advance which type the constraint would be.
> >>>
> >>> Is there a method for getting the dual solution for generic constraints,
> >>> or to get the type of a constraint given its pointer?
> >>>
> >>> Many thanks,
> >>>
> >>> Alberto
> >>>
> >>> _______________________________________________
> >>> Scip mailing list
> >>> Scip at zib.de
> >>> http://listserv.zib.de/mailman/listinfo/scip
> >>
> > 
> > _______________________________________________
> > Scip mailing list
> > Scip at zib.de
> > http://listserv.zib.de/mailman/listinfo/scip
> 



More information about the Scip mailing list