Redistribute operation models#104
Open
acostarelli wants to merge 5 commits into
Open
Conversation
IOM is meant to be a domain-neutral optimization-modeling library. This
removes the power-flavoured problem-type chain (DecisionProblem,
EmulationProblem, DefaultDecisionProblem, DefaultEmulationProblem,
GenericOpProblem, GenericEmulationProblem) and the five Simulation*
placeholder types that were stubs for PowerSimulations.jl.
In their place IOM gains a single abstract type:
abstract type AbstractOptimizationProblem end
DecisionModel and EmulationModel are re-parameterized over it, retaining
their phantom {M} parameter so POM-side dispatch on concrete problem tags
keeps working. IOM-side methods (get_problem_type, get_current_time,
init_model_store_params!, OptimizationProblemOutputs constructors,
error-stub validate_template) are re-rooted on the new abstract.
validate_time_series! becomes an extension-point stub (function declaration
with no methods); POM provides concrete methods on its own problem-type
chain. Outer constructors that call finalize_template! and the
EmulationModel update_parameters!/update_model!/update_parameter_values!
chain move to POM, where they belong.
Base.show methods for the removed Simulation* placeholders are deleted
from print_pt_v3.jl; the ProblemOutputsTypes union is collapsed to
OptimizationProblemOutputs.
Verified: 1144/1144 unit tests pass, plus 10/10 Aqua quality checks.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The EmulationModel struct previously carried an explicit inner constructor
that called finalize_template! — a POM-side function. That left
power-flavoured construction logic in IOM, inconsistent with how
DecisionModel handled it (no inner constructor; all construction logic in
outer methods that moved to POM in the prior commit).
Drop the inner constructor, leaving the auto-generated default
EmulationModel{M}(name, template, sys, internal, simulation_info, store,
ext) constructor. POM's Settings-taking outer constructor will do the
finalize_template!/OptimizationContainer/validate_time_series! work and
call the auto-default to construct the model.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
OperationModel was IOM's abstract supertype for DecisionModel and
EmulationModel. The "Operation" prefix carried unnecessary power-domain
flavor for what is a fully generic wrapper-level abstraction in IOM —
it describes "any optimization-model wrapper" with no domain commitment.
Rename it to AbstractOptimizationModel:
- Follows the Julia Abstract* convention (consistent with the
AbstractOptimizationProblem introduced in the prior commit).
- Removes the residual "Operation" naming from IOM.
- Reads correctly: DecisionModel/EmulationModel are concrete
optimization models, and their supertype names that role generically.
All 14 affected IOM files updated (struct supertypes, method dispatches
on the abstract type, module export). 1144/1144 unit tests pass plus
10/10 Aqua checks.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The Settings-taking, kwargs, and type-first constructors for DecisionModel
and EmulationModel are not power-specific — their bodies use only IOM
types and IOM-declared extension points (finalize_template! and
validate_time_series!). The only thing tying them to POM in the prior
commit was the `where {M <: AbstractPowerDecisionProblem}` constraint.
Move all six generic constructors (3 for DecisionModel, 3 for
EmulationModel) back to IOM, parameterized on
`<: AbstractOptimizationProblem`. The construction path is now:
1. User calls DecisionModel{MyProblem}(template, sys; horizon, ...)
2. IOM kwargs constructor builds Settings, delegates to Settings-taking
3. IOM Settings-taking constructor finalizes the template, builds the
OptimizationContainer, calls validate_time_series!
4. finalize_template! and validate_time_series! dispatch to whichever
domain library (POM, hypothetical GasOperationsModels, etc.) has
supplied methods for the concrete template/model types.
POM keeps only:
- The default-tag convenience constructor that picks
GenericPowerDecisionProblem/GenericPowerEmulationProblem
- The bare-system error stub for DefaultPowerDecisionProblem
- All the build/solve/run/reset dispatches on AbstractPower* types
- validate_template and validate_time_series! method implementations
Net effect: future domain libraries get the construction path for free
by defining their template type, implementing finalize_template! and
validate_time_series! for it, and optionally a default-tag convenience.
IOM unit tests: 1144/1144 pass, plus 10/10 Aqua checks.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
acostarelli
commented
May 20, 2026
| solver/model settings, builds a `Settings`, and delegates to the | ||
| settings-taking constructor. | ||
| """ | ||
| function DecisionModel{M}( |
Member
Author
There was a problem hiding this comment.
@jd-lara What do you think about keeping the constructors here?
Contributor
|
Performance Results This branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.