Hi,
I have an affine inequality constraint in a JuMP model (that was constructed off-line) and would like to add a new constraint using the expression from the ConstraintRef associated with the affine constraint. e.g.:
aff_con = all_constraints(model, list_of_constraint_types(prob)[2]...)[1]
@constraint(model, -aff_con)
In this particular case, the constraint of interest is f(x)<=0 and I’d simply like to enforce an equality constraint f(x)>=0 using the ConstraintRef handle.
One hacky way that seems to work is:
new_con = Symbol(replace(string(Symbol(aff_con)), "≤" => "≥"))
str_con = string("@constraint(prob, ", new_con, ")")
eval(Meta.parse(str_con))
But I wasn’t sure if there’s a cleaner approach using the attributes available to the ConstraintRef handle itself.