\(\Psi\)-TaLiRo

staliro.SampleLike = numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]] | collections.abc.Sequence[float] | staliro.optimizers.Sample

Represent a PEP 604 union type

E.g. for int | str

class staliro.Sample(values)
Parameters:

values (ndarray[tuple[Any, ...], dtype[float64]])

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, SampleT]]) – The set of samples and their associated costs evaluated during the run

staliro.staliro(model: Model[S, E1, SampleT], specification: Specification[S, C, E2], optimizer: Optimizer[C, R, SampleT], options: TestOptions, *, processes: Literal['cores', 'all'] | int | None = None) list[Run[R, C, ModelSpecExtra[S, E1, E2], SampleT]]
staliro.staliro(cost_fn: CostFunc[C, E, SampleT], optimizer: Optimizer[C, R, SampleT], options: TestOptions, /, *, processes: Literal['cores', 'all'] | int | None = None) list[Run[R, C, E, SampleT]]

Run a test using either a CostFunc, or a Model and Specification.

Parameters:
  • model (Model[S, E1, SampleT] | CostFunc[C, E, SampleT]) – The model or cost function to use to evaluate samples.

  • specification (Specification[S, C, E2] | Optimizer[C, R, SampleT]) – The specification to compose with the model, or the Optimizer to use to generate samples.

  • optimizer (Optimizer[C, R, SampleT] | 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], SampleT]] | list[Run[R, C, E, SampleT]]