Closed strahl21 closed 1 year ago
Thank you for the detailed report. One question (for all, but especially @michaelbynum, @emma58): should we support an "integer tolerance" here? That is, should we treat x**2.0000001
as x**2
(and then expand the product term)?
No. This is one spot I think we definitely do not want tolerances. It is exactly equal to an integer or it is not an integer. If it should be an integer, the user should make sure it is one.
I agree - but wanted to check
Summary
Solve a quadratic program (or QCQP) using cplex/gurobi with exponents that are written using floats, rather than integers
Steps to reproduce the issue
Use
m.x1**2.0
instead ofm.x1**2
Error Message
Information on your system
Pyomo version: 6.6.1 Python version: 3.9 Operating system: Ubuntu 22.04 How Pyomo was installed (PyPI, conda, source): conda Solver (if applicable): cplex, also noticed the same issue with gurobi. Ipopt and baron had no issues
Additional information
I edited the source code (pyomo/repn/linear.py:342) with
for i in range(1, int(exp)):
and that prevents the error and should be correct because of the check in the condition.