Skip to content

Update component interfaces

Quinn Thibeault requested to merge component-interface-refactor into main

Re-define component interfaces in order to allow users to specify the type of the cost values produced by the specification, and the type of the cost values supported by an optimizer. This change allows the PSY-TaLiRo library to be more general about the types of specifications and optimizers that users can define since they are no longer restricted to only representing the cost with a float.

The Specification and Optimizer interfaces now accept an additional parameter named CostT which represents the type of the cost values. The Result, Run and Evaluation classes are similarly parameterized. The Model class has been adjusted to return an instance of the new ModelResult abstract base class, which replaces the previous union definition. Several implementations of the ModelResult ABC are provided, but users are also free to define their own if they choose. The ModelResult interface requires users to construct an instance of the new Trace class which represents a timed sequence of states. The arguments to the Model.simulate method have been reduced by combining them into a single dataclass.

Merge request reports

Loading