Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: major cleanup of *Problem construction #3121

Merged
merged 7 commits into from
Oct 16, 2024

Conversation

AayushSabharwal
Copy link
Member

Close #3044

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

@AayushSabharwal AayushSabharwal marked this pull request as ready for review October 14, 2024 15:11
@AayushSabharwal AayushSabharwal force-pushed the as/cleanup branch 2 times, most recently from 34a8c8e to a41dca2 Compare October 15, 2024 05:50
@isaacsas
Copy link
Member

Is there a reason JumpProblem / DiscreteProblem over JumpSystems are excluded?

@AayushSabharwal
Copy link
Member Author

No, I just missed it. Will include them as well.

@isaacsas
Copy link
Member

Thanks!

@AayushSabharwal
Copy link
Member Author

Extensions failure is an Enzyme bug

@@ -37,7 +37,7 @@ function generate_initializesystem(sys::ODESystem;
# set dummy derivatives to default_dd_guess unless specified
push!(defs, x[1] => get(guesses, x[1], default_dd_guess))
end
for (y, x) in u0map
function process_u0map_with_dummysubs(y, x)
Copy link
Member

Choose a reason for hiding this comment

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

why create a closure?

Copy link
Member Author

Choose a reason for hiding this comment

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

It reduces code duplication, since array symbolics need to be treated as arrays of scalars below

- `allow_symbolic` allows the returned array to contain symbolic values. If this is `true`,
`promotetoconcrete` is set to `false`.
"""
function better_varmap_to_vars(varmap::AbstractDict, vars::Vector;
Copy link
Member

Choose a reason for hiding this comment

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

why is this not just varmap to vars?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because varmap_to_vars is public API, so I can't change it. This does less than what varmap_to_vars does.

Copy link
Member

Choose a reason for hiding this comment

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

deprecate the old varmap to vars?

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to have an equivalent for people to use, which we don't (at least, not a single function that does everything)

Copy link
Member Author

Choose a reason for hiding this comment

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

I can look into writing varmap_to_vars in terms of the new infrastructure

@ChrisRackauckas ChrisRackauckas merged commit d838bbf into SciML:master Oct 16, 2024
20 of 25 checks passed
@AayushSabharwal AayushSabharwal deleted the as/cleanup branch October 16, 2024 13:12
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.

Constants Not Mapped to Defaults
3 participants