👀 Reading hidden code
using JuMP , Ipopt
setup_opt_model (generic function with 1 method)
👀 Reading hidden code
"acceptable_tol" => 1.e-8, "max_iter" => Int64(1e8),
"acceptable_constr_viol_tol" => 1.e-3, "constr_viol_tol" => 1.e-4,
"print_frequency_iter" => 50, "print_timing_statistics" => "no",
"print_level" => 0,
))
halfsum (generic function with 1 method)
👀 Reading hidden code
halfsum_jump (generic function with 1 method)
👀 Reading hidden code
cumsum_jump (generic function with 1 method)
👀 Reading hidden code
200
👀 Reading hidden code
N = 200
👀 Reading hidden code
begin
# Register our wrapper functions
###
:halfsum_jump,
autodiff=true
)
# Objective
###
min_objective = @NLobjective(
)
)
end
A JuMP Model
├ solver: Ipopt
├ objective_sense: MIN_SENSE
│ └ objective_function_type: AffExpr
├ num_variables: 200
├ num_constraints: 600
│ ├ JuMP.VariableRef in MOI.GreaterThan{Float64}: 200
│ ├ JuMP.VariableRef in MOI.LessThan{Float64}: 200
│ └ Nonlinear: 200
└ Names registered in the model
└ :M
model_optimized = let
optimize!(model_optimizer)
model_optimizer
end
👀 Reading hidden code
****************************************************************************** This program contains Ipopt, a library for large-scale nonlinear optimization. Ipopt is released as open source code under the Eclipse Public License (EPL). For more information visit https://github.com/coin-or/Ipopt ******************************************************************************
LOCALLY_SOLVED::TerminationStatusCode = 4
termination_status(model_optimized)
👀 Reading hidden code
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.955
0.96
0.965
0.97
0.975
0.98
0.985
0.99
0.995
1.0
value.(M)
👀 Reading hidden code
begin
model_optimizer2 = setup_opt_model()
local m = model_optimizer2
M2 = @variable(m, 0.0 <= M2[1:N] <= 1.0)
# Objective
###
for i in 1:N
@NLconstraint(m,
M2[i] >= i / N
)
end
min_objective2 = @NLobjective(
m, Min,
# sum(
# (M2[i] - 0.5) ^ 2
# for i in 1:N
# )
sum(
(M2[i] - 0.5)^2
for i in 1:N) + .001 * (sum(M2[i] for i in 1:N) - 50)^2
)
min_objective2
end;
👀 Reading hidden code
A JuMP Model
├ solver: Ipopt
├ objective_sense: MIN_SENSE
│ └ objective_function_type: AffExpr
├ num_variables: 200
├ num_constraints: 600
│ ├ JuMP.VariableRef in MOI.GreaterThan{Float64}: 200
│ ├ JuMP.VariableRef in MOI.LessThan{Float64}: 200
│ └ Nonlinear: 200
└ Names registered in the model
└ :M2
model_optimized2 = let
optimize!(model_optimizer2)
model_optimizer2
end
👀 Reading hidden code
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.431128
0.955
0.96
0.965
0.97
0.975
0.98
0.985
0.99
0.995
1.0
value.(M2)
👀 Reading hidden code