Skip to content

Fix - Saving of period partitions - #16

Merged
JulStraus merged 10 commits into
mainfrom
fix/results_partitions
Oct 6, 2026
Merged

JulStraus merged 10 commits into
mainfrom
fix/results_partitions

Conversation

@JulStraus

Copy link
Copy Markdown
Member

As outlined in #15, variables indexed over PeriodPartitions resulted in errors in the results saving routine as the method original was not defined for PeriodPartition.

This PR adds a mapping between the receding horizon partitions and the original partitions to the UpdateCase. The mapping is stored per element and rebuilt in every horizon, in both the standard and the POIExt implementation. Results are now extracted for partitions inside the implementation horizon and are indexed by the original partitions.

Requirement: a partition-indexed variable must have its element as the first index (m[:var][x, t_pd]). This cannot be avoided.

The PR was heavily created by Claude although I reviewed all changes in each individual step.

Note

I used it also to slightly restructure the file which can serve as a basis for the updating of the UpdateCase as outlined in #14.

JulStraus and others added 9 commits September 30, 2026 12:24
* Store the mapping between receding horizon and original `PeriodPartition`s under `:partitions`
* Rebuild the mapping in every horizon in the standard and the `POIExt` implementation
* Extend `original` and `updated` to `PeriodPartition`

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* Restrict partition index sets to the partitions fully included in the implementation horizon
* Identify time period and partition index sets for both dense and sparse containers

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* Move the `CapDirect` link with period partitions to `test/utils.jl`
* Use `CapDirect` in the `Result containers` case and test the partition mapping and extraction
* Test the extracted partition variable in the full `POIExt` run

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* Added release notes entry
* Described the partition mapping and result extraction in the developer notes
* Added the new mapping functions to the internal library reference

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* Add horizon lengths and an optional second `CapDirect` link to `create_poi_case`
* Test in `Full model run` that each link is indexed by its own original partitions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Index `:partitions` in `map_org` by the updated and in `map_updated` by the original element
* Add three argument `original`/`updated` for `PeriodPartition` with fallback to two arguments
* Map results row-wise in `update_results!` using the first index as element

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Identify the type of the index sets of a `SparseAxisArray` through its first key
* Only collect the unique keys of index sets over period partitions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JulStraus JulStraus added the bug Something isn't working label Oct 5, 2026
@JulStraus
JulStraus requested a review from lfbernardino October 5, 2026 08:26

@lfbernardino lfbernardino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks good. The re-organization to have mapping as a separate file is welcome, as we start to have quite a few functionalities there.

Remember to update NEWS.md for merging :)

@JulStraus JulStraus changed the title Fix/results partitions Fix - Saving of period partitions Oct 6, 2026
@JulStraus
JulStraus merged commit 04f8fb7 into main Oct 6, 2026
5 checks passed
@JulStraus
JulStraus deleted the fix/results_partitions branch October 6, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants