File util.hpp

namespace find_embedding

Typedefs

using distance_t = long long int
using RANDOM = fastrng
using clock = std::chrono::high_resolution_clock
using min_queue = std::priority_queue<priority_node<P, min_heap_tag>>
using max_queue = std::priority_queue<priority_node<P, max_heap_tag>>
using distance_queue = pairing_queue<priority_node<distance_t, min_heap_tag>>
typedef shared_ptr<LocalInteraction> LocalInteractionPtr

Functions

template<typename T>
void collectMinima(const vector<T> &input, vector<int> &output)

Fill output with the index of all of the minimum and equal values in input.

Variables

constexpr distance_t max_distance = numeric_limits<distance_t>::max()
class BadInitializationException : public find_embedding::MinorMinerException
#include <util.hpp>

Public Functions

BadInitializationException(const string &m = "bad embedding used with skip_initialization")
class CorruptEmbeddingException : public find_embedding::MinorMinerException
#include <util.hpp>

Public Functions

CorruptEmbeddingException(const string &m = "chains may be invalid")
class CorruptParametersException : public find_embedding::MinorMinerException
#include <util.hpp>

Public Functions

CorruptParametersException(const string &m = "chain inputs are corrupted")
class LocalInteraction
#include <util.hpp>

Interface for communication between the library and various bindings.

Any bindings of this library need to provide a concrete subclass.

Public Functions

virtual ~LocalInteraction()
void displayOutput(const string &msg) const

Print a message through the local output method.

bool cancelled(const clock::time_point stoptime) const

Check if someone is trying to cancel the embedding process.

Private Functions

virtual void displayOutputImpl(const string&) const = 0

Print the string to a binding specified sink.

virtual bool timedOutImpl(const clock::time_point stoptime) const

Check if the embedding process has timed out.

virtual bool cancelledImpl() const = 0

Check if someone has tried to cancel the embedding process.

class MinorMinerException : public runtime_error
#include <util.hpp>

Subclassed by find_embedding::BadInitializationException, find_embedding::CorruptEmbeddingException, find_embedding::CorruptParametersException, find_embedding::ProblemCancelledException, find_embedding::TimeoutException

Public Functions

MinorMinerException(const string &m = "find embedding exception")
class optional_parameters
#include <util.hpp>

Set of parameters used to control the embedding process.

Public Functions

optional_parameters(optional_parameters &p, map<int, vector<int>> fixed_chains, map<int, vector<int>> initial_chains, map<int, vector<int>> restrict_chains)

duplicate all parameters but chain hints, and seed a new rng.

this vaguely peculiar behavior is utilized to spawn parameters for component subproblems

template<typename ...Args>
void printx(const char *format, Args... args) const
template<typename ...Args>
void error(const char *format, Args... args) const
template<typename ...Args>
void major_info(const char *format, Args... args) const
template<typename ...Args>
void minor_info(const char *format, Args... args) const
template<typename ...Args>
void extra_info(const char *format, Args... args) const
template<typename ...Args>
void debug(const char *format, Args... args) const
optional_parameters()
void seed(uint64_t randomSeed)

Public Members

LocalInteractionPtr localInteractionPtr

actually not controlled by user, not initialized here, but initialized in Python, MATLAB, C wrappers level

int max_no_improvement = 10
RANDOM rng
double timeout = 1000

Number of seconds before the process unconditionally stops.

double max_beta = numeric_limits<double>::max()
int tries = 10
int verbose = 0
int inner_rounds = numeric_limits<int>::max()
int max_fill = numeric_limits<int>::max()
bool return_overlap = false
int chainlength_patience = 2
int threads = 1
bool skip_initialization = false
map<int, vector<int>> fixed_chains
map<int, vector<int>> initial_chains
map<int, vector<int>> restrict_chains
class ProblemCancelledException : public find_embedding::MinorMinerException
#include <util.hpp>

Public Functions

ProblemCancelledException(const string &m = "embedding cancelled by keyboard interrupt")
class TimeoutException : public find_embedding::MinorMinerException
#include <util.hpp>

Public Functions

TimeoutException(const string &m = "embedding timed out")