JuliaMPC / NLOptControl.jl

nonlinear control optimization tool
Other
109 stars 26 forks source link

Tutorial examples are not working #37

Open ghost opened 3 years ago

ghost commented 3 years ago

There seems to be problem in calling JuMP for solving optimal control problems. I cannot run any of the provided tutorial examples. For example this is the RobotArm code and error:

using NLOptControl

n=define(numStates=1,numControls=1,X0=[1.5],XF=[1.])
dx=[:(-x1[j]^3+u1[j])]
dynamics!(n,dx)
configure!(n;(:Nck=>[3,3,3,3,3,3,3,3,3,3,3,3]),(:finalTimeDV=>false),(:tf=>10000.0))
obj=integrate!(n,:( 0.5*x1[j]^2 + 0.5*u1[j]^2) )
@NLobjective(n.ocp.mdl,Min,obj);

optimize!(n);
plotSettings(;(:size=>(1200,1200)));
allPlots(n)
******************************************************************************
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 http://projects.coin-or.org/Ipopt
******************************************************************************

┌ Warning: Ipopt finished with status Restoration_Failed
└ @ Ipopt /Users/sadeghi.ma/.julia/packages/Ipopt/bYzBL/src/MPB_wrapper.jl:178
┌ Warning: Not solved to optimality, status: Error
└ @ JuMP /Users/sadeghi.ma/.julia/packages/JuMP/I7whV/src/nlp.jl:1283
┌ Warning: The solution is not Optimal 
│ 
│                 Setting: n.f.mpc.simFailed = [true, n.r.ocp.status] 
└ @ NLOptControl /Users/sadeghi.ma/.julia/packages/NLOptControl/i4KEb/src/utils.jl:406
BoundsError: attempt to access 0-element Array{DataFrames.DataFrame,1} at index [0]

Stacktrace:
 [1] getindex at ./array.jl:809 [inlined]
 [2] statePlot(::NLOptControl.NLOpt{Float64}, ::Int64, ::Int64; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/sadeghi.ma/.julia/packages/NLOptControl/i4KEb/src/PrettyPlots/NLOptControl_plots.jl:88
 [3] statePlot at /Users/sadeghi.ma/.julia/packages/NLOptControl/i4KEb/src/PrettyPlots/NLOptControl_plots.jl:60 [inlined]
 [4] #184 at ./none:0 [inlined]
 [5] iterate at ./generator.jl:47 [inlined]
 [6] collect(::Base.Generator{UnitRange{Int64},NLOptControl.PrettyPlots.var"#184#187"{Int64,Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},NLOptControl.NLOpt{Float64}}}) at ./array.jl:686
 [7] allPlots(::NLOptControl.NLOpt{Float64}; idx::Int64, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/sadeghi.ma/.julia/packages/NLOptControl/i4KEb/src/PrettyPlots/NLOptControl_plots.jl:33
 [8] allPlots(::NLOptControl.NLOpt{Float64}) at /Users/sadeghi.ma/.julia/packages/NLOptControl/i4KEb/src/PrettyPlots/NLOptControl_plots.jl:32
 [9] top-level scope at In[1]:12
 [10] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091
asgherali39 commented 3 years ago

I am also getting the same output on my Linux machine for the tutorial problem.


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 http://projects.coin-or.org/Ipopt


┌ Warning: Ipopt finished with status Restoration_Failed └ @ Ipopt ~/.julia/packages/Ipopt/bYzBL/src/MPB_wrapper.jl:178 ┌ Warning: Not solved to optimality, status: Error └ @ JuMP ~/.julia/packages/JuMP/I7whV/src/nlp.jl:1283 ┌ Warning: The solution is not Optimal │ │ Setting: n.f.mpc.simFailed = [true, n.r.ocp.status] └ @ NLOptControl ~/.julia/packages/NLOptControl/Yh2kR/src/utils.jl:406