Skip to content

Conversation

robfalck
Copy link
Contributor

Summary

Added new option to Phase: auto_add_parameters

This currently defaults to False as it is still experimental.

If it is True, then Dymos will determine those inputs in the ODE that are not otherwise connected via promotion or manual connections, and create corresponding parameters for them.

If an unconnected input is not promoted to the top of the ODE, the corresponding parameter name will just be the name of the variable itself. For example, a variable at a path 'aircraft.wing.mass' within the ODE hierarchy will just have the parameter name 'mass'.

If two variables within the ODE share the same local name, dymos will work backwards through the dotted path and replace dots with underscores, until a unique name is found.

For instance, if the ODE contained paths: 'aircraft.wing.mass' and 'aircraft.landing_gear.mass', the added parameters would have names 'wing_mass' and 'landing_gear_mass', respectively.

Related Issues

Backwards incompatibilities

None

New Dependencies

None

@coveralls
Copy link

Coverage Status

coverage: 93.551% (-0.03%) from 93.585%
when pulling f3dbdcf on robfalck:auto_params3
into 7026cf5 on OpenMDAO:master.

self.options.declare('boundary_balance_options', types=dict, default={},
desc='Options specifying boundary conditions to be satisfied with a solver.')
self.options.declare('auto_add_parameters', types=bool, default=False,
desc='If True, add any otherwise-unconnected ODE inputs add non-optimal parameters.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo? 'add non-optimal parameters' --> 'as non-optimal parameters'

# Add the remaining unconnected inputs as parameters
for inp in unconn_inputs:
if '.' in inp:
# Handle parameters nested in the ODE
Copy link
Member

@Kenneth-T-Moore Kenneth-T-Moore Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have an input rhs_all.a.b.c that isn't promoted, isn't this code just going to add a parameter for "c"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatic Parameters
4 participants