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 the model #701

Open
4 of 28 tasks
clizbe opened this issue Jul 29, 2024 Discussed in #688 · 2 comments
Open
4 of 28 tasks

Refactor the model #701

clizbe opened this issue Jul 29, 2024 Discussed in #688 · 2 comments
Labels
Type: epic Epic issues (collection of smaller tasks towards a goal)
Milestone

Comments

@clizbe
Copy link
Member

clizbe commented Jul 29, 2024

Discussed in #688

Originally posted by datejada July 1, 2024

Input data names

create_input_dataframes

  • Verify if we can use only one df (without using a dict) for assets_profiles and assets_timeframe_profiles (better after having a pipeline with timeframe); have a pipeline example before changing that.
  • table_tree stores all the data in dfs

create_internal_structures

compute_assets_partitions

  • Update compute_assets_partitions! to use DuckDB more efficiently
    • To compute the partitions of timeframe. It should be possible to use a join or similar

compute_constraints_partitions

compute_rp_partitions

  • This function needs a full refactor when changing to table (DuckDB)
    • Big change

solve_model and solve_model!

  • Return tables (a.k.a. DuckDB) or dataframes as the output format #115
    • Store the solution into tables (a.k.a. DuckDB) instead of the structure solution and the graph.
    • Clean the solution structure to (maybe?) don't store any vector/array (only keep objective function and some extra info). Even delete it?
    • Create a new table for the investments (assets, and flows)

create_model

  • When using tables the filters will be on the tables not in the graph
  • add_expression_terms_intra_rp_contraints will need a refactor, and it will determine changes we need before and after
  • Notes on code structure:
    • constraints partition: lowest/highest -> to get the correct partition;
    • sum of workspace expressions: sum/unique -> to get the correct expression
    • profile_aggregation functions are in the table in the documentation

AND THEN:

  • Rename input data to make more sense
    • How to include Multi-Year?
  • Separate the model data from the scenario data. The scenario data for multi-year is currently hard-coded in create_model!, this needs to be generalized and relocated (see Create model discount parameters #803).
@clizbe clizbe added the Type: epic Epic issues (collection of smaller tasks towards a goal) label Jul 29, 2024
@clizbe clizbe added this to the M3 - End Sept milestone Jul 29, 2024
@clizbe clizbe changed the title Results and comments on the TulipaEnergyModel code review Refactor the model Jul 29, 2024
@clizbe
Copy link
Member Author

clizbe commented Jul 31, 2024

solve_model and solve_model!

  • Store the solution into tables (a.k.a. DuckDB) instead of the structure solution and the graph.

@abelsiqueira @datejada Can I try tackling this one? Or should I wait?

@abelsiqueira
Copy link
Member

@clizbe you can do it, it's mostly independent from the rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: epic Epic issues (collection of smaller tasks towards a goal)
Projects
None yet
Development

No branches or pull requests

3 participants