Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some solvers don't support delete #44

Closed
odow opened this issue Feb 21, 2023 · 0 comments · Fixed by #46
Closed

Some solvers don't support delete #44

odow opened this issue Feb 21, 2023 · 0 comments · Fixed by #46

Comments

@odow
Copy link
Member

odow commented Feb 21, 2023

julia> model = Model(() -> MOA.Optimizer(Ipopt.Optimizer))
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: MOA[algorithm=MultiObjectiveAlgorithms.Lexicographic, optimizer=Ipopt]

julia> set_optimizer_attribute(model, MOA.Algorithm(), MOA.EpsilonConstraint())

julia> set_optimizer_attribute(model, MOA.EpsilonConstraintStep(), 0.0001)

julia> set_silent(model)

julia> @variable(model, 0 <= w[1:size(R, 2)] <= 1)
2-element Vector{VariableRef}:
 w[1]
 w[2]

julia> @constraint(model, sum(w) == 1)
w[1] + w[2] = 1.0

julia> @objective(model, Min, [sum(Q * w), -μ' * w])
2-element Vector{AffExpr}:
 0.001281759497122053 w[1] + 0.005981451347159874 w[2]
 -0.05470748600000001 w[1] - 0.18257110599999998 w[2]

julia> optimize!(model)
ERROR: MathOptInterface.DeleteNotAllowed{MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.LessThan{Float64}}}: Deleting the index MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.LessThan{Float64}}(2) cannot be performed. You may want to use a `CachingOptimizer` in `AUTOMATIC` mode or you may need to call `reset_optimizer` before doing this operation if the `CachingOptimizer` is in `MANUAL` mode.
Stacktrace:
  [1] delete(model::Ipopt.Optimizer, index::MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.LessThan{Float64}})
    @ MathOptInterface ~/.julia/packages/MathOptInterface/NCblk/src/indextypes.jl:145
  [2] delete(model::MultiObjectiveAlgorithms.Optimizer, ci::MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.LessThan{Float64}})
    @ MultiObjectiveAlgorithms ~/.julia/packages/MultiObjectiveAlgorithms/IhQGz/src/MultiObjectiveAlgorithms.jl:427
  [3] optimize_multiobjective!(algorithm::MultiObjectiveAlgorithms.Hierarchical, model::MultiObjectiveAlgorithms.Optimizer)
    @ MultiObjectiveAlgorithms ~/.julia/packages/MultiObjectiveAlgorithms/IhQGz/src/algorithms/Hierarchical.jl:126
  [4] optimize_multiobjective!(algorithm::MultiObjectiveAlgorithms.EpsilonConstraint, model::MultiObjectiveAlgorithms.Optimizer)
    @ MultiObjectiveAlgorithms ~/.julia/packages/MultiObjectiveAlgorithms/IhQGz/src/algorithms/EpsilonConstraint.jl:78
  [5] optimize!(model::MultiObjectiveAlgorithms.Optimizer)
    @ MultiObjectiveAlgorithms ~/.julia/packages/MultiObjectiveAlgorithms/IhQGz/src/MultiObjectiveAlgorithms.jl:439
  [6] optimize!
    @ ~/.julia/packages/MathOptInterface/NCblk/src/Bridges/bridge_optimizer.jl:376 [inlined]
  [7] optimize!
    @ ~/.julia/packages/MathOptInterface/NCblk/src/MathOptInterface.jl:83 [inlined]
  [8] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{MultiObjectiveAlgorithms.Optimizer}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/NCblk/src/Utilities/cachingoptimizer.jl:316
  [9] optimize!(model::Model; ignore_optimize_hook::Bool, _differentiation_backend::MathOptInterface.Nonlinear.SparseReverseMode, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ JuMP ~/.julia/packages/JuMP/7XtRG/src/optimizer_interface.jl:480
 [10] optimize!(model::Model)
    @ JuMP ~/.julia/packages/JuMP/7XtRG/src/optimizer_interface.jl:458
 [11] top-level scope
    @ REPL[365]:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant