0
votes

I install Baron solver on windows and I use pyomo in Spyder. I move baron.exe to current directory. My invocation is like this:

from pyomo.opt import SolverFactory
 ...
opt = SolverFactory('baron') 
opt.solve(instance,keepfiles=True,tee=True)

when I run my code, this error appears:

Solver log file: 'C:\Users\~\AppData\Local\Temp\tmpumg5hxvr.baron.log'
Solver solution file: 'C:\Users\~\AppData\Local\Temp\tmpbmx1pfpt.baron.soln'
Solver problem files: ('C:\\Users\\~\\AppData\\Local\\Temp\\tmpygo80gcy.pyomo.bar',)
C:\Users\~\baron.exe: can't open C:\Users\~\AppData\Local\Temp\tmpygo80gcy.pyomo.bar.nl
ERROR: Solver (baron) returned non-zero return code (1)
ERROR: See the solver log above for diagnostic information.
Traceback 
ApplicationError: Solver (baron) did not exit normally

But There is not the log file: C:\Users\~\AppData\Local\Temp\tmpumg5hxvr.baron.log How can I fix this problem? Thanks for your helps in advance.

1

1 Answers

0
votes

Try:

solverpath_exe = 'C:\\Users\\xxxx\\ipopt_ampl\\ipopt.exe'
solvername = 'ipopt'
opt = SolverFactory(solvername, executable=solverpath_exe, keepfiles=True)