2017-08-22 52 views
2

我无法通过pyomo设置ipopt选项。通过pyomo设置ipopt选项

对于某些选项中的一个可以简单地使用

executable = os.getcwd()+'/Ipopt/Ipopt/build/bin/ipopt.exe' 
opt = SolverFactory("ipopt", executable=executable,solver_io='nl') 
opt.options['nlp_scaling_method'] = 'user-scaling' 

这工作得很好。如果我尝试设置“fixed_variable_treatment”的选项,即:

opt.options['fixed_variable_treatment'] = 'make_parameter' 

我得到以下错误:

ERROR: "[base]\site-packages\pyomo\opt\base\solvers.py", 599, solve 
     Solver (asl) returned non-zero return code (1) 
ERROR: "[base]\site-packages\pyomo\opt\base\solvers.py", 604, solve 
     Solver log: 
     Unknown keyword "fixed_variable_treatment" 

我假设这是因为你无法将所有的选项,通过蟒蛇?

任何帮助或克服这种方式将不胜感激。谢谢

回答

1

解决方法是使用一个ipopt.opt文件,如https://www.coin-or.org/Ipopt/documentation/node35.html所述。选项文件放置在IPOPT被调用的当前工作目录中。

加布Hackebeil回应对Github issue

The default behavior is to send options to Ipopt through the command line, but not all Ipopt options are available through the command line. This is probably one of them. Historically one would place this kind of option in an options file named "ipopt.opt" in the working directory, and Ipopt would pick it up automatically.

Very recently I added functionality to the Ipopt interface in Pyomo to write an options file for you. Options that begin with "OF_" will be placed in a temporary options file (with that prefix removed). I don't know if this has made it into a release yet.

+0

非常感谢您创建关于这个问题Github上!我确实认为这将是沿着这些路线的东西。将尝试建议的解决方法,看看会发生什么。 – Anthonydouc

相关问题