42 {
43
44 int maxIterations;
45 string outputFilename;
46 string inputFilename;
48 arg.
param(
"i", maxIterations, 10,
49 "perform n iterations, if negative consider the gain");
50 arg.
param(
"o", outputFilename,
"",
"output final version of the graph");
52 "graph file which will be processed");
54
55
56
57
58
61
62
66 solverProperty));
67
68 ifstream ifs(inputFilename.c_str());
69 if (!ifs) {
70 cerr << "unable to open " << inputFilename << endl;
71 return 1;
72 }
76
77 if (outputFilename.size() > 0) {
78 if (outputFilename == "-") {
79 cerr << "saving to stdout";
81 } else {
82 cerr << "saving " << outputFilename << " ... ";
83 optimizer.
save(outputFilename.c_str());
84 }
85 cerr << "done." << endl;
86 }
87 return 0;
88}
Command line parsing of argc and argv.
bool parseArgs(int argc, char **argv, bool exitOnError=true)
void paramLeftOver(const std::string &name, std::string &p, const std::string &defValue, const std::string &desc, bool optional=false)
void param(const std::string &name, bool &p, bool defValue, const std::string &desc)
static OptimizationAlgorithmFactory * instance()
return the instance
int optimize(int iterations, bool online=false)
void setVerbose(bool verbose)
virtual bool initializeOptimization(HyperGraph::EdgeSet &eset)
void setAlgorithm(OptimizationAlgorithm *algorithm)
virtual bool save(std::ostream &os, int level=0) const
save the graph to a stream. Again uses the Factory system.
virtual bool load(std::istream &is)
describe the properties of a solver