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

Adjust reference new capacity and activity for soft constraints #474

Merged
merged 13 commits into from
Jul 13, 2021

Conversation

volker-krey
Copy link
Contributor

@volker-krey volker-krey commented May 24, 2021

Adjust reference new capacity and activity for soft constraints. This PR supersedes #393 and includes the GAMS code modifications from that PR.

How to review

  • Read the diff and note that the CI checks all pass.

PR checklist

  • Add or expand tests; coverage checks both ✅
  • Add, expand, or update documentation.
  • Update release notes.

@codecov
Copy link

codecov bot commented May 24, 2021

Codecov Report

Merging #474 (fb5b278) into main (164cb4e) will increase coverage by 0.0%.
The diff coverage is 100.0%.

❗ Current head fb5b278 differs from pull request most recent head ba4254b. Consider uploading reports for the commit ba4254b to get more accurate results

@@          Coverage Diff          @@
##            main    #474   +/-   ##
=====================================
  Coverage   93.3%   93.4%           
=====================================
  Files         37      38    +1     
  Lines       2832    2852   +20     
=====================================
+ Hits        2645    2665   +20     
  Misses       187     187           
Impacted Files Coverage Δ
message_ix/tests/test_tutorials.py 100.0% <ø> (ø)
message_ix/tests/test_soft_constraints.py 100.0% <100.0%> (ø)

@khaeru
Copy link
Member

khaeru commented May 25, 2021

Thanks! If the other PR is superseded, please close it with a comment like “Superseded by #474”.

volker-krey and others added 8 commits June 15, 2021 15:27

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
additional growth in soft constraints of new capacity and activity is now based on previous periods new capacity and activity, respectively, as for the regular growth constraints

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@OFR-IIASA OFR-IIASA force-pushed the soft_constraints_clean branch from 00616d1 to 11e8bd4 Compare June 15, 2021 14:09
@OFR-IIASA
Copy link
Contributor

@volker-krey I have added the required documentation of the GAMS code, added a tutorial on the usage of soft-constraints and I have also added test to ensure the relaxation works as expected. Please have a look and let me know if further adjustments are required.

@OFR-IIASA OFR-IIASA requested a review from danielhuppmann July 7, 2021 09:01
Copy link
Member

@danielhuppmann danielhuppmann left a comment

Choose a reason for hiding this comment

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

The changed implementation of the soft-constraints looks correct to me, and the tutorial is very helpful.

However, I'm a bit worried that the test does not really include any validation of the cost aspects. This creates a risk that at some point, the consideration of soft constraints in a model changes completely without warning.

@OFR-IIASA
Copy link
Contributor

@danielhuppmann and @volker-krey, all the suggestions from Daniel have been incorporated in the revisions I just made. The test example has now been simplified, costs are added and checked based on the COST_NODAL value in addition to the Objective function.

@OFR-IIASA OFR-IIASA force-pushed the soft_constraints_clean branch from 1df18ee to 0e57ff0 Compare July 8, 2021 09:03
@OFR-IIASA OFR-IIASA force-pushed the soft_constraints_clean branch from 0e57ff0 to 5fc853c Compare July 13, 2021 06:43
@OFR-IIASA
Copy link
Contributor

@khaeru and @LauWien rebased, approved, ready to merge unless anything else needs changing?

@LauWien
Copy link
Contributor

LauWien commented Jul 13, 2021

@khaeru and @LauWien rebased, approved, ready to merge unless anything else needs changing?

I'd just run the tests again and then merge it when every test passes, since the two failed tests appear to be flaky.

@OFR-IIASA
Copy link
Contributor

@LauWien all test have passed.

