[SCIP] SCIP presolve advice
Stefan Vigerske
svigerske at gams.com
Tue Nov 12 18:31:28 CET 2024
Hi,
SCIP supports only linear objective functions. So if you think you had
quadratic terms in the objective, then there were probably moved into a
nonlinear constraint.
Quadratic constraints would be represented as nonlinear constraints
(cons_nonlinear) in SCIP. Nonlinear constraints are of the form lhs <=
f(x) <= rhs, where f(x) is represented as an algebraic expression.
You can use SCIPcheckQuadraticNonlinear()
(https://www.scipopt.org/doc-9.2.0/html/group__CONSHDLRS.php#ga0a0b7f8bed4bf4b8a5971fb7c4926c23)
to check whether a nonlinear constraint is quadratic. If that is the
case, you can use SCIPgetExprNonlinear() to get the expression that
represents f(x) and use SCIPexprGetQuadraticData() and friends (see
https://www.scipopt.org/doc-9.2.0/html/group__PublicExprMethods.php) to
get the quadratic terms. The SCIP_EXPR* in linexprs, sqrexpr, expr1,
expr2 are encapsulating SCIP variables. Use SCIPgetVarExprVar() to
access these variables. For an example, look at code like
https://www.scipopt.org/doc-9.2.0/html/reader__lp_8c_source.php#l02723,
which writes a quadratic nonlinear constraint into text.
Hope that helps,
Stefan
On 11/11/2024 17:13, David Escobar-Vargas, Mr wrote:
> Dear SCIP team,
>
> I'm currently working on integrating machine learning into presolve methods for MIPs, specifically focusing on Vehicle Routing Problems (VRPs). I am continuing the work of a previous student who started using SCIP. The initial goal is to use SCIP presolve, gather some statistics for feature selection, and then call a heuristic for solving the MIP of a VRP. I have a bunch of .cip files of VRPs, and I need to read them, use presolve, extract the model after presolve (to get the coefficients from linear/quadratic constraints/objective), solve the resulting MIP with the heuristic, and use SCIP's post-solve to get the solution.
>
> Unfortunately, my colleague did not leave much documentation other than a Python code using PySCIPOpt for model creation and a note mentioning that we need SCIP's C++ wrapper to do the rest.
>
> This is my first time using SCIP. I've spent a couple of days working with SCIP and have managed to use the C-API to read the .cip files, call the presolve, and retrieve some of the linear coefficients in the objectives/constraints. I'm currently using SCIPfindConshdlr and SCIPconsGetHdlr to identify the linear and quadratic constraints, but I still don't know how to get the quadratic coefficients from the objective and constraints.
>
> After this initial experience with SCIP, I would like to ask for your expertise in confirming whether what I am trying to do is feasible with the latest version of SCIP and the C-API, especially considering that I have problems with and without quadratic constraints (and possibly quadratic objectives).
>
> I would greatly appreciate any advice you can share to help me determine if my plan is possible and how to proceed with the project.
>
> Thank you in advance for your support!
>
> Best,
>
>
> David Escobar Vargas PhD
>
> Senior Algorithms Researcher
>
> Postdoctoral Fellow, Université Laval
> Interuniversity Research Centre on Enterprise Networks, Logistics and Transportation (CIRRELT)
> Montreal, Canada
>
>
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip
More information about the Scip
mailing list