I have a simple example of Pyomo model as below:
import pyomo.environ as pyo
import pandas as pd
df = pd.DataFrame({'x': [0, 1, 2]})
solver = pyo.SolverFactory('gams')
solver.options['solver'] = 'SBB'
model = pyo.ConcreteModel()
model.x = pyo.Var(df.index.tolist(), domain=pyo.Binary, initialize=1)
total_x = sum(model.x[i] for i in df.index.tolist())
model.constraint1 = pyo.Constraint(total_x <= 3)
# Solve:
solver.solve(model)
While accessing model.constraint1
:
constraint1 : Size=1
Key : Lower : Body : Upper
None : None : x[0] + x[1] + x[2] : 3.0
Due to some infeasibility of the actual objective (which I didn't include here), if that happens, I would like to change the lower or upper bound of this particular existing constraint to make it to 3.1, 3.2 3.3...
Is there any way I can change the bounds of existing constraint?