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 model building function for simplicity #117

Closed
danielolsen opened this issue Mar 4, 2021 · 1 comment · Fixed by #142
Closed

Refactor model building function for simplicity #117

danielolsen opened this issue Mar 4, 2021 · 1 comment · Fixed by #142
Assignees

Comments

@danielolsen
Copy link
Contributor

Currently, the _build_model function is ~260 lines, about half of which is the building of constraints. We should be able to reduce the complexity of this function by creating smaller functions to add each constraint, or each family of constraints, to keep _build_model to a more reasonable size.

An attempt was made in an old branch (see the last 6 commits of https://github.com/Breakthrough-Energy/REISE.jl/commits/constraint_functions) but it's pretty out of date, so we should probably start fresh and make better use of our Sets struct.

@danielolsen
Copy link
Contributor Author

Another take on refactoring has gotten started in the daniel/constraint_functions branch. We make use of the JuMP syntax model[:foo] to access the variable or contraint (or array of variables/contraints) named foo that was defined in the model object. This way, we can simplify passing the model object back and forth, and don't have to manually plumb the foo references that get created in the _build_model namespace.

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