File pathfinder.hpp¶
-
namespace
find_embedding -
template<typename
embedding_problem_t>
classpathfinder_base: public find_embedding::pathfinder_public_interface - #include <pathfinder.hpp>
Subclassed by find_embedding::pathfinder_parallel< embedding_problem_t >, find_embedding::pathfinder_serial< embedding_problem_t >
Public Types
-
template<>
usingembedding_t= embedding<embedding_problem_t>¶
Public Functions
-
pathfinder_base(optional_parameters &p_, int &n_v, int &n_f, int &n_q, int &n_r, vector<vector<int>> &v_n, vector<vector<int>> &q_n)¶
-
void
set_initial_chains(map<int, vector<int>> chains)¶
-
virtual
~pathfinder_base()¶
-
int
check_improvement(const embedding_t &emb) nonzero return if this is an improvement on our previous best embedding
-
virtual const chain &
get_chain(int u) const chain accessor
-
virtual void
quickPass(VARORDER varorder, int chainlength_bound, int overlap_bound, bool local_search, bool clear_first, double round_beta)¶
-
virtual void
quickPass(const vector<int> &varorder, int chainlength_bound, int overlap_bound, bool local_search, bool clear_first, double round_beta)¶
-
virtual int
heuristicEmbedding() perform the heuristic embedding, returning 1 if an embedding was found and 0 otherwise
Protected Functions
-
int
find_chain(embedding_t &emb, const int u)¶ tear out and replace the chain in
embfor variableu
-
int
initialization_pass(embedding_t &emb)¶ sweep over all variables, either keeping them if they are pre-initialized and connected, and otherwise finding new chains for them (each, in turn, seeking connection only with neighbors that already have chains)
-
int
improve_overfill_pass(embedding_t &emb)¶ tear up and replace each variable
-
int
pushdown_overfill_pass(embedding_t &emb)¶ tear up and replace each chain, strictly improving or maintaining the maximum qubit fill seen by each chain
-
int
improve_chainlength_pass(embedding_t &emb)¶ tear up and replace each chain, attempting to rebalance the chains and lower the maximum chainlength
-
void
accumulate_distance_at_chain(const embedding_t &emb, const int v)¶ incorporate the qubit weights associated with the chain for
vintototal_distance
-
void
accumulate_distance(const embedding_t &emb, const int v, vector<int> &visited, const int start, const int stop)¶ incorporate the distances associated with the chain for
vintototal_distance
-
void
accumulate_distance(const embedding_t &emb, const int v, vector<int> &visited)¶ a wrapper for
accumulate_distanceandaccumulate_distance_at_chain
-
void
compute_distances_from_chain(const embedding_t &emb, const int &v, vector<int> &visited)¶ run dijkstra’s algorithm, seeded at the chain for
v, using thevisitedvector note: qubits are only visited ifvisited[q] = 1.the value
-1is used to prevent searching of overfull qubits
-
void
compute_qubit_weights(const embedding_t &emb)¶ compute the weight of each qubit, first selecting
alpha
-
void
compute_qubit_weights(const embedding_t &emb, const int start, const int stop)¶ compute the weight of each qubit in the range from
starttostop, where the weight is2^(alpha*fill)wherefillis the number of chains which use that qubit
Protected Attributes
-
embedding_problem_t
ep¶
-
optional_parameters &
params¶
-
embedding_t
bestEmbedding¶
-
embedding_t
lastEmbedding¶
-
embedding_t
currEmbedding¶
-
embedding_t
initEmbedding¶
-
int
num_qubits¶
-
int
num_reserved¶
-
int
num_vars¶
-
int
num_fixed¶
-
vector<vector<int>>
parents¶
-
vector<distance_t>
total_distance¶
-
vector<int>
min_list¶
-
vector<distance_t>
qubit_weight¶
-
vector<int>
tmp_stats¶
-
vector<int>
best_stats¶
-
int
pushback¶
-
vector<vector<int>>
visited_list¶
-
vector<vector<distance_t>>
distances¶
-
vector<vector<int>>
qubit_permutations¶
Private Functions
-
virtual void
prepare_root_distances(const embedding_t &emb, const int u) = 0¶ compute the distances from all neighbors of
uto all qubits
-
int
find_chain(embedding_t &emb, const int u, int target_chainsize)¶ after
uhas been torn out, perform searches from each neighboring chain, select a minimum-distance root, and construct the chain
-
void
find_short_chain(embedding_t &emb, const int u, const int target_chainsize)¶ after
uhas been torn out, perform searches from each neighboring chain, iterating over potential roots to find a root with a smallest-possible actual chainlength whereas other variants offind_chainsimply pick a random root candidate with minimum estimated chainlength.this procedure takes quite a long time and requires that
embis a valid embedding with no overlaps.
-
template<typename
pq_t, typenamebehavior_tag>
voiddijkstra_initialize_chain(const embedding_t &emb, const int &v, vector<int> &parent, vector<int> &visited, pq_t &pq, behavior_tag)¶ this function prepares the parent & distance-priority-queue before running dijkstra’s algorithm
Friends
-
friend
find_embedding::pathfinder_serial< embedding_problem_t >
-
friend
find_embedding::pathfinder_parallel< embedding_problem_t >
-
template<>
-
template<typename
embedding_problem_t>
classpathfinder_parallel: public find_embedding::pathfinder_base<embedding_problem_t> - #include <pathfinder.hpp>
A pathfinder where the Dijkstra-from-neighboring-chain passes are done serially.
Public Types
-
template<>
usingsuper= pathfinder_base<embedding_problem_t>¶
-
template<>
usingembedding_t= embedding<embedding_problem_t>¶
Public Functions
-
pathfinder_parallel(optional_parameters &p_, int n_v, int n_f, int n_q, int n_r, vector<vector<int>> &v_n, vector<vector<int>> &q_n)¶
-
virtual
~pathfinder_parallel()¶
-
virtual void
prepare_root_distances(const embedding_t &emb, const int u) compute the distances from all neighbors of
uto all qubits
Private Functions
-
void
run_in_thread(const embedding_t &emb, const int u)¶
-
template<>
-
class
pathfinder_public_interface - #include <pathfinder.hpp>
Subclassed by find_embedding::pathfinder_base< embedding_problem_t >
-
template<typename
embedding_problem_t>
classpathfinder_serial: public find_embedding::pathfinder_base<embedding_problem_t> - #include <pathfinder.hpp>
A pathfinder where the Dijkstra-from-neighboring-chain passes are done serially.
Public Types
-
template<>
usingsuper= pathfinder_base<embedding_problem_t>¶
-
template<>
usingembedding_t= embedding<embedding_problem_t>¶
Public Functions
-
pathfinder_serial(optional_parameters &p_, int n_v, int n_f, int n_q, int n_r, vector<vector<int>> &v_n, vector<vector<int>> &q_n)¶
-
virtual
~pathfinder_serial()¶
-
virtual void
prepare_root_distances(const embedding_t &emb, const int u) compute the distances from all neighbors of
uto all qubits
-
template<>
-
template<typename