Skip to content

Tutorial examples are not working #37

@ghost

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions