GEDLIB  1.0
refine.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * Copyright (C) 2018 by David B. Blumenthal *
4  * *
5  * This file is part of GEDLIB. *
6  * *
7  * GEDLIB is free software: you can redistribute it and/or modify it *
8  * under the terms of the GNU Lesser General Public License as published *
9  * by the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * GEDLIB is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU Lesser General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU Lesser General Public *
18  * License along with GEDLIB. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 
27 #ifndef SRC_METHODS_REFINE_HPP_
28 #define SRC_METHODS_REFINE_HPP_
29 
30 namespace ged {
31 
46 template<class UserNodeLabel, class UserEdgeLabel>
47 class Refine : public LSBasedMethod<UserNodeLabel, UserEdgeLabel> {
48 
49 public:
50 
51  virtual ~Refine();
52 
54 
55 private:
56 
57  std::size_t max_swap_size_;
58 
59  bool naive_;
60 
61  bool add_dummy_assignment_;
62 
63  struct Swap_{
64  std::vector<NodeMap::Assignment> original_assignments;
65  std::vector<NodeMap::Assignment> new_assignments;
66 
67  double cost(const GEDGraph & g, const GEDGraph & h, const GEDData<UserNodeLabel, UserEdgeLabel> & ged_data, NodeMap & node_map, bool naive) const;
68 
69  void do_swap(NodeMap & node_map, double delta_cost=0) const;
70 
71  void undo_swap(NodeMap & node_map) const;
72 
73  std::string print() const;
74 
75  };
76 
77  virtual void ls_run_from_initial_solution_(const GEDGraph & g, const GEDGraph & h, double lower_bound, const NodeMap & initial_node_map,NodeMap & output_node_map) final;
78 
79  virtual bool ls_parse_option_(const std::string & option, const std::string & arg);
80 
81  virtual std::string ls_valid_options_string_() const;
82 
83  bool next_subset_(const std::size_t set_size, std::vector<std::size_t> & subset);
84 
85  virtual void ls_set_default_options_();
86 
87 };
88 
89 }
90 
91 #endif /* SRC_METHODS_REFINE_HPP_ */
Abstract class for methods that use variants of local search for upper bounding the graph edit distan...
Contains the standardized input data along with basic functionality.
Definition: ged_data.hpp:55
A class for node maps.
Definition: node_map.hpp:43
virtual void ls_set_default_options_()
Sets all options that are not among the ones shared by all derived classes of ged::LSBasedMethod to d...
Definition: refine.ipp:189
virtual bool ls_parse_option_(const std::string &option, const std::string &arg)
Parses one option that is not among the ones shared by all derived classes of ged::LSBasedMethod.
Definition: refine.ipp:152
virtual std::string ls_valid_options_string_() const
Returns string of all valid options that are not among the ones shared by all derived classes of ged:...
Definition: refine.ipp:198
The normalized input graphs used by GEDLIB. All labels are integers.
Definition: ged_graph.hpp:104
Computes an upper bound for general edit costs.
Definition: refine.hpp:47
Global namespace for GEDLIB.
virtual void ls_run_from_initial_solution_(const GEDGraph &g, const GEDGraph &h, double lower_bound, const NodeMap &initial_node_map, NodeMap &output_node_map) final
Runs the local search from an initial node map.
Definition: refine.ipp:49