Partitions with varying durations#97
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends partition_duration to support varying partition durations by accepting time profiles (e.g., PartitionProfile, StrategicProfile) rather than only a fixed scalar duration, enabling irregular time structures (e.g., peak day + regular week) to define non-uniform partitioning.
Changes:
- Generalized
PartitionDurationIteratorto store aTimeProfileof durations and query per-partition duration via profile indexing. - Moved
PeriodPartition/partition-indexing traits intostructures.jland adjusted module include order to ensure profile types are available to utilities. - Updated/expanded partition-related tests, including new coverage for vector- and
TimeProfile-based partition durations.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| test/runtests.jl | Refactors partition tests into nested @testsets and adds vector/profile-based duration cases. |
| src/utils.jl | Updates PartitionDurationIterator to accept TimeProfile durations and uses profile indexing during iteration. |
| src/TimeStruct.jl | Reorders includes so profiles.jl loads before utils.jl. |
| src/structures.jl | Relocates PeriodPartition and partition-indexing traits to be available before profiles/utilities. |
| src/partitions/strat_periods.jl | Updates eltype dispatch for the new PartitionDurationIterator type parameters. |
| src/partitions/rep_periods.jl | Updates eltype dispatch for the new PartitionDurationIterator type parameters. |
| src/partitions/opscenarios.jl | Updates eltype dispatch for the new PartitionDurationIterator type parameters. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Overall the design looks good to me. I am a bit unsure about the use of NTuple{N,T} in the partitions as it may cause some type instability in the iterator (varying N). A Vector{T} may be an alternative to have type stability, but on the other hand cause more memory allocation problems. Maybe not a problem, but maybe worth thinking about.
The I will move to |
#95 introduced partitions based on durations for time periods. While the approach is satisfactory, it may be beneficial to provide varying partition durations when, e.g., the time structure is not regular. An example is the following time structure
where we utilize a peak day an a regular week.
This PR allows now the introduction of time profiles for specifying varying durations. This allows variations on the strategic, representative, operational scenario, and partition level.