42int main(
int argc,
char** argv) {
45 string outputFilename;
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");
68 ifstream ifs(inputFilename.c_str());
70 cerr <<
"unable to open " << inputFilename << endl;
77 if (outputFilename.size() > 0) {
78 if (outputFilename ==
"-") {
79 cerr <<
"saving to stdout";
82 cerr <<
"saving " << outputFilename <<
" ... ";
83 optimizer.
save(outputFilename.c_str());
85 cerr <<
"done." << endl;
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)
#define G2O_USE_TYPE_GROUP(typeGroupName)
#define G2O_USE_OPTIMIZATION_LIBRARY(libraryname)
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