Unsmooth points at the beginning and end of control function #251
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Hi @Song921012, welcome to the InfiniteOpt discussion forum! (I moved this to the forum since it constitutes a modeling question) To answer your question, we first need to think of how this problem is solved. By default, InfiniteOpt will project the formulation onto discrete support points (i.e., employ direct transcription) and approximate the derivatives using backward finite difference (note other derivative approximations are available as explained here). With direct transcription approaches, the control trajectory is generally taken to be piece-wise continuous (not necessarily smooth e.g., bang-bang control). However, state variables are generally taken to be continuous and smooth (like Now for optimal control problems In this example, the terminal state objective drives the final control action that you see. To some extent this is an artifact of using the direct transcription approach with the solver can exploit a little on the last time step. Again, to this affect most finite-time approaches truncate the final control point. Hence, with optimal control problems like this one that use direct transcription approaches, people will commonly truncate the first and/or last control variables points. InfiniteOpt doesn't do this automatically since it is intended for general infinite-dimensional problems . However, we do have plans in the works to enable to control specific features (e.g., #216 and #199). We also plan to add an FAQ section (#217) to address common questions/considerations for specific problem domains like optimal control). |
Beta Was this translation helpful? Give feedback.
-
Re-opening this discussion with some small details. @infinite_parameter(model, t ∈ [t0, tf], num_supports = 101, derivative_method=FiniteDifference(Forward(), true)) But if you change to @infinite_parameter(model, t ∈ [t0, tf], num_supports = 101, derivative_method=FiniteDifference(Forward(), false)) how should I modify the rest of the code for the second option to work? but I'm not so sure how to implement it. |
Beta Was this translation helpful? Give feedback.
Hi @Song921012, welcome to the InfiniteOpt discussion forum! (I moved this to the forum since it constitutes a modeling question)
To answer your question, we first need to think of how this problem is solved. By default, InfiniteOpt will project the formulation onto discrete support points (i.e., employ direct transcription) and approximate the derivatives using backward finite difference (note other derivative approximations are available as explained here). With direct transcription approaches, the control trajectory is generally taken to be piece-wise continuous (not necessarily smooth e.g., bang-bang control). However, state variables are generally taken to be continuous and smooth (l…