DiffOpt.jl icon indicating copy to clipboard operation
DiffOpt.jl copied to clipboard

Method error (bridge related?)

Open joaquimg opened this issue 2 years ago • 0 comments

Another error from https://github.com/jump-dev/ParametricOptInterface.jl/pull/143

the code

function fallback_error()
    num_A = 2
    ##### SecondOrderCone #####
    x_hat = rand(num_A)
    μ = rand(num_A) * 10
    Σ_12 = rand(num_A, num_A)
    Σ = Σ_12 * Σ_12' + 0.1 * I
    γ = 1.0
    model = direct_model(DiffOpt.diff_optimizer(SCS.Optimizer))
    set_silent(model)
    @variable(model, x[1:num_A])
    @variable(model, norm_2)
    # (x - x_hat)^T Σ^-1 (x - x_hat) <= γ
    @constraint(
        model,
        (x - μ)' * inv(Σ) * (x - μ) <= γ,
    )
    # norm_2 >= ||x - x_hat||_2
    @constraint(model, ctr, [norm_2; x - x_hat] in SecondOrderCone())
    @objective(model, Min, norm_2)
    optimize!(model)
    MOI.set(model, DiffOpt.ForwardConstraintFunction(), ctr,
        MOI.VectorAffineFunction{Float64}(MOI.VectorOfVariables(x))
    )
    DiffOpt.forward_differentiate!(model) # ERROR
    return
end

the error:

ERROR: MethodError: no method matching throw_set_error_fallback(::MathOptInterface.Bridges.LazyBridgeOptimizer{DiffOpt.ConicProgram.Model}, ::DiffOpt.ObjectiveFunctionAttribute{DiffOpt.ObjectiveDualStart, MathOptInterface.VariableIndex}, ::MathOptInterface.Bridges.Objective.FunctionConversionBridge{Float64, MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.VariableIndex}, ::Float64)

joaquimg avatar Dec 18 '23 05:12 joaquimg