@LauWien LauWien merged commit 6bf19c3 into iiasa:main Jul 13, 2021
awais307 added a commit to awais307/message_ix that referenced this pull request Aug 24, 2021
commit 900a9f8
Author: Laura Wienpahl <57132039+LauWien@users.noreply.github.com>
Date:   Mon Aug 23 14:56:33 2021 +0200

    Update documentation "Common issues" (iiasa#500)

commit 38461e6
Author: Laura Wienpahl <57132039+LauWien@users.noreply.github.com>
Date:   Fri Aug 20 16:04:17 2021 +0200

    Update installation documentation using Anaconda (iiasa#501)

    * Update installation documentation using Anaconda
    * Update conda CI checks accordingly

commit a4ae7ff
Author: OFR-IIASA <fricko@iiasa.ac.at>
Date:   Wed Aug 18 14:09:31 2021 +0200

    Tutorial explaining historical parameters (iiasa#478)

    * Add tutorial for historical parameters
    * Update README
    * Update release notes

commit 65b0767
Author: Laura Wienpahl <laura@wienpahl.de>
Date:   Tue Aug 17 14:04:04 2021 +0200

    Update release notes

commit 44c43d8
Author: Laura Wienpahl <laura@wienpahl.de>
Date:   Tue Aug 17 13:20:55 2021 +0200

    Adjust test suite for pyam v1.1.0 compatibility

commit f94304c
Author: Laura Wienpahl <57132039+LauWien@users.noreply.github.com>
Date:   Tue Jul 20 10:23:28 2021 +0200

    Adjust objective values for nightly test scenarios (iiasa#495)

commit 6d19561
Merge: 6bf19c3 4eaef6f
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Mon Jul 19 16:05:54 2021 +0200

    Merge pull request iiasa#493 from iiasa/misc-2021-W28

    Use np.isscalar; improve contributing.rst

commit 4eaef6f
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Sun Jul 18 15:40:09 2021 +0200

    Update doc/contributing.rst

commit 85d9cb7
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Sun Jul 18 15:20:57 2021 +0200

    Use np.isscalar(), not deprecated ixmp.utils.isscalar

commit 6bf19c3
Merge: 164cb4e ba4254b
Author: Laura Wienpahl <57132039+LauWien@users.noreply.github.com>
Date:   Tue Jul 13 15:54:05 2021 +0200

    Merge pull request iiasa#474 from volker-krey/soft_constraints_clean

    Adjust reference new capacity and activity for soft constraints

commit ba4254b
Author: OFR-IIASA <fricko@iiasa.ac.at>
Date:   Tue Jul 13 09:03:29 2021 +0200

    Update RELEASE_NOTES.rst

commit 7a87538
Author: OFR-IIASA <fricko@iiasa.ac.at>
Date:   Tue Jul 13 09:00:49 2021 +0200

    Update RELEASE_NOTES.rst

commit 440d78c
Merge: 5fc853c 164cb4e
Author: OFR-IIASA <fricko@iiasa.ac.at>
Date:   Tue Jul 13 08:45:53 2021 +0200

    Merge branch 'main' into soft_constraints_clean

commit 164cb4e
Merge: 19eff0f 8849073
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Fri Jul 9 12:35:54 2021 +0200

    Merge pull request iiasa#491 from OFR-IIASA/year_active_fix

    Ensure `years_active()` uses sorted results

commit 8849073
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Fri Jul 9 08:20:26 2021 +0200

    Update release notes based on review comment

commit 73e3c9c
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Mon Jul 5 12:07:21 2021 +0200

    Apply black formatting

commit 9fd6303
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Mon Jul 5 12:05:50 2021 +0200

    Add iiasa#491 to release notes

commit f16b397
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Mon Jul 5 11:55:08 2021 +0200

    Modify years_active function to use sorted results

commit 1889ba2
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Mon Jul 5 11:53:43 2021 +0200

    Add test to ensure years_active uses sorted results

commit 19eff0f
Merge: 56611ad 2df44f8
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Wed Jul 7 15:13:00 2021 +0200

    Merge pull request iiasa#492 from iiasa/hotfix/genno-1.5.1

    Adjust for genno 1.6, pyam 1.0

commit 2df44f8
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Wed Jul 7 14:08:11 2021 +0200

    Add iiasa#492 to release notes

commit a65f1e3
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Wed Jul 7 13:03:31 2021 +0200

    Adjust use of pyam.IamDataFrame.line_plot() → plot()

    Former name was removed in pyam 1.0

commit 8d9ac4d
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Wed Jul 7 12:43:33 2021 +0200

    Git ignore prof/ directory (pytest-profiling)

commit 136add2
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Tue Jul 6 16:32:01 2021 +0200

    Correct a format string in .reporting.computations.plot_cumulative()

commit e96819c
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Tue Jul 6 10:53:39 2021 +0200

    Adjust test_reporter_from_scenario() for genno 1.5

    Use "in rep" not "in rep.graph" for more flexible __contains__.

commit 5fc853c
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Fri Jun 18 08:43:57 2021 +0200

    Descriptions corrected

commit 6d7f44c
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Fri Jun 18 08:41:15 2021 +0200

    Adjusted documentation of revised formulations

commit 11e8bd4
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Tue Jun 15 15:27:23 2021 +0200

    Updated tutorial syntax

commit c15e1ae
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Tue Jun 15 14:56:42 2021 +0200

    Update tutorial descriptions

commit 3e8d9b6
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Tue Jun 15 14:56:10 2021 +0200

    Added tests for soft constraints

commit 339f727
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Tue Jun 15 11:19:55 2021 +0200

    Added tutorial for soft constraints

commit 66fdef7
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Mon Jun 14 12:46:46 2021 +0200

    Updated release notes

commit ff37498
Author: Oliver FRICKO <fricko@iiasa.ac.at>
Date:   Fri Aug 28 16:19:54 2020 +0200

    adjusted the year to check for active technology for soft constraints

commit ecd00d5
Author: Oliver FRICKO <fricko@iiasa.ac.at>
Date:   Fri Aug 28 11:16:01 2020 +0200

    corrections made to GAMS code

commit d86ed88
Author: Volker Krey <krey@iiasa.ac.at>
Date:   Thu Aug 27 14:37:52 2020 +0200

    adjustment of reference new capacity and activity for soft constraints

    additional growth in soft constraints of new capacity and activity is now based on previous periods new capacity and activity, respectively, as for the regular growth constraints

commit 56611ad
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Tue Jun 15 10:46:05 2021 +0200

    Also install 3rd party type stubs in 'lint' CI workflow
@khaeru khaeru added this to the 3.4 milestone Jan 11, 2022
awais307 added a commit to awais307/message_ix that referenced this pull request Aug 1, 2022
commit 900a9f8
Author: Laura Wienpahl <57132039+LauWien@users.noreply.github.com>
Date:   Mon Aug 23 14:56:33 2021 +0200

    Update documentation "Common issues" (iiasa#500)

commit 38461e6
Author: Laura Wienpahl <57132039+LauWien@users.noreply.github.com>
Date:   Fri Aug 20 16:04:17 2021 +0200

    Update installation documentation using Anaconda (iiasa#501)

    * Update installation documentation using Anaconda
    * Update conda CI checks accordingly

commit a4ae7ff
Author: OFR-IIASA <fricko@iiasa.ac.at>
Date:   Wed Aug 18 14:09:31 2021 +0200

    Tutorial explaining historical parameters (iiasa#478)

    * Add tutorial for historical parameters
    * Update README
    * Update release notes

commit 65b0767
Author: Laura Wienpahl <laura@wienpahl.de>
Date:   Tue Aug 17 14:04:04 2021 +0200

    Update release notes

commit 44c43d8
Author: Laura Wienpahl <laura@wienpahl.de>
Date:   Tue Aug 17 13:20:55 2021 +0200

    Adjust test suite for pyam v1.1.0 compatibility

commit f94304c
Author: Laura Wienpahl <57132039+LauWien@users.noreply.github.com>
Date:   Tue Jul 20 10:23:28 2021 +0200

    Adjust objective values for nightly test scenarios (iiasa#495)

commit 6d19561
Merge: 6bf19c3 4eaef6f
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Mon Jul 19 16:05:54 2021 +0200

    Merge pull request iiasa#493 from iiasa/misc-2021-W28

    Use np.isscalar; improve contributing.rst

commit 4eaef6f
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Sun Jul 18 15:40:09 2021 +0200

    Update doc/contributing.rst

commit 85d9cb7
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Sun Jul 18 15:20:57 2021 +0200

    Use np.isscalar(), not deprecated ixmp.utils.isscalar

commit 6bf19c3
Merge: 164cb4e ba4254b
Author: Laura Wienpahl <57132039+LauWien@users.noreply.github.com>
Date:   Tue Jul 13 15:54:05 2021 +0200

    Merge pull request iiasa#474 from volker-krey/soft_constraints_clean

    Adjust reference new capacity and activity for soft constraints

commit ba4254b
Author: OFR-IIASA <fricko@iiasa.ac.at>
Date:   Tue Jul 13 09:03:29 2021 +0200

    Update RELEASE_NOTES.rst

commit 7a87538
Author: OFR-IIASA <fricko@iiasa.ac.at>
Date:   Tue Jul 13 09:00:49 2021 +0200

    Update RELEASE_NOTES.rst

commit 440d78c
Merge: 5fc853c 164cb4e
Author: OFR-IIASA <fricko@iiasa.ac.at>
Date:   Tue Jul 13 08:45:53 2021 +0200

    Merge branch 'main' into soft_constraints_clean

commit 164cb4e
Merge: 19eff0f 8849073
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Fri Jul 9 12:35:54 2021 +0200

    Merge pull request iiasa#491 from OFR-IIASA/year_active_fix

    Ensure `years_active()` uses sorted results

commit 8849073
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Fri Jul 9 08:20:26 2021 +0200

    Update release notes based on review comment

commit 73e3c9c
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Mon Jul 5 12:07:21 2021 +0200

    Apply black formatting

commit 9fd6303
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Mon Jul 5 12:05:50 2021 +0200

    Add iiasa#491 to release notes

commit f16b397
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Mon Jul 5 11:55:08 2021 +0200

    Modify years_active function to use sorted results

commit 1889ba2
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Mon Jul 5 11:53:43 2021 +0200

    Add test to ensure years_active uses sorted results

commit 19eff0f
Merge: 56611ad 2df44f8
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Wed Jul 7 15:13:00 2021 +0200

    Merge pull request iiasa#492 from iiasa/hotfix/genno-1.5.1

    Adjust for genno 1.6, pyam 1.0

commit 2df44f8
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Wed Jul 7 14:08:11 2021 +0200

    Add iiasa#492 to release notes

commit a65f1e3
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Wed Jul 7 13:03:31 2021 +0200

    Adjust use of pyam.IamDataFrame.line_plot() → plot()

    Former name was removed in pyam 1.0

commit 8d9ac4d
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Wed Jul 7 12:43:33 2021 +0200

    Git ignore prof/ directory (pytest-profiling)

commit 136add2
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Tue Jul 6 16:32:01 2021 +0200

    Correct a format string in .reporting.computations.plot_cumulative()

commit e96819c
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Tue Jul 6 10:53:39 2021 +0200

    Adjust test_reporter_from_scenario() for genno 1.5

    Use "in rep" not "in rep.graph" for more flexible __contains__.

commit 5fc853c
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Fri Jun 18 08:43:57 2021 +0200

    Descriptions corrected

commit 6d7f44c
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Fri Jun 18 08:41:15 2021 +0200

    Adjusted documentation of revised formulations

commit 11e8bd4
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Tue Jun 15 15:27:23 2021 +0200

    Updated tutorial syntax

commit c15e1ae
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Tue Jun 15 14:56:42 2021 +0200

    Update tutorial descriptions

commit 3e8d9b6
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Tue Jun 15 14:56:10 2021 +0200

    Added tests for soft constraints

commit 339f727
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Tue Jun 15 11:19:55 2021 +0200

    Added tutorial for soft constraints

commit 66fdef7
Author: FRICKO Oliver <fricko@iiasa.ac.at>
Date:   Mon Jun 14 12:46:46 2021 +0200

    Updated release notes

commit ff37498
Author: Oliver FRICKO <fricko@iiasa.ac.at>
Date:   Fri Aug 28 16:19:54 2020 +0200

    adjusted the year to check for active technology for soft constraints

commit ecd00d5
Author: Oliver FRICKO <fricko@iiasa.ac.at>
Date:   Fri Aug 28 11:16:01 2020 +0200

    corrections made to GAMS code

commit d86ed88
Author: Volker Krey <krey@iiasa.ac.at>
Date:   Thu Aug 27 14:37:52 2020 +0200

    adjustment of reference new capacity and activity for soft constraints

    additional growth in soft constraints of new capacity and activity is now based on previous periods new capacity and activity, respectively, as for the regular growth constraints

commit 56611ad
Author: Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Date:   Tue Jun 15 10:46:05 2021 +0200

    Also install 3rd party type stubs in 'lint' CI workflow
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.

5 participants