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

Bug (?) in OptimTraj wrapper for GPOPS? #19

Open
stumarcus314 opened this issue Sep 9, 2016 · 7 comments
Open

Bug (?) in OptimTraj wrapper for GPOPS? #19

stumarcus314 opened this issue Sep 9, 2016 · 7 comments

Comments

@stumarcus314
Copy link

stumarcus314 commented Sep 9, 2016

I'm having some trouble getting the OptimTraj gpops method to work on my problem in certain cases. Do you know what might be causing the error below? I think this error may be related to how OptimTraj wraps GPOPS-II, because whenever I use GPOPS-II independently from OptimTraj on my optimal control problem, I never get this error.

| |
| Finding Solution on Mesh 2 |
|___________________________________________________________________|
Computing Radau Points, Integration Weights, and Integration Matrix
Creating Bounds For Nonlinear Program
Creating Guess For Nonlinear Program
Error using griddedInterpolant
Interpolation requires at least two sample points in each dimension.

Error in interp1 (line 161)
F = griddedInterpolant(X,V,method);

Error in gpopsGuessRPMI

Error in gpopsSolveRPMI

Error in gpopsMeshShell

Error in gpops2

Error in gpopsWrapper (line 84)
output = gpops2(setup);

Error in optimTraj (line 190)
soln(iter) = gpopsWrapper(P);

Error in invoke_OptimTraj (line 176)
soln = optimTraj(problem);

@stumarcus314 stumarcus314 changed the title GPOPS option not working in OptimTraj GPOPS method not working in OptimTraj Sep 9, 2016
@MatthewPeterKelly MatthewPeterKelly changed the title GPOPS method not working in OptimTraj Bug (?) in OptimTraj wrapper for GPOPS? Sep 12, 2016
@MatthewPeterKelly
Copy link
Owner

If it works natively in GPOPS, but not when called from OptimTraj, then it is probably a bug. One thing to check is that you've properly converted the problem into OptimTraj, since it uses the opposite matrix transpose orientation when compared to GPOPS. Have you checked to make sure that the other methods in OptimTraj are able to solve the problem correctly?

@stumarcus314
Copy link
Author

stumarcus314 commented Sep 12, 2016

Yes, all the other OptimTraj methods (trapezoidal, Hermite-Simpose, Runge-Kutta, and Chebyshev) correctly solve the problem.

@MatthewPeterKelly
Copy link
Owner

Hmm... Sounds like a bug!

Unfortunately, I no longer have a license for GPOPS-II, so I can't do the debugging myself. It would be great if you or someone else with a license would be able to play around and see if you can find the bug.

I have a few ideas that might be helpful:

  • See if there is a bug in the wrapper for the matrix transpose orientation: GPOPS-II and OptimTraj use opposite conventions.
  • Sometimes GPOPS-II goes crazy if any user-defined functions throw out a NaN. Make sure that none of your functions can return a NaN (for any possible input).
  • See if you can use a different initial guess (perhaps one generated by a different method) when you call GPOPS, and see if the problem persists.

@mhuzaif2
Copy link

mhuzaif2 commented Oct 5, 2018

I faced a similar issue and fixed it by carefully going through matrix transpose orientations.

@MatthewPeterKelly
Copy link
Owner

@mhuzaif2 - did you find a bug in the OptimTraj implementation while you were investigating this issue, or was it something in your code? If you did find a bug in OptimTraj, it would be great if you could make a pull request that fixed it (or just add enough detail for someone else to implement the fix). Thanks!

@mhuzaif2
Copy link

mhuzaif2 commented Oct 6, 2018

@MatthewPeterKelly - This one was a bug in my code. I just wanted to confirm that the difference of convention might have been overlooked.

@MatthewPeterKelly
Copy link
Owner

@mhuzaif2 - Thanks for the update! You're responses provide good context here.

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

No branches or pull requests

3 participants