-
Notifications
You must be signed in to change notification settings - Fork 67
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
Failure Of Basic Wall Constraint For Spring Mass Example #1037
Comments
Hello and thanks for checking out dymos. The oscillator example posted is an example of solving an initial value problem in dymos. The variables that govern the trajectory are all fixed:
With all of these variables fixed, there is only a single physical path that the system can possibly take, so there are no degrees of freedom or "knobs" that can be turned to satisfy the wall path constraint at This example is a bit odd, because we're using an optimizer to satisfy the pseudospectral method defect constraints. To make the optimizer happy, we also have to give it some objective. This example used final time, but the optimizer can't do anything to actually change it since the phase initial time and duration are fixed. If you check out Instead, we can modify the problem and ask dymos to solve "What is the largest initial displacement the block can have such that it doesn't violate the wall constraint?" The changes needed in the code are as follows. First, we free up the initial value of the displacement,
Next, we need to change the objective to maximize the initial value of
Also, I added the following line after the driver has been instantiated. This speeds up the calculation of the total derivatives needed by the optimizer:
Note that path constraints are only enforced at the discrete nodes. There may be some minor violation of the path constraint between nodes. You can get more nodes by using more segments or higher-order segments. If you absolutely need to know the exact condition when the wall is reached, that would be a use case for a two phase problem and boundary constraints. The first phase would proceed for some minimum duration and have a final boundary constraint of If you're looking for a simulation tool that will "bounce" off of the walls, you could pose that in dymos with appropriate phases and boundary constraints but that's not really what it's designed to do. Phase-based specification of trajectories means you need some a-priori knowledge of the discontinuities in the states, such as the jump in velocity when the mass hits the wall.
|
@robfalck Thanks for taking the time to work through this issue and explain some possible solutions to this problem to me. I recognize dymos has a unique approach to dynamic problems, solving the trajectory as a state. That is very novel and I completely understand that this conventional dynamics problem isn't really a good fit for the library's spectral method. There will be plenty of scenarios where I expect the physics of my problem to rest on the actuator limit. I understand there is an explicit shooting mode to dymos as well, I would be very interested in a way to use more complicated path boundaries, such as conditional wall boundaries / actuator limits in openmdao. This would allow dymos to be used for general dynamics problems, in tandem with openmdao. Before I encountered dymos I was wondering how to combine openmdao with the time domain for optimization, and I recognize its a tricky intersection of solver / optimizer approaches, and one that I think dymos approaches intelligently given all the challenges of integrating the time domain into openmdao. With that I'll leave it up to the maintainers of dymos to close this issue or leave it open in the case there might be a solution for more complex boundary conditions. |
There's a paper on the "sweeping gradient method" by Ben Margolis that accomplishes what you want, ODE integration with adjoint differentiation and discrete event detection. https://www.researchgate.net/publication/374475723_A_Sweeping_Gradient_Method_for_Ordinary_Differential_Equations_with_Events I haven't implemented it in dymos yet. It's very much a "controls view" of solving the problem where things like path and boundary constraints are enforced by a controler modeled in the ODE, |
Thats quite interesting! Thanks for sharing. That would make dymos quite powerful with the ability to create an optimal path and controller! I think openmdao would probably be quite useful here as well with partial derivatives baked in. I think thats probably quite a hard problem to generalize along with the existing methods of dymos. I mentioned dymos in the |
Description
I am evaluating dymos for evaluation of optimization of a dynamic hydraulic system operating in resonance.
I see the caveats regarding the system and variables must be continuous and differentiable so I though it would be a good idea to test dymos with something like an actuator limit for the spring mass example.
Adding a basic lower limit fails at
x=-4
. I am thinking whats going on is that thev
paramater should be bounded as well but the solver cant easily assess that since only constant (not piecewise) boundaries are considered, there isn't an easy way to say, velocity should be zero at the wall.I am highly interested in this library but It doesn't seem ready for generally bounded problems, which unfortunately constitute most dynamic systems.
Example
Code Example:
Dymos Version
1.10.0
Relevant environment information
No response
The text was updated successfully, but these errors were encountered: