<p>Scaling pseudospectral optimal control problems is tricky.  If you can get a copy of John Betts' <a href="https://epubs.siam.org/doi/book/10.1137/1.9780898718577?mobileUi=0" rel="nofollow noreferrer">Practical Methods for Optimal Control and Estimation Using Nonlinear Programming</a>, I highly recommend it.  Betts suggest using the same scaling for both the state design variable values and the defects.  This is often a good rule of thumb, but as with most approaches to scaling, isn't universal.  The collocation &quot;defects&quot; which dictate whether the dynamics are physically correct are just the difference between the slope of the approximating polynomial and the computed equations of motion.</p>
<p>In situations where state values are large but tiny rates of change are significant, then different scaling is warranted in my experience.  Examples of states where these can be true are aircraft range or spacecraft orbital elements. Just recently we had a situation where a low-thrust orbit transfer of spacecraft wasn't matching physics.  The semi-latus rectum, for instance, is typically measured in km, so on the scale of thousands when in Earth orbit).  In the units being used, a &quot;significant&quot; difference in the defect was less than 1E-6 (the threshold for feasibility being used).  In this case, the problem was solved by bumping the defect_scaler up a few orders of magnitude (equivalent to bumping the defect_ref down a few orders of magnitude).</p>
<p>I'd also recommend <a href="https://arxiv.org/pdf/1810.11073.pdf" rel="nofollow noreferrer">this paper from Ross, Gong, Karpenko, and Proulx</a>.  It lays out some good rules of thumb and has an approachable example in the brachistochrone.  It references costates a lot.  Dymos doesn't provide automatic costate estimation yet, but they are closely related to the lagrange multipliers of the problem, which are printed in the pyoptsparse output if you use SNOPT.</p>
<p>The github repo you pointed out was the work of an intern and was based around this <a href="https://elib.dlr.de/93327/1/Performance_analysis_of_linear_and_nonlinear_techniques.pdf" rel="nofollow noreferrer">scaling method developed by Sagliano</a>.  We found it to work well in a many situations, but it's also not a panacea.</p>
<p>Ultimately we want some automatic scaling options in Dymos and/or OpenMDAO, but we're not sure when they might find their way into the framework.  Our past work has typically tied scaling approaches more tightly to the equations of motion, and Dymos is designed to be more general in that the user can supply whatever EOM they choose.</p>
OpenMDAO Dymos defect_refs -- how should I set these?
<p>I was hoping to get some information on how to set my defect refs in Dymos a smart way. I found the following notes on scaling here <a href="https://github.com/hweyandtnasa/scaling-tutorial" rel="nofollow noreferrer">https://github.com/hweyandtnasa/scaling-tutorial</a> but it lists defect scaling in Dymos as a TODO still. Should I just set them equal to the ref value for the state they pertain to?</p>