My problem: I have a system with 4 states and 4 parameters (static) that I would like to optimize. The parameters are initialized to some known values that would result in trajectories that respect constraints. The states are initialized to a constant value. To verify the model, I run the problem where the parameters setting opt=False. Once verified, I rebuild the OpenMDAO problem with opt=True and run the optimizer.
I'm running a study to evaluate how each parameter affects the system, cost function, etc. and how the initial guess impacts the optimization (ideally, it doesn't). The problem I encounter is that some initial guesses for a parameter result in a failed optimization (iteration limit or positive line search) while others don't and it's not immediately clear why. Note: I always provide an initial guess for the problem that results in feasible trajectories. I check this by setting opt=False for the parameters when I build the problem. My assumption is that although my initial guess for the parameters are okay, my initial guess for the states is not and the problem gets stuck trying to get feasible trajectories.
My solution/idea: Is it possible to warm start an optimization problem in Dymos? To warm start, I would like to provide a feasible solution to the states and state rates of the optimizer. As a general flow I would like to first (1) run the optimization with the opt setting in controls and parameters set to False to get a state trajectory, then (2) set the opt setting for controls and parameters to True, and finally (3) re-run the optimization. It seems like there should be an easy way to do this, but I can't determine how without creating 2 problems (with different opt settings) and setting all the initial state guesses of the opt=True problem.
Note: I did read this post: Dymos how to use previous trajectory solution as initial guess? and I can rerun a problem. I just don't know how to change the opt setting between runs.
If there is an alternate or better solution to my problem, I'd be interested in that as well.
opt=Falseon your design variables, and usedymos.run_problemto generate output files from a simulated trajectory. The next time running your code (or using a different run script), set those flags toopt=Trueand load the previous solution as defined. It should start with that trajectory as a solution and iterate from there. - Rob Falckopt=Falseand save the output as 'Baseline.db'. # Run the problem without optimizing controls and parameters:dm.run_problem(p,solution_record_file='Baseline.db')Second, set the desired settingsopt=Trueand rebuild the problem. Third, run the new problem using the previous solution as a guess.dm.run_problem(p, run_driver=True, simulate=False, restart='Baseline.db')- Chrisrun_driver=False, simulate=Trueoptions torun_problem, you're skipping the initial optimization and telling dymos "just simulate the trajectory from the initial conditions using the initial guesses for the controls and parameters". This provides a physically valid trajectory so those defect constraints will be close to zero (we're making the optimizer's job easier). - Rob Falck