Reputation: 319
I am running my trajectory problem multiple times in a row while varying a parameter to generate plots and compare to other things. I think I can make it run faster by just using the previous solution as a guess. Would I do something like
p['traj.phase_1.states:v'] = prev_p.get_val['traj.phase_1.states:v']
also is there a single function to load the file "dymos_simulation.db" into memory?
Upvotes: 1
Views: 234
Reputation: 2704
The dymos.run_problem
is intended to be the mechanism that makes this simple.
There is currently a PR that addresses some shortcomings, but expect it to be merged sometime today and included in dymos 0.18.0 in the next day or two. In the meantime you can test against the source branch of the PR if you like:
https://github.com/OpenMDAO/dymos/pull/510
First, you can simulate out the initial guess of the controls (this is not recommended if you're likely to hit a singularity in the ODE during your simulation).
dymos.run_problem(p, run_driver=False, simulate=True)
That will generate the file 'dymos_simulation.db'. Then you can run
dymos.run_problem(p, run_driver=True, simulate=True, restart='dymos_simulation.db')
It will use the simulated guess as the initial guess for the solution. This should adequately satisfy the collocation constraints and give the optimizer an easier path to the solution.
Upvotes: 1