csu-hmc / opty

A library for using direct collocation in the optimization of dynamic systems.
http://opty.readthedocs.io
Other
92 stars 20 forks source link

Question concerning the bounds keyword in Problem. #143

Closed Peter230655 closed 6 months ago

Peter230655 commented 6 months ago

I am playing around with an opty simulation (I am trying to fly a rocket from A to B) So far I have been unable to find a solution, I get this error: message from optimizer: b'Maximum number of iterations exceeded (can be specified by an option).' (This is not my concern, this has always been the case when I first started a simulation.) Still, a solution is given, and when I looked at it I found that the bounds given are not always respected, some are and some are not. I thought, the bounds were absolute, that opty would not attempt to look for solutions outside these bounds.

Is my assumption that the bounds are absolute simply wrong, or am I doing something wrong?

Thanks for any clarification!

moorepants commented 6 months ago

The bounds are met only if an optimal solution is found. If you want to know more about the optimizer you will have to read the documentation for Ipopt:

https://coin-or.github.io/Ipopt/

opty is built on top of sympy and cyipopt. cyipopt is a python wrapper for ipopt. ipopt is an "interior point optimizer" for solving nonlinear programming problems.

opty translates an optimal control problem into a nonlinear programming problem via the direct collocation transcription method.

Designing optimal control problem that 1) has a unique solution and 2) can be solved by Ipopt is the essential task. The documentation of all these programs does not provide enough information to do this. Reading books and papers about optimal control and nonlinear programming should help, in general.

Sam and I learned a lot from this book by John Betts: https://epubs.siam.org/doi/book/10.1137/1.9780898718577

Russ Tedrake has a nice set of notes for his MIT course: https://underactuated.csail.mit.edu/index.html that covers lot of what you need also and it is freely available.

Peter230655 commented 6 months ago

John Betts' book seems VERY expensive! (I looked at it since you quoted it in the documentation of opty. I think, I will simply print Russ Tedrake's file (I cannot read long thins on a screen) Thanks a lot for this information!