Skip to content

Scalarize bridge error #2363

@joaquimg

Description

@joaquimg

@blegat this is the scalarize error I mentioned in jump-dev/ParametricOptInterface.jl#143

The code:

function scalarize_bridge_error()
    model = direct_model(DiffOpt.diff_optimizer(SCS.Optimizer))
    set_silent(model)
    @variable(model, x)
    # @variable(model, p in MOI.Parameter(3.0))
    p = 3.0
    @constraint(model, cons, [x - 3 * p] in MOI.Zeros(1))

    # it works it this is uncommented
    # @constraint(model, fake_soc, [0, 0, 0] in SecondOrderCone())

    @objective(model, Min, 2x)
    optimize!(model)

    MOI.set(model, DiffOpt.ForwardConstraintFunction(), cons,
        MOI.VectorAffineFunction{Float64}(MOI.VectorOfVariables([x]))
    )
    DiffOpt.forward_differentiate!(model) # ERROR

    return
end

the error:

ERROR: MathOptInterface.UnsupportedAttribute{DiffOpt.ForwardConstraintFunction}: Attribute DiffOpt.ForwardConstraintFunction() is not supported by the model: Bridge of type `ScalarizeBridge` does not support setting a value for the attribute `DiffOpt.ForwardConstraintFunction()`. If you encountered this error unexpectedly, it probably means your model has been reformulated using the bridge, and you are attempting to query an attribute that we haven't implemented yet for this bridge. Please open an issue at https://github.com/jump-dev/MathOptInterface.jl/issues/new and provide a reproducible example explaining what you were trying to do.
Stacktrace:
  [1] set(model::MathOptInterface.Bridges.LazyBridgeOptimizer{DiffOpt.QuadraticProgram.Model}, attr::DiffOpt.ForwardConstraintFunction, bridge::MathOptInterface.Bridges.Constraint.ScalarizeBridge{Float64, MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}, #unused#::MathOptInterface.VectorAffineFunction{Float64})
    @ MathOptInterface.Bridges C:\JG\Julia\packages\MathOptInterface\IiXiU\src\Bridges\bridge.jl:182

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions