Repository navigation
Conversation
jetuk
force-pushed
the
variable-config
branch
from
October 14, 2026 18:53
16631d6 to
2f175d5
Compare
jetuk
force-pushed
the
variable-config
branch
2 times, most recently
from
November 4, 2026 00:02
47e87b5 to
d745186
Compare
Allow parts of a model to be made variable, and outputs to be used as objectives and constraints, for use with external optimisation algorithms such as multi-objective evolutionary algorithms. Core: - `VariableParameter` trait, implemented by the Constant, Offset, MonthlyProfile and RbfProfile parameters, with config validation, f64 and u64 values, and bounds. - The day of year bounds of RbfProfile points are capped at the midpoint to their neighbours, so the ranges do not overlap and any values within the bounds give each point a unique day of year. - `NetworkVariableConfig` and its builder define which parameters are variable, in order, and validate each config when it is added. - Variable values are applied during network setup, before constant parameters are computed (`Model::setup_with_variables` and `Model::run_with_variables`). - `ModelProblem` and `ModelProblemBuilder` combine a model, its variables, and objectives and constraints given by the aggregated values of recorders. `ModelProblem::evaluate` runs the model and returns the objective and constraint values; it is `Send + Sync` so evaluations can run in parallel. - Remove the unused per-parameter variable methods from `Network`. Schema: - `ProblemConfig` defines the variables, objectives and constraints in a file separate from the model, and builds a `ModelProblem`. Python: - `ProblemConfig`, `ModelSchema.build_problem`, `ModelProblem` (with `evaluate` and parallel `evaluate_batch`) and `Evaluation`, with `ProblemBuildError` and `ProblemEvaluateError` exceptions. Docs: - Add an "Optimisation" page to the book with a random search example. BREAKING CHANGE: The `variable` field is removed from the `Constant`, `Offset` and `RbfProfile` parameters in the schema. Models that set it will no longer load; define variables in a separate `ProblemConfig` instead. `RbfProfileVariableSettings` is renamed to `RbfProfileVariableConfig`, its `is_active` field is removed, and `value_upper_bounds` is now required.
jetuk
force-pushed
the
variable-config
branch
from
November 4, 2026 00:19
d745186 to
d20f2e6
Compare
jetuk
marked this pull request as ready for review
November 4, 2026 00:20
This branch has not been deployed
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.
Allow parts of a model to be made variable, and outputs to be used as
objectives and constraints, for use with external optimisation
algorithms such as multi-objective evolutionary algorithms.
Core:
VariableParametertrait, implemented by the Constant, Offset,MonthlyProfile and RbfProfile parameters, with config validation,
f64 and u64 values, and bounds.
midpoint to their neighbours, so the ranges do not overlap and any
values within the bounds give each point a unique day of year.
NetworkVariableConfigand its builder define which parameters arevariable, in order, and validate each config when it is added.
parameters are computed (
Model::setup_with_variablesandModel::run_with_variables).ModelProblemandModelProblemBuildercombine a model, itsvariables, and objectives and constraints given by the aggregated
values of recorders.
ModelProblem::evaluateruns the model andreturns the objective and constraint values; it is
Send + Syncsoevaluations can run in parallel.
Network.Schema:
ProblemConfigdefines the variables, objectives and constraints ina file separate from the model, and builds a
ModelProblem.Python:
ProblemConfig,ModelSchema.build_problem,ModelProblem(withevaluateand parallelevaluate_batch) andEvaluation, withProblemBuildErrorandProblemEvaluateErrorexceptions.Docs:
BREAKING CHANGE: The
variablefield is removed from theConstant,OffsetandRbfProfileparameters in the schema. Models that set itwill no longer load; define variables in a separate
ProblemConfiginstead.
RbfProfileVariableSettingsis renamed toRbfProfileVariableConfig, itsis_activefield is removed, andvalue_upper_boundsis now required.