Skip to content
New issue

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

Can't use AmplNLWriter as Jump backend #33

Open
freemin7 opened this issue Jul 22, 2020 · 1 comment
Open

Can't use AmplNLWriter as Jump backend #33

freemin7 opened this issue Jul 22, 2020 · 1 comment

Comments

@freemin7
Copy link

freemin7 commented Jul 22, 2020

I am following this tutorial: Cartpole.ipybn
but instead of using Ipopt i am trying to use a solver only accessible via AmplNLWriter. Instead of Block [17] i have

using AmplNLWriter
using MathOptInterface

const MOI = MathOptInterface

optimizer = AmplNLWriter.Optimizer("octeract-engine")

TrajectoryOptimization.build_MOI!(nlp, optimizer)
MOI.optimize!(optimizer)
MOI.get(optimizer, MOI.TerminationStatus())

I get the following stack trace:

MethodError: no method matching constraint_expr(::TrajOptNLP{4,1,Float64}, ::Int64)
Closest candidates are:
constraint_expr(!Matched::MathOptInterface.Test.FeasibilitySenseEvaluator, ::Int64) at /home/joto/.julia/packages/MathOptInterface/bygN7/src/Test/nlp.jl:204
constraint_expr(!Matched::MathOptInterface.Test.HS071, ::Int64) at /home/joto/.julia/packages/MathOptInterface/bygN7/src/Test/nlp.jl:37
constr_expr(::AmplNLWriter.NLPEvaluator{TrajOptNLP{4,1,Float64}}, ::Int64) at MOI_wrapper.jl:163
(::AmplNLWriter.var"#85#86"{AmplNLWriter.AmplNLMathProgModel})(::Int64) at AmplNLWriter.jl:211
iterate at generator.jl:47 [inlined]
_collect(::UnitRange{Int64}, ::Base.Generator{UnitRange{Int64},AmplNLWriter.var"#85#86"{AmplNLWriter.AmplNLMathProgModel}}, ::Base.EltypeUnknown, ::Base.HasShape{1}) at array.jl:678
collect_similar at array.jl:607 [inlined]
map at abstractarray.jl:2072 [inlined]
loadproblem!(::AmplNLWriter.AmplNLNonlinearModel, ::Int64, ::Int64, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Symbol, ::AmplNLWriter.NLPEvaluator{TrajOptNLP{4,1,Float64}}) at AmplNLWriter.jl:210
optimize!(::AmplNLWriter.Model{Float64}) at MOI_wrapper.jl:371
top-level scope at Cartpole.jl:62

The same problem persist if i try another solver:
and replace octeract-engine with any other string. I open a twin issue at AmplNLWriter too. Until it is clear which package can fix this.
jump-dev/AmplNLWriter.jl#107

@odow
Copy link

odow commented Jul 22, 2020

This issue can be closed.

AMPLNLWriter needs to check if ExprGraph is in features_available, which it is not:

MOI.features_available(nlp::TrajOptNLP) = [:Grad, :Jac]

@freemin7: you cannot use AMPLNLWriter with this problem, regardless of the solver. AMPLNLWriter requires the explicit expression graph to create an NL file. Use Ipopt or Knitro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants