Closed julian-belina closed 4 years ago
Hi, it seems that the issue here is the absolute value in the objective function. 'sympy' is trying to compute a real and an imaginary part of that expression when it tries to differentiate it to get the outer-approximation cuts. Although @jsiirola has already pushed a fix of this issue tacking it directly in the 'sympy' interface, for this tiny example it is just a matter of removing 'abs' from the objective function. This is valid since the value of x^2 will never be negative. I will push a modification of the documentation.
Hi,
i have updated my pyomo to 5.67 and get a different error
ValueError: Numeric value
0.22709088990648157
(<class 'float'>) is not in domain Binary
I have also updated the code code from documentation:
from pyomo.environ import *`
#Create a simple model
model = ConcreteModel()
model.x = Var(bounds=(1.0,10.0),initialize=5.0)
model.y = Var(within=Binary)
model.c1 = Constraint(expr=(model.x-3.0)**2 <= 50.0*(1-model.y))
model.c2 = Constraint(expr=model.x*log(model.x)+5.0 <= 50.0*(model.y))
model.objective = Objective(expr=model.x, sense=minimize)
#Solve the model using MindtPy
SolverFactory('mindtpy').solve(model, mip_solver='glpk', nlp_solver='ipopt',tee=True)
model.objective.display()
model.display()
model.pprint()
Furthermore i get the following warning
WARNING: DEPRECATED: The differentiate function in pyomo.core.base.symbolic has been deprecated. Please use the differentiate function in pyomo.core.expr. (deprecated in TBD,will be removed in 5.7) WARNING: DEPRECATED: The differentiate function in pyomo.core.base.symbolic has been deprecated. Please use the differentiate function in pyomo.core.expr. (deprecated in TBD,will be removed in 5.7)
This is a different issue to the previous one. I will open a new issue to address this.
I was trying to start the MINLP example presented here: https://pyomo.readthedocs.io/en/stable/contributed_packages/mindtpy.html
When i run the code:
I get the following error:
pyomo.common.errors.DeveloperError: Internal Pyomo implementation error: "sympy expression type 're' not found in the operator map" Please report this to the Pyomo Developers.
I have installed pyomo 5.6.6, pyomo.extras 3.3, and pyomo.solvers 1.0 using Anaconda on Windows 10.