cog-imperial / entmoot

Multiobjective black-box optimization using gradient-boosted trees
https://entmoot.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
56 stars 12 forks source link

'Appertizer' from docs is not working for `gurobi` #49

Open Paulnkk opened 1 month ago

Paulnkk commented 1 month ago

Hey,

the 'Appetizer' from https://entmoot.readthedocs.io/en/master/#appetizer is not working for gurobi and I get the following error message (I am using Gurobi Optimizer version 11.0.0):

Set parameter Username
Academic license - for non-commercial use only - expires 2024-12-06
Error reading LP format file /var/folders/sn/xxr4rfmj23100534fjn99hv80000gn/T/tmpyl586zz9.pyomo.lp at line 13
Malformed term in expression
Neighboring tokens: " np.float64(-0.2) x5 -1 x6 +1 x7 = "

Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
  File "/Users/PaulKandora/opt/anaconda3/envs/cubo_py310/lib/python3.10/site-packages/pyomo/solvers/plugins/solvers/GUROBI_RUN.py", line 66, in gurobi_run
    model = read(model_file)
            ^^^^^^^^^^^^^^^^
  File "src/gurobipy/gurobi.pxi", line 3779, in gurobipy.read
  File "src/gurobipy/gurobi.pxi", line 117, in gurobipy.gurobi.read
gurobipy.GurobiError: Unable to read file
Traceback (most recent call last):
  File "/Users/PaulKandora/PyCharm_projects/cubo/competition/entmoot_test.py", line 30, in <module>
    res = opt_pyo.solve(enting)
  File "/Users/PaulKandora/opt/anaconda3/envs/cubo_py310/lib/python3.10/site-packages/entmoot/optimizers/pyomo_opt.py", line 114, in solve
    opt.solve(opt_model, tee=verbose)
  File "/Users/PaulKandora/opt/anaconda3/envs/cubo_py310/lib/python3.10/site-packages/pyomo/opt/base/solvers.py", line 627, in solve
    raise ApplicationError("Solver (%s) did not exit normally" % self.name)
pyomo.common.errors.ApplicationError: Solver (gurobi) did not exit normally
ERROR: Solver (gurobi) returned non-zero return code (1)
ERROR: See the solver log above for diagnostic information.

How can I resolve this issue ?

Thanks in advance and best regards,

Paul

Paulnkk commented 4 weeks ago

Edit: I tried gurobipydirectly and it seems to work compared to pyomo