As far as I understand, when I add a custom bridge (struct MyCustomBridge{T} <: MOI.Bridges.Constraint.AbstractBridge end
) to my model using
model = JuMP.Model(HiGHS.Optimizer)
MOI.Bridges.add_bridge(JuMP.backend(model).optimizer, MyCustomBridge)
the respective MOI.Bridges.Constraint.bridge_constraint(...)
function is called as soon as I call optimize!(model)
for the first time. I noticed that it does not automatically re-evaluate the bridging if the overall model is flagged as dirty
and then re-optimized. However, executing
JuMP.set_normalized_rhs(constr, JuMP.normalized_rhs(constr))
properly triggers a “re-bridging” of constr
.
Is there a more “clean” (as in “intended”) way to trigger this, for a given constraint (but not for every constraint)?
Additionally, I tried applying that to a model created with direct_model(...)
by utilizing the LazyBridgeOptimizer
:
model = direct_model(HiGHS.Optimizer())
optimizer = MOI.Bridges.LazyBridgeOptimizer(backend(model))
MOI.Bridges.add_bridge(optimizer, MyCustomBridge)
However, on creating a constraint that is not directly supported by the solver, it triggers the Constraints of type ... are not supported by the solver.
error (the bridge is the same as in the non-direct model, where it works).