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

More flexible Model with StructOfConstraints #1267

Merged
merged 4 commits into from
Mar 17, 2021
Merged

Conversation

blegat
Copy link
Member

@blegat blegat commented Mar 5, 2021

This refactors the code of AbstractModel to make it more versatile.
Instead of having one field for each function type which contains a struct with one field for each set type, it now has a field constraints that contains one field for each function type, ...
As discussed in #1261, by changing the type of the constraints field, we can now target many more types of models.

The base is set to #1245 so that it shows the diff with that PR but this is going to be merged to master once #1245 is merged.

  • Add an option to hardcode the type of the fields in StructOfConstraints instead of adding them as type parameter as otherwise the type can be huge. This option will be used by @model.
  • If there is only one function or only one set, drop the corresponding layer of StructOfConstraint
  • Docs
  • Tests

@blegat blegat force-pushed the bl/struct_of_constraints branch 3 times, most recently from 86eabef to 72eeb41 Compare March 8, 2021 13:45
@blegat blegat mentioned this pull request Mar 9, 2021
7 tasks
Base automatically changed from bl/vector_of_constraints to master March 11, 2021 08:20
@blegat blegat requested a review from odow March 12, 2021 22:26
Copy link
Member

@odow odow left a comment

Choose a reason for hiding this comment

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

Do we have some benchmarks for obvious performance regressions?

docs/src/submodules/Utilities/overview.md Show resolved Hide resolved
src/Utilities/model.jl Outdated Show resolved Hide resolved
src/Utilities/model.jl Show resolved Hide resolved
@blegat blegat mentioned this pull request Mar 14, 2021
Copy link
Member

@odow odow left a comment

Choose a reason for hiding this comment

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

I ran the benchmarks. They're slightly slower, but I can tidy up after you've finished making large changes. It's probably just the precompile statements that need tweaking.

@blegat blegat merged commit 70b33f4 into master Mar 17, 2021
@blegat blegat deleted the bl/struct_of_constraints branch March 17, 2021 08:25
@blegat blegat added this to the v0.9.21 milestone May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants