\(\Psi\)-TaLiRo¶
- staliro.SampleLike = collections.abc.Iterable[float] | numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[typing.Any]]¶
Represent a PEP 604 union type
E.g. for int | str
- class staliro.Sample(values, opts)¶
The set of static and signal inputs to the system.
A sample is constructed from the raw vector of floats generated by the
Optimizer, along with the test options. The options object is used to decompose the vector into the static inputs and the control points for each signal, which are used to construct eachSignalinput.- Parameters:
values (SampleLike) – vector of floating point values
opts (TestOptions) – The options provided to the test
- property signals: Signals¶
The signal inputs to the system as defined by in the
TestOptions.
- property static: OrderedDict[str, float]¶
The static inputs to the system as defined in the
TestOptions.
- class staliro.Result(value, extra)¶
A result value containing additional annotation data.
This class is parameterized by the type variables
CandE, which represent the type of the value and the type of the annotation data respectively.- Parameters:
value (C) – The result value
extra (E) – The annotation data value
- class staliro.tests.Run(result, evaluations)¶
The result of an optimization attempt.
- Parameters:
result (R) – The value returned by the optimizer at exit
evaluations (list[Evaluation[C, E]]) – The set of samples and their associated costs evaluated during the run
- staliro.staliro(model: Model[S, E1], specification: Specification[S, C, E2], optimizer: Optimizer[C, R], options: TestOptions, *, processes: Literal['cores', 'all'] | int | None = None) list[Run[R, C, ModelSpecExtra[S, E1, E2]]]¶
- staliro.staliro(cost_fn: CostFunc[C, E], optimizer: Optimizer[C, R], options: TestOptions, /, *, processes: Literal['cores', 'all'] | int | None = None) list[Run[R, C, E]]
Run a test using either a
CostFunc, or aModelandSpecification.- Parameters:
model (Model[S, E1] | CostFunc[C, E]) – The model or cost function to use to evaluate samples.
specification (Specification[S, C, E2] | Optimizer[C, R]) – The specification to compose with the model, or the
Optimizerto use to generate samples.optimizer (Optimizer[C, R] | TestOptions) – The optimizer to use to generate samples or the test options
options (TestOptions | None) – The test options if a model/specification composition was used
processes (Literal['cores', 'all'] | int | None)
- Returns:
A list of
Runvalues containing the data for each optimization attempt- Raises:
AssertionError – If provided incorrect types to any parameter
- Return type:
list[Run[R, C, ModelSpecExtra[S, E1, E2]]] | list[Run[R, C, E]]