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

Add Model.initialize #212

Merged
merged 22 commits into from
Feb 27, 2020
Merged

Add Model.initialize #212

merged 22 commits into from
Feb 27, 2020

Conversation

khaeru
Copy link
Member

@khaeru khaeru commented Nov 21, 2019

In iiasa/message_ix#190, @behnam-zakeri and I add a method named initialize() to the MESSAGE class (subclass of ixmp.Model), that adds some ixmp items (sets and parameters) to a new or existing Scenario.

This PR adds this functionality in ixmp and integrates it with the core classes, so that 'blank' scenarios can be automatically populated with the correct items. This will be one piece for addressing iiasa/message_ix#254.

How to review

  • Start by reading test_model.test_model_initialize().
  • Look at the:
    • Documentation for base.Model.initialize() and .initialize_items().
    • Concrete implementation in DantzigModel and changes to testing.make_dantzig().
    • New method ixmp.utils.update_par().
  • FYI many of the files changed are tests that are simplified. Since DantzigModel is now used in many places, and it knows where to find its own GAMS code, the test functions no longer need to provide the location to the solve() method.

PR checklist

  • Convert testing.make_dantzig to a new Model subclass.
  • Integrate Model.initialize with Scenario.__init__().
  • Tests added.
  • Documentation added.
  • Release notes updated.

@khaeru khaeru added the enh New features & functionality label Nov 21, 2019
@khaeru khaeru self-assigned this Nov 21, 2019
@gidden
Copy link
Member

gidden commented Jan 8, 2020

Short look over the implemented code + design, and it looks great! Really nice addition @khaeru

@khaeru
Copy link
Member Author

khaeru commented Jan 14, 2020

Rebased after the 2.0 release.

@khaeru
Copy link
Member Author

khaeru commented Feb 9, 2020

@behnam-zakeri since this will supersede pieces of iiasa/message_ix#190 and iiasa/message_ix#265, I've asked for your review here of the new code. Please have a read through and let's chat to address any questions or notes that you have.

@behnam-zakeri
Copy link
Contributor

Thanks a lot @khaeru for this. Conceptually I agree it's a nice development. Before going through the code, do you think if it's better to rebase those PRs you mentioned and then adjust the relevant part of code to accommodate the new changes?

@khaeru
Copy link
Member Author

khaeru commented Feb 17, 2020

do you think if it's better to rebase those PRs you mentioned and then adjust the relevant part of code to accommodate the new changes?

Since this has been open almost 3 months, I would prefer to merge it as-is, and then maybe make (a) separate, smaller PR(s), for any necessary changes that come up when refactoring those message_ix PRs.

However, if there's any obvious fix that occurs to you while going through, then please mention and I can quickly add it on this branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enh New features & functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants