50 for (CreatorList::iterator it = _creator.begin(); it != _creator.end(); ++it)
56 if (factoryInstance == 0) {
59 return factoryInstance;
65 CreatorList::iterator foundIt = findSolver(name);
66 if (foundIt != _creator.end()) {
67 _creator.erase(foundIt);
68 cerr <<
"SOLVER FACTORY WARNING: Overwriting Solver creator " << name << endl;
71 _creator.push_back(c);
77 CreatorList::iterator foundIt = findSolver(name);
78 if (foundIt != _creator.end()) {
80 _creator.erase(foundIt);
86 CreatorList::const_iterator foundIt = findSolver(name);
87 if (foundIt != _creator.end()) {
88 solverProperty = (*foundIt)->property();
89 return (*foundIt)->construct();
91 cerr <<
"SOLVER FACTORY WARNING: Unable to create solver " << name << endl;
97 delete factoryInstance;
103 size_t solverNameColumnLength = 0;
104 for (CreatorList::const_iterator it = _creator.begin(); it != _creator.end(); ++it)
105 solverNameColumnLength = std::max(solverNameColumnLength, (*it)->property().name.size());
106 solverNameColumnLength += 4;
108 for (CreatorList::const_iterator it = _creator.begin(); it != _creator.end(); ++it) {
111 for (
size_t i = sp.
name.size(); i < solverNameColumnLength; ++i)
113 os << sp.
desc << endl;
119 for (CreatorList::const_iterator it = _creator.begin(); it != _creator.end(); ++it) {
124 return _creator.end();
129 for (CreatorList::iterator it = _creator.begin(); it != _creator.end(); ++it) {
134 return _creator.end();
static void destroy()
free the instance
std::string name
name of the solver, e.g., var
describe the properties of a solver
const OptimizationAlgorithmProperty & property() const
return the properties of the solver
static OptimizationAlgorithmFactory * factoryInstance
create solvers based on their short name
CreatorList::const_iterator findSolver(const std::string &name) const
base for allocating an optimization algorithm
~OptimizationAlgorithmFactory()
void registerSolver(AbstractOptimizationAlgorithmCreator *c)
OptimizationAlgorithmFactory()
void listSolvers(std::ostream &os) const
list the known solvers into a stream
static OptimizationAlgorithmFactory * instance()
return the instance
void unregisterSolver(AbstractOptimizationAlgorithmCreator *c)
std::string desc
short description of the solver
Generic interface for a non-linear solver operating on a graph.
OptimizationAlgorithm * construct(const std::string &tag, OptimizationAlgorithmProperty &solverProperty) const