After running the below code:
from pyomo.environ import *
model = ConcreteModel()
model.q11, model.q12, model.q13, model.q21, model.q22, model.q23, model.q31, model.q32, model.q33 = [Var(bounds=(0.0, 11.0), within=Integers, initialize=0.0) for i in range(9)]
model.s1, model.s2, model.s3 = [Var(bounds=(0.0, 1.0), within=Binary, initialize=0.0) for i in range(3)]
model.S1, model.S2, model.S3 = [Var(bounds=(0.0, 100.0), within=Integers, initialize=0.0) for i in range(3)]
model.c1 = Constraint(expr=model.q11*model.s1*model.S1 + model.q12*model.s1*model.S1 + model.q13*model.s1*model.S1 >= 130.0 - 3.0)
model.c2 = Constraint(expr=model.q11*model.s1*model.S1 + model.q12*model.s1*model.S1 + model.q13*model.s1*model.S1 <= 130.0 + 3.0)
model.c3 = Constraint(expr=model.q21*model.s2*model.S2 + model.q22*model.s2*model.S2 + model.q23*model.s2*model.S2 >= 130.0 - 3.0)
model.c4 = Constraint(expr=model.q21*model.s2*model.S2 + model.q22*model.s2*model.S2 + model.q23*model.s2*model.S2 <= 130.0 + 3.0)
model.c5 = Constraint(expr=model.q31*model.s3*model.S3 + model.q32*model.s3*model.S3 + model.q33*model.s3*model.S3 >= 130.0 - 3.0)
model.c6 = Constraint(expr=model.q31*model.s3*model.S3 + model.q32*model.s3*model.S3 + model.q33*model.s3*model.S3 <= 130.0 + 3.0)
model.c7 = Constraint(expr=model.q11 + model.q12 + model.q13 <= 11.0)
model.c8 = Constraint(expr=model.q21 + model.q22 + model.q23 <= 11.0)
model.c9 = Constraint(expr=model.q31 + model.q32 + model.q33 <= 11.0)
model.objective = Objective(expr=model.s1 + model.s2 + model.s3, sense=minimize)
SolverFactory('mindtpy').solve(model, mip_solver='glpk', nlp_solver='ipopt')
model.objective.display()
model.display()
model.pprint()
I get:
Trivial constraint c1 violates LB 127.0 ≤ BODY 0.
Traceback (most recent call last):
File "/Users/francopiccolo/Git/GitHub/data-in-action/clothes-production-optimization/venv/lib/python3.12/site-packages/pyomo/contrib/mindtpy/algorithm_base_class.py", line 1097, in solve_subproblem
TransformationFactory('contrib.deactivate_trivial_constraints').apply_to(
File "/Users/francopiccolo/Git/GitHub/data-in-action/clothes-production-optimization/venv/lib/python3.12/site-packages/pyomo/core/base/transformation.py", line 77, in apply_to
reverse_token = self._apply_to(model, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/francopiccolo/Git/GitHub/data-in-action/clothes-production-optimization/venv/lib/python3.12/site-packages/pyomo/contrib/preprocessing/plugins/deactivate_trivial_constraints.py", line 118, in _apply_to
raise InfeasibleConstraintException(
pyomo.common.errors.InfeasibleConstraintException: Trivial constraint c1 violates LB 127.0 ≤ BODY 0.
Infeasibility detected in deactivate_trivial_constraints.
WARNING: Deactivating trivial constraints on the block unknown for which
trivial constraints were previously deactivated. Reversion will affect all
deactivated constraints.
Any ideas what is going on here and how to overcome this error?