qilisdk.core.parameterizable

Classes

Parameterizable

Helper class that provides a standard way to create an ABC using

Module Contents

class Parameterizable[source]

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

property nparameters: int[source]
Abstractmethod:

Number of tunable parameters defined by the object.

abstractmethod get_parameter_values() list[float][source]

Return the current numerical values of the parameters.

abstractmethod get_parameter_names() list[str][source]

Return the ordered list of parameter labels.

abstractmethod get_parameters() dict[str, float][source]

Return a mapping from parameter labels to their current numerical values.

abstractmethod set_parameter_values(values: list[float]) None[source]

Update all parameter values at once.

Parameters:

values (list[float]) – New parameter values ordered consistently with get_parameter_names().

Raises:

ValueError – If values does not contain exactly nparameters entries.

abstractmethod set_parameters(parameters: dict[str, float]) None[source]

Update a subset of parameters by label.

Parameters:

parameters (dict[str, float]) – Mapping from parameter labels to updated numeric values.

Raises:

ValueError – If an unknown parameter label is provided.

abstractmethod get_parameter_bounds() dict[str, tuple[float, float]][source]

Return the (lower, upper) bounds associated with each parameter.

abstractmethod set_parameter_bounds(ranges: dict[str, tuple[float, float]]) None[source]

Update the allowable ranges for the specified parameters.

Parameters:

ranges (dict[str, tuple[float, float]]) – Mapping from parameter label to (lower, upper) bounds.

Raises:

ValueError – If an unknown parameter label is provided.