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

Set slacks to zero #117

Merged
merged 14 commits into from
Apr 21, 2022
Merged

Set slacks to zero #117

merged 14 commits into from
Apr 21, 2022

Conversation

Andresj89
Copy link
Contributor

@Andresj89 Andresj89 commented Apr 6, 2022

Fixes/Addresses/Summary/Motivation:

This PR adds a method to set slacks to zero for the strategic model. The method checks if the termination condition of the solver is unfeasible, in that case the slacks are activated and the model is run again.

Changes proposed in this PR:

  • The run_strategic_model.py has been simplified. It now contains call to the method solve_model(model, options) which receives a model object and a dictionary with the following options:
options = {
    "deactivate_slacks": True,
    "scale_model": True,
    "scaling_factor": 1000000,
    "running_time": 60,
    "gap": 0,
    "water_quality" True}
  • I modified create_model() slightly to "attach" df_sets and df_parameters to the model object so we don't have to pass those in as part of the postprocess_water_quality_calculation(model, opt).

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my
contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.md file
    at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has
    rights to intellectual property that includes these contributions, I represent that I have
    received permission to make contributions and grant the required license on behalf of that
    employer.

@Andresj89 Andresj89 added enhancement New feature or request Priority:Normal Normal Priority Issue or PR labels Apr 6, 2022
@Andresj89 Andresj89 self-assigned this Apr 6, 2022
@Andresj89 Andresj89 requested a review from RuudWag April 6, 2022 16:48
Copy link
Contributor

@melody-shellman melody-shellman left a comment

Choose a reason for hiding this comment

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

Overall looks good. I like this new restructuring of code, it is definitely cleaner. I ran the code with our four modes (capacity vs distance, input vs calculated) and all outputs looked good! Only change suggested is to remove df_parameters as an input to _preprocess_data (line 5212), similar to the other methods.

@ksbeattie ksbeattie added Priority:High High Priority Issue or PR and removed Priority:Normal Normal Priority Issue or PR labels Apr 12, 2022
NienkeWagenaar
NienkeWagenaar previously approved these changes Apr 15, 2022
@NienkeWagenaar
Copy link
Collaborator

I removed two other unused imports. Other than that it looks good!

Copy link
Contributor

@melody-shellman melody-shellman left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for implementing those suggestions!

Copy link
Contributor

@melody-shellman melody-shellman left a comment

Choose a reason for hiding this comment

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

Looks good, runs as expected.

Copy link
Collaborator

@NienkeWagenaar NienkeWagenaar left a comment

Choose a reason for hiding this comment

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

Looks great!

@Andresj89 Andresj89 merged commit aafa060 into project-pareto:main Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Priority:High High Priority Issue or PR
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants