27 #ifndef SRC_METHODS_BRANCH_IPP_ 28 #define SRC_METHODS_BRANCH_IPP_ 33 template<
class UserNodeLabel,
class UserEdgeLabel>
34 Branch<UserNodeLabel, UserEdgeLabel>::
37 template<
class UserNodeLabel,
class UserEdgeLabel>
38 Branch<UserNodeLabel, UserEdgeLabel>::
39 Branch(
const GEDData<UserNodeLabel, UserEdgeLabel> & ged_data) :
40 LSAPEBasedMethod<UserNodeLabel, UserEdgeLabel>(ged_data) {}
43 template<
class UserNodeLabel,
class UserEdgeLabel>
50 #pragma omp parallel for if(this->num_threads_ > 1) 52 for (std::size_t row_in_master = 0; row_in_master < master_problem.
num_rows(); row_in_master++) {
53 for (std::size_t col_in_master = 0; col_in_master < master_problem.
num_cols(); col_in_master++) {
55 master_problem(row_in_master, col_in_master) = compute_substitution_cost_(g, h, row_in_master, col_in_master);
58 master_problem(row_in_master, h.
num_nodes()) = compute_deletion_cost_(g, row_in_master);
61 master_problem(g.
num_nodes(), col_in_master) = compute_insertion_cost_(h, col_in_master);
68 template<
class UserNodeLabel,
class UserEdgeLabel>
102 subproblem_solver.
solve();
109 template<
class UserNodeLabel,
class UserEdgeLabel>
118 for (
auto ij = incident_edges_i.first; ij != incident_edges_i.second; ij++) {
126 template<
class UserNodeLabel,
class UserEdgeLabel>
135 for (
auto kl = incident_edges_k.first; kl != incident_edges_k.second; kl++) {
void set_model(const Model &model)
Makes the solver use a specific model for optimal solving.
Computes lower and upper bounds for general edit costs.
std::size_t num_nodes() const
Returns the number of nodes.
std::size_t num_threads_
The number of threads to be used.
This class solves LSAPE instances by calling the library lsape available at https://bougleux.users.greyc.fr/lsape/.
const GEDData< UserNodeLabel, UserEdgeLabel > & ged_data_
The data on which the method is run.
void solve(int num_solutions=1)
Solves the LSAPE problem instance.
std::size_t degree(NodeID node) const
Returns node degree.
std::size_t num_cols() const
Returns the number of columns.
LabelID get_node_label(NodeID node) const
Returns the label of a given node.
LSAPESolver::Model lsape_model_
Specifies model for optimal LSAPE solver.
LabelID get_edge_label(EdgeID edge) const
Returns the label of a given edge.
std::pair< incident_edge_iterator, incident_edge_iterator > incident_edges(NodeID node) const
Provides access to all incident edges of a node.
double minimal_cost() const
Returns the cost of the computed solutions.
The normalized input graphs used by GEDLIB. All labels are integers.
constexpr LabelID dummy_label()
Returns a dummy label.
Global namespace for GEDLIB.
virtual void lsape_populate_instance_(const GEDGraph &g, const GEDGraph &h, DMatrix &master_problem) final
Populates the LSAPE instance.
std::size_t NodeID
Internally used vertex ID type.
std::size_t num_rows() const
Returns the number of rows.