qilisdk.cost_functions.cost_function

Classes

CostFunction

Abstract base class that maps a FunctionalResult into a scalar cost.

Module Contents

class CostFunction[source]

Bases: abc.ABC

Abstract base class that maps a FunctionalResult into a scalar cost.

Subclasses must implement compute_cost() to define how a FunctionalResult is reduced to a single numeric value. This value is typically consumed by an optimiser inside a VariationalProgram.

abstractmethod compute_cost(results: qilisdk.functionals.functional_result.FunctionalResult) qilisdk.core.types.Number[source]

Compute a scalar cost from functional execution results.

Parameters:

results (FunctionalResult) – Output of executing a Functional (e.g. a DigitalPropagation or AnalogEvolution).

Returns:

Scalar cost extracted from the results.

Return type:

Number