直接使用 PATH 求解器,我无法解决下面提出的问题。最初的问题来源于https://prod.sandia.gov/techlib-noauth/access-control.cgi/2015/155584.pdf https://prod.sandia.gov/techlib-noauth/access-control.cgi/2015/155584.pdf,这似乎表明问题已经解决。使用非线性形式可以解决。
这是 pyomo 还是 PATH 中的版本控制问题,很难说。
我正在运行 pyomo 5.5.x 和 pathampl 源自http://pages.cs.wisc.edu/~ferris/path.html http://pages.cs.wisc.edu/~ferris/path.html
from pyomo.environ import *
from pyomo.mpec import *
model = ConcreteModel()
model.x1 = Var()
model.x2 = Var()
model.x3 = Var()
model.f1 = Complementarity(expr=complements(model.x1 >= 0,model.x1 + 2*model.x2 + 3*model.x3 >= 1))
model.f2 = Complementarity(expr=complements(model.x2 >= 0,model.x2 - model.x3 >= -1))
model.f3 = Complementarity(expr=complements(model.x3 >= 0,model.x1 + model.x2 >= -1))
from pyomo.opt import SolverFactory
opt = SolverFactory("pathampl")
results = opt.solve(model, load_solutions=True, tee=True)
#sends results to stdout
results.write()
对应的错误信息:
*** EXIT - infeasible.
Major Iterations. . . . 0
Minor Iterations. . . . 0
Restarts. . . . . . . . 0
Crash Iterations. . . . 0
Gradient Steps. . . . . 0
Function Evaluations. . 0
Gradient Evaluations. . 0
Basis Time. . . . . . . 0.000000
Total Time. . . . . . . 0.000000
Residual. . . . . . . . inf
WARNING: Loading a SolverResults object with a warning status into
model=unknown;
message from solver=Path 4.7.01\x3a Infeasible.; 0 iterations (0 for
crash); 0 pivots.; 0 function, 0 gradient evaluations.
# ==========================================================
# = Solver Results =
# ==========================================================
# ----------------------------------------------------------
# Problem Information
# ----------------------------------------------------------
Problem:
- Lower bound: -inf
Upper bound: inf
Number of objectives: 1
Number of constraints: 0
Number of variables: 6
Sense: unknown
# ----------------------------------------------------------
# Solver Information
# ----------------------------------------------------------
Solver:
- Status: warning
Message: Path 4.7.01\x3a Infeasible.; 0 iterations (0 for crash); 0 pivots.; 0 function, 0 gradient evaluations.
Termination condition: infeasible
Id: 201
Error rc: 0
Time: 0.37000012397766113
# ----------------------------------------------------------
# Solution Information
# ----------------------------------------------------------
Solution:
- number of solutions: 0
number of solutions displayed: 0
Displaying Solution
如果没有人写出更好的答案,您可以尝试使用SolverFactory('mpec_nlp').solve(model)
看看会发生什么。
如果你喜欢阅读*.nl
文件,您还可以model.write('tmp.nl')
查看通过 AMPL 接口生成的内容。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)