Closed sferenz closed 5 years ago
Hi, thanks for reporting this. Can you share your model here? I cannot check where the error is coming from from your post. Thanks!
Hey, thanks for the fast response! I exported the model which creates the crash as cloudpickle: test.txt
When I run the following code:
from pyomo.environ import *
import cloudpickle
with open('test.txt', mode='rb') as file:
model = cloudpickle.load(file)
model.pprint()
opt = SolverFactory('mindtpy')
results = opt.solve(model, mip_solver='gurobi', nlp_solver='ipopt', tee=True)
I get the following error:
INFO: ---Starting MindtPy---
INFO: Original model has 187 constraints (104 nonlinear) and 0 disjunctions,
with 194 variables, of which 95 are binary, 0 are integer, and 99 are
continuous.
INFO: Objective is nonlinear. Moving it to constraint set.
INFO: NLP 1: Solve relaxed integrality
INFO: NLP 1: OBJ: -43.367431403910366 LB: -43.367431403910366 UB: inf
INFO: ---MindtPy Master Iteration 0---
INFO: MIP 1: Solve master problem.
Traceback (most recent call last):
File "test.py", line 13, in <module>
results = opt.solve(model, mip_solver='gurobi', nlp_solver='ipopt', obj_bound=100, tee=True)
File "/home/ferenz/.local/share/virtualenvs/test_pyomo-lSMAhBuU/lib/python3.6/site-packages/pyomo/contrib/mindtpy/MindtPy.py", line 357, in solve
MindtPy_iteration_loop(solve_data, config)
File "/home/ferenz/.local/share/virtualenvs/test_pyomo-lSMAhBuU/lib/python3.6/site-packages/pyomo/contrib/mindtpy/iterate.py", line 26, in MindtPy_iteration_loop
solve_OA_master(solve_data, config)
File "/home/ferenz/.local/share/virtualenvs/test_pyomo-lSMAhBuU/lib/python3.6/site-packages/pyomo/contrib/mindtpy/mip_solve.py", line 59, in solve_OA_master
config)
File "/home/ferenz/.local/share/virtualenvs/test_pyomo-lSMAhBuU/lib/python3.6/site-packages/pyomo/contrib/gdpopt/util.py", line 153, in copy_var_list_values
v_to.set_value(value(v_from, exception=False))
File "/home/ferenz/.local/share/virtualenvs/test_pyomo-lSMAhBuU/lib/python3.6/site-packages/pyomo/core/base/var.py", line 172, in set_value
if valid or self._valid_value(val):
File "/home/ferenz/.local/share/virtualenvs/test_pyomo-lSMAhBuU/lib/python3.6/site-packages/pyomo/core/base/var.py", line 184, in _valid_value
"domain %s" % (val, type(val), self.domain))
ValueError: Numeric value `7.13998815746e-05` (<class 'float'>) is not in domain Binary
I cannot replicate your results because I'm missing a module 'mas'
, but from the error output, it looks like gurobi is returning a nonbinary value (7.13998815746e-05) for certain binary variable in the first MIP master. Are you passing some extra parameters to gurobi? Maybe the integer feasibility tolerance (IntFeasTol)?
Try changing the parameter integer_tolerance
for MindtPy (default 1E-5) to a higher value if the MIP master problem is that complicated.
Sorry, that the test didn't work on your machine. It looks like when using cloudpickle, still all modules are necessary. I didn't find a better way to export and import the model, perhaps that could be added to pyomo one day?
I changed the integer_tolerance and the error disappeared! Thanks for the help!
I'm running multiple MINLP with mindtpy and pyomo. Between the problems I change some values in the constrains and in the objective. The first problems can be solved by mindtpy and pyomo without any issues.
At a certain point, the code crashes with the following error:
Since I have no influence on the data mindtpy passes to the mip solver, I expect that there is some bug in the mindtpy code. Does anyone get the some error and have a fix or a workaround?