[SCIP] No objective value after presolving was interrupted

Benjamin Müller benjamin.mueller at zib.de
Thu Nov 7 16:40:06 CET 2019


Dear Gerwin,

good to see that you are still using SCIP. :)

We have looked at the code and this if condition exists because right 
now we store the best solution in the model class after calling 
optimize() or getBestSol(). Probably, we are going to change this soon 
and then your issue should be fixed.

A simple fix for now would be to write

self.model.optimize()
objective_value = self.model.getPrimalbound()

or

self.model.optimize()
sol = self.model.getBestSol()
objective_value = self.model.getSolObjVal(sol)

Anyway, I would like to ask you to open an issue in

	https://github.com/SCIP-Interfaces/PySCIPOpt

when you are facing problems with our python interface in the future.

Best,
Benny


On 11/7/19 3:55 PM, Gerwin Gamrath wrote:
> Hello,
> 
> I am optimizing a model via pyscipopt.
> 
> Right after
> 
> self.model.optimize()
> 
> I want to
> 
> objective_value = self.model.getObjVal()
> 
> but (in some cases) I get the following warning:
> 
> “Warning: method cannot be called before problem is solved”
> 
> (because of:
> 
> if not self.getStage() >= SCIP_STAGE_SOLVING: )
> 
> But for me it looks like, there should be an objective value (=primal 
> bound) existent at this time…
> 
> (See below for the relevant log)
> 
> Thanks,
> Gerwin
> 
> --------------
> 
> # SCIP version 6.0.1
> 
> # solving stops, if the relative gap = |primal - 
> dual|/MIN(|dual|,|primal|) is below the given value
> 
> # [type: real, advanced: FALSE, range: [0,1.79769313486232e+308], 
> default: 0]
> 
> limits/gap = 0.0001
> 
> # maximal number of presolving rounds the presolver participates in (-1: 
> no limit)
> 
> # [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
> 
> presolving/symbreak/maxrounds = 0
> 
> wrote parameter settings to file param.set
> 
> solution violates original bounds of variable <x1> [0,0] solution value 
> <100000>
> 
> solution violates original bounds of variable <x2> [0,0] solution value <1>
> 
> solution violates original bounds of variable <x3> [0,0] solution value <1>
> 
> 1/4 feasible solution given by solution candidate storage, new primal 
> bound 8.503167e+02
> 
> presolving:
> 
> (round 1, fast)       601 del vars, 2619 del conss, 0 add conss, 2807 
> chg bounds, 0 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 0 clqs
> 
> (round 2, fast)       3282 del vars, 2619 del conss, 0 add conss, 2946 
> chg bounds, 0 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 1 clqs
> 
> (round 3, fast)       3287 del vars, 2624 del conss, 0 add conss, 2948 
> chg bounds, 0 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 2 clqs
> 
> (round 4, fast)       3289 del vars, 2722 del conss, 0 add conss, 2948 
> chg bounds, 0 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 2 clqs
> 
> (round 5, fast)       3396 del vars, 2722 del conss, 0 add conss, 2948 
> chg bounds, 0 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 2 clqs
> 
> (round 6, exhaustive) 3396 del vars, 2777 del conss, 0 add conss, 2948 
> chg bounds, 6 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 2 clqs
> 
> (round 7, fast)       3401 del vars, 2779 del conss, 0 add conss, 2948 
> chg bounds, 6 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 0 clqs
> 
> (round 8, fast)       3404 del vars, 2779 del conss, 0 add conss, 2951 
> chg bounds, 6 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 1 clqs
> 
> presolving (8 rounds: 8 fast, 1 medium, 1 exhaustive):
> 
> 3404 deleted vars, 2779 deleted constraints, 0 added constraints, 2951 
> tightened bounds, 0 added holes, 6 changed sides, 0 changed coefficients
> 
> 0 implications, 1 cliques
> 
> presolving was interrupted.
> 
> Presolving Time: 0.00
> 
> SCIP Status        : solving was interrupted [gap limit reached]
> 
> Solving Time (sec) : 0.00
> 
> Solving Nodes      : 0
> 
> Primal Bound       : +8.50316660000000e+02 (2 solutions)
> 
> **
> 
> 
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip
> 

-- 
______________________________
Benjamin Müller
Zuse Institute Berlin
Takustr. 7, 14195 Berlin
benjamin.mueller at zib.de
+49 30 841 85-195


More information about the Scip mailing list