Open samlaf opened 3 years ago
OptimTraj is not designed to run in Octave. At the time of writing, it didn't even run at all (no implementation for fmincon
). That being said, it looks like someone implemented it, because the code gets farther than it used to!
Do you get a similar error on all of the other example problems?
My guess is that the Octave implementation of fmincon
doesn't match all of the internal interface details (like how options are handled) and that is where your problem is coming from. Most of the examples in OptimTraj will default to using finite difference gradients, so you might have more luck with those ones.
Hi Matthew, thank you for this very nice library, and for answering my message.
There is indeed an optim library in Octave now, which contains fmincon (though it needs to be loaded with pkg load optim). I think the main difference is fmincon's default solver, which doesn't accept initial guesses that don't respect the constraints (which mostly all of your examples do!). So I changed the default solver to octave-sqp. It worked for this example, but still raises issues for other examples (I only tried the minwork example, and got discouraged.)
How/Where do I set finite difference gradients?
The minimumWork
example is a particularly tricky one to solve. I suggest starting with one of the following: cartPole
, quadRotor2d, or
simplePendulum`.
Octave SQP sounds like a reasonable choice - good luck!
By default, OptimTraj
will solve using finite difference gradients. They are not computed directly by OptimTraj
though -- they are done automatically inside of FMINCON
. You can provide an analytic gradient, which is better to do if you can.
If the Octave solver requires that you provide a gradient, then I suggest that you try to go through the analytic gradient route. Look at the example code in fiveLinkBiped
. The gradients for the optimization are a bit tricky -- there is a lot of "vectorization" going on to make things run fast enough.
Hi, I am running toyCar's MAIN.m file, and get this error
I am wondering if this is due to me using octave, or if there is a fundamental bug happening. Another "fix" I've had to do is to add
options in optimset in GetDefaultOptions.m. Otherwise directCollocation.m's line 26
flagGradObj = strcmp(Opt.nlpOpt.GradObj,'on');
was raising an error.Not sure if this is also an issue due to octave or if it's actually an issue with the code.