2017-08-22 3 views
2

Je n'arrive pas à configurer les options ipopt via pyomo.Définition des options ipopt via pyomo

Pour certaines options, on peut simplement utiliser

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

Cela fonctionne très bien. Si je tente définir l'option pour "fixed_variable_treatment", i.e. .:

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

i l'erreur suivante:

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" 

Je suppose que cela est parce que vous ne pouvez pas définir toutes les options par python?

Toute aide ou façon de surmonter ce problème serait grandement appréciée. Merci

Répondre

1

La solution de contournement consiste à utiliser un fichier ipopt.opt comme décrit à https://www.coin-or.org/Ipopt/documentation/node35.html. Le fichier d'options est placé dans le répertoire de travail en cours où IPOPT est appelé.

Gabe Hackebeil a répondu sur le 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

Merci beaucoup d'avoir créé une question au sujet de ce Github! J'ai pensé que ce serait quelque chose dans ce sens. Je vais essayer les solutions de contournement suggérées et voir ce qui se passe. – Anthonydouc