qilisdk.cost_functions.cost_function

Attributes

TResult

Classes

CostFunction

Base class that maps functional results into scalar costs.

Module Contents

TResult[source]
class CostFunction[source]

Bases: abc.ABC

Base class that maps functional results into scalar costs.

compute_cost(results: qilisdk.functionals.sampling_result.SamplingResult) qilisdk.common.variables.Number[source]
compute_cost(results: qilisdk.functionals.time_evolution_result.TimeEvolutionResult) qilisdk.common.variables.Number
compute_cost(results: qilisdk.functionals.functional_result.FunctionalResult) qilisdk.common.variables.Number

Dispatch to the appropriate cost implementation based on the result type.

Parameters:

results (FunctionalResult) – Output of a functional execution.

Returns:

Scalar cost extracted from the results.

Return type:

Number

Raises:

NotImplementedError – If the concrete cost function does not support the given result type.