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

Feature: allow for complete math overrides #606

Closed
irm-codebase opened this issue Jun 17, 2024 · 6 comments
Closed

Feature: allow for complete math overrides #606

irm-codebase opened this issue Jun 17, 2024 · 6 comments
Assignees
Labels
enhancement v0.7 (upcoming) version 0.7
Milestone

Comments

@irm-codebase
Copy link
Contributor

irm-codebase commented Jun 17, 2024

What can be improved?

As of now, builds custom math "on top" of the pre-defined math.

While this is good to simplify the way users interact with Calliope, it introduces problems in cases were the math needs to be heavily modified since users have to essentially look in two different places and are limited by what we put in the base math.

I'd like to propose a simple override were users introduce the "base" math file themselves (with no guarantees from our side).

This would make the library much more flexible, and may even allow others to discover improvements to our base math.

Version

v0.7

@irm-codebase irm-codebase added enhancement v0.7 (upcoming) version 0.7 labels Jun 17, 2024
@irm-codebase irm-codebase self-assigned this Jun 17, 2024
@irm-codebase irm-codebase changed the title Allow for complete math override Feature: allow for complete math overrides Jun 17, 2024
@irm-codebase
Copy link
Contributor Author

To do so, here are the steps I've identified:

  • add config.init.add_schema to allow users to specify additional schema files for their settings. update_model_schema is no longer necessary (but it is optional).
    • To allow this, config.init must be included in the saved model attributes (until now it's excluded).
    • MODEL_SCHEMA is now a model attribute (or is generated from them on-demand). Other schemas remain the same since they target file structure and not parameter defaults.
  • add config.init.base_math, a boolean that makes the model ignore the base math / schema when set to false.
  • move the _add_math step to build, since it is not really necessary for model initialization. This should let users make corrections on the fly without re-initializing model data, or to test the same model data with different math formulations.

The general idea is to let users remove the base math and specify everything on their own, if they choose to do so.

@brynpickering
Copy link
Member

This issue is related to two different things: base math overriding and easier access to the model definition schema.

The model definition schema only controls the definition of parameters, it has no bearing on the math or the config (they are both different schema files). Hence why it isn't really linked to overriding the base math.

@brynpickering
Copy link
Member

The math and config schema should not be user-configurable in any way. Changes to those will likely cause things to break elsewhere.

@irm-codebase
Copy link
Contributor Author

@brynpickering I agree that the config_schema.yaml and math_schema.yaml should not be altered by users. I think the confusion was caused because I'm unfamiliar with the names people often use for things.

This PR is only about model_def_schema.yaml (what you call the model definition schema) and base.yaml.
When it comes to these, I disagree: if you are replacing base.yaml, you should also replace the parameter definitions!

It does not make sense to allow removing the math formulation constraints and still have presets on the parameter side. In reality, users going this way are likely to re-use a lot of it, but it still should be a separate file.

@irm-codebase
Copy link
Contributor Author

I've introduced #609, which only targets skipping base math.
Depending on what is agreed upon, I could work on a separate PR for the add_schema parameter.

@irm-codebase irm-codebase mentioned this issue Jul 18, 2024
4 tasks
@brynpickering brynpickering added this to the 0.7.0 milestone Sep 26, 2024
@brynpickering
Copy link
Member

This was introduce in #639 with the ignore_mode_math config.build option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement v0.7 (upcoming) version 0.7
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants