Optimizer#

class Optimizer(measure_func, optimization_map, logger=None)[source]#

Bases: ABC

Base class for all classes that implement an optimization algorithm.

The class accepts a list of optimizable parameters from the lower layers which shall be optimized in order to minimize the given measure.

__init__(measure_func, optimization_map, logger=None)[source]#
Parameters:
  • measure_func (Callable[[Array], Float]) – Function implementing measurement of observables to be minimized.

  • optimization_map (OptimizationMap) – An optimization map containing all parameters that can be optimized. If none, an empty map will be created to which the parameters can be added later.

  • logger (Logger | None) – The file logger object.

Methods

__init__(measure_func, optimization_map[, ...])

optimize(times)

Perform the actual optimization.

Attributes

logger

Returns the current logger that is being used by this optimizer, or None if no logger was set yet.

optimization_map

Return the optimization map that this optimizer uses.

property logger: Logger | None#

Returns the current logger that is being used by this optimizer, or None if no logger was set yet.

property optimization_map: OptimizationMap#

Return the optimization map that this optimizer uses.

Parameters that can be optimized need to be added to this map.

Returns:

The optimization map that this optimizer uses.

abstract optimize(times)[source]#

Perform the actual optimization.

Depending on the implementation, this function might take a long time and might need several calls to the underlying layers. The returned object contains some information about the result. The result will include the raw result of the underlying algorithm for more information.

Parameters:

times (Array | float) – Array of times or a float (assumed start time zero).

Returns:

Result of optimization via the OptimizationResult object (status, value, iterations and the raw result).

Return type:

OptimizationResult