\(\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 each Signal input.

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.

property values: list[float]

The raw numeric values received from the Optimizer.

class staliro.Result(value, extra)

A result value containing additional annotation data.

This class is parameterized by the type variables C and E, 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 a Model and Specification.

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 Optimizer to 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 Run values 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]]