admin管理员组文章数量:1279187
I have an LP that I am solving with SCIP. I have disabled all presolve settings (as far as I know) as I need the dual value of each constraint. However, when I use model.getDualsolLinear(i)
to obtain its dual value it returns zero.
I have a simple example below:
Here is the .lp file:
\ Problem name : RMP
\ Variables : 3 (0 binary, 0 integer, 0 implicit integer, 3 continuous)
\ Constraints : 3
Minimize
Obj: +2 x_0_0 +3 x_0_1 +1 x_0_2
Subject to
c1: +1 x_0_0 = +7
c2: +1 x_0_1 = +2
c3: +1 x_0_2 = +1
Bounds
End
I would expect the dual variables of constraints c1, c2 and c3 to be 2, 3 and 1 respectively. But I get zero.
Here is the simple python code I use for solving, and the settings.set that disables presolve etc. is found beneath that.
from pyscipopt import Model
model = Model()
model.readParams("simplescipproblem/settings.set")
model.readProblem(filename="rmp.lp")
model.optimize()
obj = model.getObjVal()
print(f"obj: {obj}")
prices = []
print(f"Cons: {model.getConss()}")
for i in model.getConss():
prices.append(model.getDualsolLinear(i))
print(f"prices: {prices}")
settings.set:
# SCIP version 9.2.1
# maximal number of presolving rounds (-1: unlimited, 0: off)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
presolving/maxrounds = 0
# maximal number of restarts (-1: unlimited)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
presolving/maxrestarts = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/nonlinear/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/linear/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/and/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/bounddisjunction/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/cardinality/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/conjunction/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/cumulative/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/disjunction/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/indicator/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/knapsack/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/linking/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/logicor/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/or/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/orbisack/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/orbitope/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/pseudoboolean/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/setppc/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/SOS1/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/SOS2/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/superindicator/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/symresack/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/varbound/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/xor/maxprerounds = 0
# maximal number of presolving rounds the constraint handler participates in (-1: no limit)
# [type: int, advanced: TRUE, range: [-1,2147483647], default: -1]
constraints/components/maxprerounds = 0
# maximal number of presolving rounds the presolver participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
presolving/milp/maxrounds = 0
# maximal number of presolving rounds the presolver participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
presolving/trivial/maxrounds = 0
# maximal number of presolving rounds the presolver participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
presolving/inttobinary/maxrounds = 0
# maximal number of presolving rounds the presolver participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
presolving/gateextraction/maxrounds = 0
# maximal number of presolving rounds the presolver participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
presolving/dualcomp/maxrounds = 0
# maximal number of presolving rounds the presolver participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
presolving/domcol/maxrounds = 0
# maximal number of presolving rounds the presolver participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
presolving/implics/maxrounds = 0
# maximal number of presolving rounds the presolver participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
presolving/sparsify/maxrounds = 0
# maximal number of presolving rounds the presolver participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
presolving/dualsparsify/maxrounds = 0
# maximal number of presolving rounds the propagator participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
propagating/rootredcost/maxprerounds = 0
# maximal number of presolving rounds the propagator participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
propagating/dualfix/maxprerounds = 0
# maximal number of presolving rounds the propagator participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
propagating/genvbounds/maxprerounds = 0
# maximal number of presolving rounds the propagator participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
propagating/vbounds/maxprerounds = 0
# maximal number of presolving rounds the propagator participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
propagating/pseudoobj/maxprerounds = 0
# maximal number of presolving rounds the propagator participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
propagating/redcost/maxprerounds = 0
# maximal number of presolving rounds the propagator participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
propagating/probing/maxprerounds = 0
# maximal number of presolving rounds the propagator participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
propagating/symmetry/maxprerounds = 0
# maximal number of presolving rounds the propagator participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
propagating/obbt/maxprerounds = 0
# maximal number of presolving rounds the propagator participates in (-1: no limit)
# [type: int, advanced: FALSE, range: [-1,2147483647], default: -1]
propagating/nlobbt/maxprerounds = 0
propagating/maxrounds = 0
propagating/maxroundsroot = 0
Operating system: MacOS15.3.1 (but I'm also getting the same result on linux) Scip version 9.2.1 pyscipopt version 5.3.0
Any help would be much appreciated! thank you in advance!
本文标签: pyscipoptUnable to get dual values from SCIP solverStack Overflow
版权声明:本文标题:pyscipopt - Unable to get dual values from SCIP solver - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741278370a2369863.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论