qat.nnize.metric.DurationMetric

class qat.nnize.metrics.DurationMetric

This metric must be used to reduce the overall time of execution. To use this metric, the duration of each gate must be known, use set_gate_time to define the time of each gate.

This metric may be also used to minimize the overall idle time. To minimize the overall idle time, use minimize_idle_time()

Warning

Please note that the output of this function can be altered if this metric is used with a Nnizer having the “ignore_large_gate” option enabled. When this option is enabled, this metric will not see large gates

get_best_index()

Returns the index of the candidate which minimize the quantum cost

Parameters
  • base_path (GateList) – base path

  • candidates (cpplist[GateList]) – list of candidates

Returns

index of the best candidate

Return type

int

init()

Execute this function to warn this metric that the given nnizer is ready and entirely defined.

minimize_idle_time()

Change the metric to minimize the overall idle time. To reset the metric (to minimize the overall time of execution instead of the overall idle time), use minimize_overall_time()

minimize_overall_time()

Change the metric to minimize the overall time of the quantum circuit.

set_gate_time()

Define the dictionnary describing the time of execution of each gate

Parameters

gate_time (dict<str, float or function>) – dictionnary describing the time of execution of each gate. A key correspond to the name of the gate (add C- at the beginning of the gate to control the gate, D- to dag the gate, T- to transpose the the gate of S- to conjugate the gate) and the value correspond to the time of execution. Use “-DEFAULT-” as gate name to define the default duration of a gate

set_nnizer()

Define the nnizer which will be linked to this predif metric

Parameters

nnizer (Nnizer) –