File find_embedding.hpp

namespace find_embedding

Functions

int findEmbedding(graph::input_graph &var_g, graph::input_graph &qubit_g, optional_parameters &params, vector<vector<int>> &chains)

The main entry function of this library.

This method primarily dispatches the proper implementation of the algorithm where some parameters/behaviours have been fixed at compile time.

In terms of dispatch, there are three dynamically-selected classes which are combined, each according to a specific optional parameter.

  • a domain_handler, described in embedding_problem.hpp, manages constraints of the form “variable a’s chain must be a subset of…”

  • a fixed_handler, described in embedding_problem.hpp, manages contstraints of the form “variable a’s chain must be exactly…”

  • a pathfinder, described in pathfinder.hpp, which come in two flavors, serial and parallel The optional parameters themselves can be found in util.hpp. Respectively, the controlling options for the above are restrict_chains, fixed_chains, and threads.

class parameter_processor
#include <find_embedding.hpp>

Public Functions

parameter_processor(graph::input_graph &var_g, graph::input_graph &qubit_g, optional_parameters &params_)
map<int, vector<int>> input_chains(map<int, vector<int>> &m)
vector<int> input_vars(vector<int> &V)

Public Members

unsigned int num_vars
unsigned int num_qubits
vector<int> qub_reserved_unscrewed
vector<int> var_fixed_unscrewed
unsigned int num_reserved
graph::components qub_components
unsigned int problem_qubits
unsigned int problem_reserved
unsigned int num_fixed
vector<int> unscrew_vars
vector<int> screw_vars
optional_parameters params
vector<vector<int>> var_nbrs
vector<vector<int>> qubit_nbrs

Private Functions

unsigned int _reserved(optional_parameters &params_)
vector<int> _filter_fixed_vars()
vector<int> _inverse_permutation(vector<int> &f)
template<bool parallel, bool fixed, bool restricted, bool verbose>
class pathfinder_type
#include <find_embedding.hpp>

Public Types

typedef std::conditional<fixed, fixed_handler_hival, fixed_handler_none>::type fixed_handler_t
typedef std::conditional<restricted, domain_handler_masked, domain_handler_universe>::type domain_handler_t
typedef output_handler<verbose> output_handler_t
typedef embedding_problem<fixed_handler_t, domain_handler_t, output_handler_t> embedding_problem_t
typedef std::conditional<parallel, pathfinder_parallel<embedding_problem_t>, pathfinder_serial<embedding_problem_t>>::type pathfinder_t
class pathfinder_wrapper
#include <find_embedding.hpp>

Public Functions

pathfinder_wrapper(graph::input_graph &var_g, graph::input_graph &qubit_g, optional_parameters &params_)
~pathfinder_wrapper()
void get_chain(int u, vector<int> &output) const
int heuristicEmbedding()
int num_vars()
void set_initial_chains(map<int, vector<int>> &init)
void quickPass(vector<int> &varorder, int chainlength_bound, int overlap_bound, bool local_search, bool clear_first, double round_beta)
void quickPass(VARORDER varorder, int chainlength_bound, int overlap_bound, bool local_search, bool clear_first, double round_beta)

Private Functions

template<bool parallel, bool fixed, bool restricted, bool verbose, typename ...Args>
std::unique_ptr<pathfinder_public_interface> _pf_parse4(Args&&... args)
template<bool parallel, bool fixed, bool restricted, typename ...Args>
std::unique_ptr<pathfinder_public_interface> _pf_parse3(Args&&... args)
template<bool parallel, bool fixed, typename ...Args>
std::unique_ptr<pathfinder_public_interface> _pf_parse2(Args&&... args)
template<bool parallel, typename ...Args>
std::unique_ptr<pathfinder_public_interface> _pf_parse1(Args&&... args)
template<typename ...Args>
std::unique_ptr<pathfinder_public_interface> _pf_parse(Args&&... args)

Private Members

parameter_processor pp
std::unique_ptr<pathfinder_public_interface> pf