2012-03-18 08:08:38 +04:00
|
|
|
#ifndef MERT_OPTIMIZER_FACTORY_H_
|
|
|
|
#define MERT_OPTIMIZER_FACTORY_H_
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include "Types.h"
|
|
|
|
|
2012-06-30 23:23:45 +04:00
|
|
|
namespace MosesTuning
|
|
|
|
{
|
2013-05-29 21:16:15 +04:00
|
|
|
|
2012-06-30 23:23:45 +04:00
|
|
|
|
2012-03-18 08:08:38 +04:00
|
|
|
class Optimizer;
|
|
|
|
|
|
|
|
class OptimizerFactory
|
|
|
|
{
|
2013-05-29 21:16:15 +04:00
|
|
|
public:
|
2012-03-18 08:08:38 +04:00
|
|
|
// NOTE: Add new optimizer here BEFORE NOPTIMZER
|
|
|
|
enum OptimizerType {
|
|
|
|
POWELL = 0,
|
|
|
|
RANDOM_DIRECTION = 1,
|
|
|
|
RANDOM,
|
|
|
|
NOPTIMIZER
|
|
|
|
};
|
|
|
|
|
2012-05-10 02:51:05 +04:00
|
|
|
static std::vector<std::string> GetTypeNames();
|
2012-03-18 08:08:38 +04:00
|
|
|
|
|
|
|
// Setup optimization types.
|
|
|
|
static void SetTypeNames();
|
|
|
|
|
|
|
|
// Get optimizer type.
|
|
|
|
static OptimizerType GetOptimizerType(const std::string& type);
|
|
|
|
|
|
|
|
static Optimizer* BuildOptimizer(unsigned dim,
|
|
|
|
const std::vector<unsigned>& to_optimize,
|
2012-05-10 02:51:05 +04:00
|
|
|
const std::vector<bool>& positive,
|
2012-03-18 08:08:38 +04:00
|
|
|
const std::vector<parameter_t>& start,
|
|
|
|
const std::string& type,
|
|
|
|
unsigned int nrandom);
|
|
|
|
|
2013-05-29 21:16:15 +04:00
|
|
|
private:
|
2012-03-18 08:08:38 +04:00
|
|
|
OptimizerFactory() {}
|
|
|
|
~OptimizerFactory() {}
|
|
|
|
|
2012-05-10 02:51:05 +04:00
|
|
|
static std::vector<std::string> m_type_names;
|
2012-03-18 08:08:38 +04:00
|
|
|
};
|
|
|
|
|
2012-06-30 23:23:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-18 08:08:38 +04:00
|
|
|
#endif // MERT_OPTIMIZER_FACTORY_H_
|