2017-08-22 128 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

相關問題