We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://discourse.julialang.org/t/jump-non-linear-optimization/94020/7
julia> using JuMP julia> import DataFrames julia> import Gurobi julia> import MultiObjectiveAlgorithms as MOA julia> import Plots julia> import Statistics julia> df = DataFrames.DataFrame( bond = [0.06276629, 0.03958098, 0.08456482,0.02759821,0.09584956,0.06363253,0.02874502,0.02707264,0.08776449,0.02950032], stock = [0.1759782,0.20386651,0.21993588,0.3090001,0.17365969,0.10465274,0.07888138,0.13220847,0.28409742,0.14343067], ) 10×2 DataFrame Row │ bond stock │ Float64 Float64 ─────┼────────────────────── 1 │ 0.0627663 0.175978 2 │ 0.039581 0.203867 3 │ 0.0845648 0.219936 4 │ 0.0275982 0.309 5 │ 0.0958496 0.17366 6 │ 0.0636325 0.104653 7 │ 0.028745 0.0788814 8 │ 0.0270726 0.132208 9 │ 0.0877645 0.284097 10 │ 0.0295003 0.143431 julia> R = Matrix(df) 10×2 Matrix{Float64}: 0.0627663 0.175978 0.039581 0.203867 0.0845648 0.219936 0.0275982 0.309 0.0958496 0.17366 0.0636325 0.104653 0.028745 0.0788814 0.0270726 0.132208 0.0877645 0.284097 0.0295003 0.143431 julia> μ = vec(Statistics.mean(R; dims = 1)) 2-element Vector{Float64}: 0.05470748600000001 0.18257110599999998 julia> Q = Statistics.cov(R) 2×2 Matrix{Float64}: 0.00076204 0.00051972 0.00051972 0.00546173 julia> model = Model(() -> MOA.Optimizer(Gurobi.Optimizer)) A JuMP Model Feasibility problem with: Variables: 0 Model mode: AUTOMATIC CachingOptimizer state: EMPTY_OPTIMIZER Solver name: MOA[algorithm=MultiObjectiveAlgorithms.Lexicographic, optimizer=Gurobi] 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, [w' * Q * w, -μ' * w]) 2-element Vector{QuadExpr}: 0.0007620396103762265 w[1]² + 0.0010394397734916532 w[2]*w[1] + 0.005461731460414048 w[2]² -0.05470748600000001 w[1] - 0.18257110599999998 w[2] julia> optimize!(model) ERROR: MethodError: no method matching _scalarise(::MathOptInterface.VectorQuadraticFunction{Float64}, ::Vector{Float64}) Closest candidates are: _scalarise(::MathOptInterface.VectorOfVariables, ::Vector{Float64}) at /Users/oscar/.julia/packages/MultiObjectiveAlgorithms/IhQGz/src/MultiObjectiveAlgorithms.jl:54 _scalarise(::MathOptInterface.VectorAffineFunction, ::Vector{Float64}) at /Users/oscar/.julia/packages/MultiObjectiveAlgorithms/IhQGz/src/MultiObjectiveAlgorithms.jl:62 Stacktrace: [1] optimize_multiobjective!(algorithm::MultiObjectiveAlgorithms.Hierarchical, model::MultiObjectiveAlgorithms.Optimizer) @ MultiObjectiveAlgorithms ~/.julia/packages/MultiObjectiveAlgorithms/IhQGz/src/algorithms/Hierarchical.jl:100 [2] optimize_multiobjective!(algorithm::MultiObjectiveAlgorithms.EpsilonConstraint, model::MultiObjectiveAlgorithms.Optimizer) @ MultiObjectiveAlgorithms ~/.julia/packages/MultiObjectiveAlgorithms/IhQGz/src/algorithms/EpsilonConstraint.jl:78 [3] optimize!(model::MultiObjectiveAlgorithms.Optimizer) @ MultiObjectiveAlgorithms ~/.julia/packages/MultiObjectiveAlgorithms/IhQGz/src/MultiObjectiveAlgorithms.jl:439 [4] optimize! @ ~/.julia/packages/MathOptInterface/NCblk/src/Bridges/bridge_optimizer.jl:376 [inlined] [5] optimize! @ ~/.julia/packages/MathOptInterface/NCblk/src/MathOptInterface.jl:83 [inlined] [6] 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 [7] 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 [8] optimize!(model::Model) @ JuMP ~/.julia/packages/JuMP/7XtRG/src/optimizer_interface.jl:458 [9] top-level scope @ REPL[342]:1
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
https://discourse.julialang.org/t/jump-non-linear-optimization/94020/7
The text was updated successfully, but these errors were encountered: