ApplicationError: Solver (gurobi) did not exit normally
AnsweredHi,
Im using python 3.11.2 and gurobi 10.0.1
I'm working on an optimization in python using pyomo.
The code works fine with GLPK solver.
When I change a solver from GLPK to gurobi, i encounter the following error.
ERROR: Solver (gurobi) returned non-zero return code (1)
ERROR: Solver log: File "<stdin>", line 3 SyntaxError: Non-UTF-8 code starting with '\xe4' in file <stdin> on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
---------------------------------------------------------------------------
ApplicationError Traceback (most recent call last) d:\OneDrive - Europa-Universität Flensburg\0. Master Degree EEM\Master Thesis\1. Thesis work\VS code\Master Thesis rev.13_partial load & cold start& guroby.py in line 5
281 #%%
282 #--------------------------------------------
283 # slove instance
284 solver = po.SolverFactory("gurobi") ---->
285 result = solver.solve(instance)
286 Op_time = result.solver.time/60
287 #--------------------------------------------
File d:\OneDrive - Europa-Universität Flensburg\0. Master Degree EEM\Master Thesis\1. Thesis work\VS code\NonLinearThesis\Lib\site-packages\pyomo\opt\base\solvers.py:596, in OptSolver.solve(self, *args, **kwds)
594 elif hasattr(_status, 'log') and _status.log:
595 logger.error("Solver log:\n" + str(_status.log)) -->
596 raise ApplicationError( 597 "Solver (%s) did not exit normally" % self.name)
598 solve_completion_time = time.time()
599ifself._report_timing:
ApplicationError: Solver (gurobi) did not exit normally
I have tried putting, # -*- coding: utf-8 -*- , at the beginning of the code but its still not working.
Thank you very much for your help.
0
-
Hi Soravis,
Can you try replacing
solver = po.SolverFactory("gurobi")with
solver = po.SolverFactory("gurobi", solver_io="python")and see if this resolves your issue?
- Riley
1 -
Hi Riley,
Thank you very much.
It works.
Best regards,
Soravis
0
Please sign in to leave a comment.
Comments
2 comments