Hi everyone,
I have tried to run a tutorial example in InfiniteOpt.jl.
using InfiniteOpt, Distributions, Ipopt
# DEFINE THE PROBLEM CONSTANTS
μ = 1; σ = 0.2
x0 = [0, 0]; v0 = [0, 0]
p = [1 4 6 1; 1 3 0 1]; tw = [0, 25, 50, 60]
I = 1:2; W = 1:4
# INITIALIZE THE MODEL
model = InfiniteModel(Ipopt.Optimizer)
# INITIALIZE THE PARAMETERS
@finite_parameter(model, ϵ == 10)
@infinite_parameter(model, t in [0, 60], num_supports = 61,
derivative_method = OrthogonalCollocation(2))
@infinite_parameter(model, ξ ~ Normal(μ, σ^2), num_supports = 10)
# INITIALIZE THE VARIABLES
@variable(model, x[I], Infinite(t, ξ), start = 0)
@variable(model, v[I], Infinite(t, ξ), start = 0)
@variable(model, u[I], Infinite(t), start = 0)
@variable(model, y[W] >= 0, Infinite(ξ), start = 0)
# SET THE OBJECTIVE
@objective(model, Min, integral(sum(u[i]^2 for i in I), t))
# SET THE INITIAL CONDITIONS
@constraint(model, [i in I], x[i](0, ξ) == x0[i])
@constraint(model, [i in I], v[i](0, ξ) == v0[i])
# SET THE PROBLEM CONSTRAINTS
@constraint(model, c1[i in I], @deriv(x[i], t) == v[i])
@constraint(model, c2[i in I], ξ * @deriv(v[i], t) == u[i])
@constraint(model, c3[w in W], y[w] == sum((x[i](tw[w], ξ) - p[i, w])^2 for i in I))
@constraint(model, c4, expect(sum(y[w] for w in W), ξ) <= ϵ)
# SOLVE THE MODEL
optimize!(model)
# GET THE RESULTS
termination_status(model)
opt_obj = objective_value(model)
u_opt = value.(u)
u_ts = supports.(u)
But I got an error:
type Model has no field nlp_data
Stacktrace:
[1] setproperty!(x::Model, f::Symbol, v::Nothing)
@ Base ./Base.jl:39
[2] clear_optimizer_model_build!(model::Model)
@ InfiniteOpt ~/.julia/packages/InfiniteOpt/k0mve/src/optimize.jl:489
[3] clear_optimizer_model_build!(model::InfiniteModel)
@ InfiniteOpt ~/.julia/packages/InfiniteOpt/k0mve/src/optimize.jl:506
[4] build_optimizer_model!(model::InfiniteModel, key::Val{:TransData}; check_support_dims::Bool)
@ InfiniteOpt.TranscriptionOpt ~/.julia/packages/InfiniteOpt/k0mve/src/TranscriptionOpt/optimize.jl:32
[5] build_optimizer_model!(model::InfiniteModel, key::Val{:TransData})
@ InfiniteOpt.TranscriptionOpt ~/.julia/packages/InfiniteOpt/k0mve/src/TranscriptionOpt/optimize.jl:26
[6] build_optimizer_model!(model::InfiniteModel; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ InfiniteOpt ~/.julia/packages/InfiniteOpt/k0mve/src/optimize.jl:536
[7] build_optimizer_model!(model::InfiniteModel)
@ InfiniteOpt ~/.julia/packages/InfiniteOpt/k0mve/src/optimize.jl:530
[8] #optimize!#475
@ ~/.julia/packages/InfiniteOpt/k0mve/src/optimize.jl:926 [inlined]
[9] optimize!(model::InfiniteModel)
@ InfiniteOpt ~/.julia/packages/InfiniteOpt/k0mve/src/optimize.jl:924
[10] top-level scope
@ ~/Julia_projects/Maintenance_EMS/RUL_dist.ipynb:38
Thanks for checking my problem!