qilisdk.core.parameterizable

Classes

Parameterizable

Mixin for objects that expose tunable parameters and constraints.

Module Contents

class Parameterizable[fuente]

Bases: abc.ABC

Mixin for objects that expose tunable parameters and constraints.

property nparameters: int[fuente]

Number of tunable parameters defined by the object.

get_parameter_values() list[float][fuente]

Return the current numerical values of the parameters.

get_parameter_names() list[str][fuente]

Return the ordered list of parameter labels.

get_parameters() dict[str, float][fuente]

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

set_parameter_values(values: list[float]) None[fuente]

Update all parameter values at once.

Parámetros:

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

Muestra:

ValueError – If values does not contain exactly nparameters entries.

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

Update a subset of parameters by label.

Parámetros:

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

Muestra:

ValueError – If an unknown parameter label is provided or constraints are violated.

get_parameter_bounds() dict[str, tuple[float, float]][fuente]

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

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

Update the allowable ranges for the specified parameters.

Parámetros:

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

Muestra:

ValueError – If an unknown parameter label is provided.

get_constraints() list[qilisdk.core.variables.ComparisonTerm][fuente]

Get all constraints on the parameters.

Devuelve:

A list of comparison terms involving the parameters of the Object.

Tipo del valor devuelto:

list[ComparisonTerm]

check_constraints(parameters: dict[str, float]) bool[fuente]

Validate that proposed parameter updates satisfy all constraints.

Parámetros:

parameters (dict[str, float]) – Candidate parameter values keyed by label.

Devuelve:

True if every constraint evaluates to True for the provided values.

Tipo del valor devuelto:

bool

Muestra:

ValueError – If an unknown parameter label is provided.