AStarHeuristic

class AStarHeuristic(heuristic_factor=10.0, cost_factor=1.0, cost_gen=<bqskit.ir.opt.cost.functions.cost.hilbertschmidt.HilbertSchmidtCostGenerator object>)[source]

Bases: HeuristicFunction

The AStarHeuristic HeuristicFunction class.

Defines a heuristic that combines the depth of the circuit with its cost. It generally gives similar quality results to DjikstraHeuristic, but with a drastic reduction in the number of instantiation calls.

In pure search terms: f(p) = cost(p) + heuristic(p), this implements the f(p) component.

__init__(heuristic_factor=10.0, cost_factor=1.0, cost_gen=<bqskit.ir.opt.cost.functions.cost.hilbertschmidt.HilbertSchmidtCostGenerator object>)[source]

Construct a AStarHeuristic Function.

Parameters:
  • heuristic_factor (float) – Scale the heuristic component by this value.

  • cost_factor (float) – Scale the cost component by this value.

  • cost_gen (CostFunctionGenerator) – This is used to generate cost functions used during evaluations.

Methods

get_value(circuit, target)

Return the heuristic's value, see HeuristicFunction for more info.