@@ -1496,6 +1496,31 @@ function MOI.get(
14961496 return unbridged_function (b, func)
14971497end
14981498
1499+ function MOI. get (
1500+ b:: AbstractBridgeOptimizer ,
1501+ attr:: MOI.ConstraintPrimal ,
1502+ ci:: MOI.ConstraintIndex{F,S} ,
1503+ ) where {F<: MOI.AbstractScalarFunction ,S<: MOI.AbstractScalarSet }
1504+ if is_bridged (b, ci)
1505+ MOI. throw_if_not_valid (b, ci)
1506+ return call_in_context (MOI. get, b, ci, attr)
1507+ end
1508+ if Variable. has_bridges (Variable. bridges (b))
1509+ # In this case, the scalar constraint might contain bridged variables
1510+ # that include constants, like `x >= 1` being mapped to `y >= 0`,
1511+ # `x := y + 1`. If this is true, then `normalize_and_add_constraint`
1512+ # may move the constants into the set, and querying `ConstraintPrimal`
1513+ # from `b.model` will return the value of `y`, not `y + 1`. As a
1514+ # work-around, we use `get_fallback`, which first queries
1515+ # `ConstraintFunction` and then evaluates the function at the point
1516+ # defined by `VariablePrimal`. Querying `ConstraintFunction` accounts
1517+ # for the case where constants were moved to the set, so we return the
1518+ # correct value.
1519+ return MOI. Utilities. get_fallback (b, attr, ci)
1520+ end
1521+ return MOI. get (b. model, attr, ci)
1522+ end
1523+
14991524function MOI. supports (
15001525 b:: AbstractBridgeOptimizer ,
15011526 attr:: MOI.AbstractConstraintAttribute ,
0 commit comments