Reputation: 1
I am working on an optimization model implemented in Python through Pyomo. Some constraints contain variables which are the result of an interpolation calculation using Piecewise. The piecewise part looks like this:
model.piecewise_A = Piecewise(
model.f_interp_P_A, # Output variable
model.A_input, # Input variable
pw_pts = A_setpoints_tuple, # Breakpoints
f_rule = P_A_X_tuple,
pw_constr_type = 'EQ' # Enforce equality
)
model.constraint_list.add(model.P_C == model.P_B * model.f_interp_P_A)
# [...] more code
solver = SolverFactory('mindtpy')
results = solver.solve(model,strategy='OA', mip_solver='cbc', nlp_solver='ipopt', tee=True)
The model works perfectly when I use solvers like couenne, bonmin or scip. Due to slow speeds, I decided to try mindtpy. However, when I run the model it gives me the following error:
Mixed-Integer Nonlinear Decomposition Toolbox in Pyomo (MindtPy)
-----------------------------------------------------------------------------------------------
For more information, please visit
https://pyomo.readthedocs.io/en/stable/explanation/solvers/mindtpy.html
If you use this software, please cite the following:
Bernal, David E., et al. Mixed-integer nonlinear decomposition toolbox for Pyomo (MindtPy).
Computer Aided Chemical Engineering. Vol. 44. Elsevier, 2018. 895-900.
Original model has 125 constraints (26 nonlinear) and 0 disjunctions, with 121 variables, of which 24 are binary, 11 are integer, and 86 are continuous.
rNLP is the initial strategy being used.
===============================================================================================
Iteration | Subproblem Type | Objective Value | Primal Bound | Dual Bound | Gap | Time(s)
- Relaxed NLP -37.5 inf -37.5 nan% 0.38
'ScalarObjective' object has no attribute 'fixed'
Traceback (most recent call last):
File "C:\\Users\\frasa\\anaconda3\\Lib\\site-packages\\pyomo\\contrib\\mindtpy\\algorithm_base_class.py", line 1671, in solve_main
main_mip_results = self.mip_opt.solve(
^^^^^^^^^^^^^^^^^^^
File "C:\\Users\\frasa\\anaconda3\\Lib\\site-packages\\pyomo\\opt\\base\\solvers.py", line 662, in solve
\_model.solutions.load_from(
File "C:\\Users\\frasa\\anaconda3\\Lib\\site-packages\\pyomo\\core\\base\\PyomoModel.py", line 279, in load_from
self.select(
File "C:\\Users\\frasa\\anaconda3\\Lib\\site-packages\\pyomo\\core\\base\\PyomoModel.py", line 528, in select
if vdata.fixed is True:
^^^^^^^^^^^
AttributeError: 'ScalarObjective' object has no attribute 'fixed'
Algorithm should terminate here.
After trying different things, the only part that provokes that error to happen is the allocation of the piecewise function in the object model. The weird thing is that this only happens with mindtpy, not with the other MINLP solvers. Additionally, it doesn't matter which MIP and NLP solvers I use, the problem persists.
Any idea of what is happening or how to solve it?
Upvotes: 0
Views: 18