Specifications¶
- class staliro.specifications.Specification¶
Class that represents a requirement to be evaluated using simulation data.
A specification should accept the trajectories and timestamps generated by a model and return a value which represents the “goodness” of the model results with respect to some criteria.
- abstractmethod evaluate(trace, /)¶
Evaluate trajectories and timestamps with respect to some requirement.
- Parameters:
trajectories – Matrix of states where each row represents a state variable.
timestamps – Vector of time values corresponding to each column of the trajectories matrix.
trace (Trace[S])
- Returns:
A value indicating the “goodness” of the trajectories according to the requirement.
- Return type:
Result[C, E]
- @staliro.specification(f: Callable[[Trace[T]], Result[C, E]]) Specification[T, C, E]¶
- @staliro.specification(f: Callable[[Trace[T]], C]) Specification[T, C, None]
Create a specification from a function.
The function must accept a
Traceas an argument and return either a cost value or astaliro.Resultcontaining the cost value and additional annotation data. If only a cost value is returned, astaliro.Resultwill be constructed with the annotation set toNone.- Parameters:
- Returns:
A
Specificationimplementation wrapping the provided function- Return type:
Specification[T, C, E | None]
RTAMT¶
- staliro.specifications.rtamt.parse_discrete(formula: str, columns: Mapping[str, int]) DiscreteMapped¶
- staliro.specifications.rtamt.parse_discrete(formula: str, columns: None = None) DiscreteNamed
Create a discrete-time requirement from a formula and an optional variable-column mapping.
If a variable-column mapping is provided, the created specification will expect states in the system trace to be a
Sequence[float]. If the mapping is omitted then the specification will expect the states to bedict[str, float]. The discrete-time specification also imposes the following constraints on anyTraceit evaluates:The amount of time between each state must be equal
There must be at least two states in the trace
- staliro.specifications.rtamt.parse_dense(requirement: str, columns: Mapping[str, int]) DenseMapped¶
- staliro.specifications.rtamt.parse_dense(requirement: str, columns: None = None) DenseNamed
Create a dense-time requirement from a formula and an optional variable-column mapping.
If a variable-column mapping is provided, the created specification will expect states in the system trace to be a
Sequence[float]. If the mapping is omitted then the specification will expect the states to bedict[str, float].