Authoring a study
The public API is imported from paretorium. The interface follows the EM.413 pattern: combine discrete options into a concept, evaluate the concept in a scenario using a sample of parameters, and keep the resulting metrics and draws. The framework does not carry over the spacecraft models, two-axis performance/cost restriction, or global random state.
Define a study
Install Paretorium, then create studies/my_study.py in
your project folder. For a guided first run, start with the
tutorial. Use this minimal module as a template:
from paretorium import Metric, Model, Parameter, Port, Study, Triangular
def energy(concept, inputs):
return {"energy": inputs["power"] * inputs["hours"]}
study = Study(
id="energy_example",
parameters=(
Parameter("power", "Equipment power", "W", Triangular(80, 100, 120)),
Parameter("hours", "Run time", "h", 2),
),
models=(
Model(
"calculate_energy",
(Port("power", "W"), Port("hours", "h")),
(Port("energy", "Wh"),),
energy,
),
),
metrics=(Metric("energy", "Wh", objective="min", maximum=220),),
)
python -m paretorium studies.my_study --check
python -m paretorium studies.my_study --samples 100 --seed 42
No decisions produces one baseline concept; no declared scenarios uses one baseline scenario. Use module:attribute if the exported object is not named study. Only run modules you trust: loading a module executes its Python code.
What each interface does
| Interface | What you provide |
|---|---|
Option, Decision, DesignSpace |
Stable option IDs grouped into decisions. Concept picks one option per decision; use concept["decision_id"] inside a model. IDs do not depend on option or decision order. |
CompatibilityRule(id, check, reason) |
A function that returns true if allowed, plus a rejection reason. This is for static architecture compatibility, not uncertain performance. |
Parameter(id, name, units, distribution, …) |
A fixed number or a distribution. Add source notes and optional ParameterCase(when={"decision": "option"}, value=…) overrides. |
Scenario(id, overrides={…}) |
A named set of operating conditions. Overrides use existing parameter IDs and units. They take precedence over one matching parameter case, then the base parameter. Overlapping parameter cases are errors. |
Model(id, inputs, outputs, evaluate, when={…}) |
A function evaluate(concept, inputs) returning a mapping of named numeric outputs, with declared Port(id, units) inputs and outputs. An optional when map activates a model only for matching choices. |
Metric(id, units, objective, minimum, maximum) |
A quantity already produced by a model or parameter. Mark it "min" or "max" for the Pareto comparison; leave the direction unset to just report it or apply limits. |
Study |
The collection of these declarations. validate() checks all compatible graphs; evaluate() runs one named concept/scenario/sample; run() collects a study. |
Models can consume parameters or earlier model outputs by ID. The runner checks for missing producers, duplicate producers, unit mismatches, and cycles, and orders the active models. Names and units must match exactly; use "1" for dimensionless values. No implicit conversion or coupled feedback solving is performed. A model receives only its declared inputs, not the rest of the study state, and must return all and only its declared outputs. Put conversions and any bounded solver inside a model with explicit contracts. Add a model or alternate implementation by changing your study module, not the runner.
Express stakeholder utility
Set Metric.utility to a callable that maps a value in the metric's units
to a score in [0, 1]. The metric still reports its raw engineering
value. The runner does not call the curve automatically or treat its
anchors as feasibility limits.
from paretorium import Metric, Model
from paretorium.utility import LinearUtility, PchipUtility
coverage_curve = LinearUtility(zero_at=3_000, one_at=15_000)
margin_curve = PchipUtility(
points=((0, 0.0), (10, 0.6), (30, 1.0)),
)
area = Metric("delivered_area", "km²/day", minimum=3_000, utility=coverage_curve)
margin = Metric("power_margin", "W", minimum=0, utility=margin_curve)
operations = Metric("operations_value", "1", name="Operations value")
operations_mau = Model(
id="score_operations",
inputs=(area.port(), margin.port()),
outputs=(operations.port(),),
evaluate=lambda _, values: {
operations.id: (
0.30 * coverage_curve(values[area.id])
+ 0.70 * margin_curve(values[margin.id])
)
},
)
The delivered-area minimum is inclusive: 3,000 km²/day meets that hard limit but still scores zero. Lower values also score zero and fail the limit. The two settings are declared separately.
The built-in curves hold their endpoint scores beyond the anchors.
For a decreasing linear curve, put one_at below zero_at.
The example uses
PchipUtility to
smooth the power-margin curve while preserving anchor scores and
monotone segments without overshooting. For straight segments between
the same anchors, use PiecewiseLinearUtility with the same points
argument. They can assign different scores between anchors, so the
choice changes the scoring model, not just the plot. You can also
attach your own callable.
Add the MAU model to Study.models alongside the engineering models
that produce its input ports, and declare its output in Study.metrics
to report it. metric.port() simply copies the metric's ID and units
into a Port; it works for inputs or outputs. Each business case can
have its own MAU model and output metric. Its score is computed for
each draw, before summaries are calculated. To compare it as a Pareto
objective, mark the score metric objective="max" in that comparison.
Combine utilities with a geometric mean
Use a weighted geometric mean
instead of the weighted sum when a low score on one attribute should
pull the overall score down more. In the model above, you could pass
this function as evaluate:
from paretorium.utility import weighted_geometric_mean
def evaluate_operations(_, values):
return {
operations.id: weighted_geometric_mean(
scores=(coverage_curve(values[area.id]), margin_curve(values[margin.id])),
weights=(30, 70),
)
}
The helper normalizes the weights, so (30, 70) and (0.30, 0.70)
are equivalent. A positively weighted zero score makes the result zero;
a zero-weight score contributes nothing. A zero utility does not by
itself violate a hard limit.
Keep utility definitions with the results
CLI JSON contains evaluated scores, not the Python curve callbacks.
Keep the study source with the results. See the
satellite example for two MAUs on the same run, and
utility_curve()
to inspect the SAU functions.
Run and select results
Use --summary-only to omit individual evaluations from the JSON file. Use --statistic p95 or --min-feasibility 0.95 to change the comparison policy. Keep your source revisions and seed with the output. For large runs, use Study.iter_records() and stream records to your own store.
See how evaluation works for how to interpret samples and frontiers, and the API reference for callable contracts.