GEDLIB  1.0
train_subgraph.cpp
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 
31 #include "util.hpp"
32 
33 void train_on_dataset(const std::string & dataset) {
34 
35  // Initialize environment.
36  std::cout << "\n=== " << dataset << " ===\n";
37  std::cout << "\tInitializing the environment ...\n";
39  util::setup_environment(dataset, true, env);
40 
41  // Initialize the method.
42  env.set_method(ged::Options::GEDMethod::SUBGRAPH, util::init_options(dataset, "subgraph"));
43  env.init_method();
44 }
45 
46 int main(int argc, char* argv[]) {
47  std::vector<std::string> datasets;
48  for (int i{1}; i < argc; i++) {
49  datasets.push_back(std::string(argv[i]));
50  util::check_dataset(datasets.back());
51  }
52  if (datasets.empty()) {
53  util::setup_datasets(datasets);
54  }
55  for (auto dataset : datasets) {
56  try {
57  train_on_dataset(dataset);
58  }
59  catch (const std::exception & error) {
60  std::cerr << error.what() << ". " << "Error on " << dataset << ".\n";
61  }
62  }
63  return 0;
64 }
void init_method()
Initializes the method specified by call to set_method().
Definition: ged_env.ipp:521
Provides utility functions for tests of PR submission.
void set_method(Options::GEDMethod method, const std::string &options=std::string(""))
Sets the GEDMethod to be used by run_method().
Definition: ged_env.ipp:384
Selects ged::Subgraph.
Provides the API of GEDLIB.
Definition: ged_data.hpp:48