OpenMDAO / dymos

Open Source Optimization of Dynamic Multidisciplinary Systems
Apache License 2.0
210 stars 67 forks source link

Provide aliases for some methods #1048

Closed johnjasa closed 4 months ago

johnjasa commented 8 months ago

Proposed feature.

Sometimes methods refer to time when really it might be a different integration variable.

While dymos currently allows time to be renamed, the API methods themselves still refer to the integration variable as time.

Dymos will support set_integ_var_options as an alias for set_time_options. And phase.integ_var_options will be an alias for phase.time_options.

Slack convo for context:

johnjasa Carl had a reasonable question, mostly about how "time" in Dymos can be other integration variables. Look here for more context: https://github.com/OpenMDAO/Aviary/pull/153#discussion_r1513664895 Have you given any thought to changing things like set_time_options to set_integration_variable_options or something similarly generic? It makes things feel a bit clunkier but maybe more clear. Or maybe this is too much of an edge case?

rfalck Maybe we alias indep_var_options to time_options I think I understand. We can rename the variable, but you think its confusing to refer to it as time in the API I can get behind aliasing it so that time_options = integration_var_options With corresponding changes to set_time_options

we use time internally and I'm sort of unwilling to change all of that stuff internally, but just having method/property aliases might help not that we can't change it internally, it's just a lot of change for syntactic sugar

Example

No response

robfalck commented 8 months ago

@johnjasa In TimeOptionsDictionary we currently have targets, t_initial targets, t_duration targets, and time_phase_targets. The first 3 I think are fine but the 4th might confuse users. Conversely, it's also pretty rare that it's used so maybe it's not an issue to change it. Thoughts?

johnjasa commented 8 months ago

I agree. It's easier to think of t as the integration variable, not necessarily time, so those t_initial and t_duration aren't necessarily confusing. I haven't used time_phase_targets myself, I don't think. No strong preferences, if I had to pick I'd say change it to match the other changes to integration_variable or whatever we choose.