Skip to content

Redistribute operation models#104

Open
acostarelli wants to merge 5 commits into
mainfrom
ac/move_op
Open

Redistribute operation models#104
acostarelli wants to merge 5 commits into
mainfrom
ac/move_op

Conversation

@acostarelli
Copy link
Copy Markdown
Member

No description provided.

Anthony Costarelli and others added 5 commits May 20, 2026 11:28
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 acostarelli requested a review from jd-lara May 20, 2026 17:50
solver/model settings, builds a `Settings`, and delegates to the
settings-taking constructor.
"""
function DecisionModel{M}(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jd-lara What do you think about keeping the constructors here?

@github-actions
Copy link
Copy Markdown
Contributor

Performance Results
Main

This branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants