diff options
author | tosch <tosch@linux-hs3m.site> | 2012-03-30 13:50:23 +0400 |
---|---|---|
committer | tosch <tosch@linux-hs3m.site> | 2012-03-30 13:50:23 +0400 |
commit | fab03f5a6e34e23f69063e0f6766c59cfbeebcd1 (patch) | |
tree | feb7f4ec185df8bb419a8b97d25cb16a58774174 /mert/OptimizerFactoryTest.cpp | |
parent | 292c75cb1ac8d92dcb56cf04821440e7974e6f09 (diff) |
added an (optional) positivity constraint to MERT
Diffstat (limited to 'mert/OptimizerFactoryTest.cpp')
-rw-r--r-- | mert/OptimizerFactoryTest.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/mert/OptimizerFactoryTest.cpp b/mert/OptimizerFactoryTest.cpp index 645360129..82f606410 100644 --- a/mert/OptimizerFactoryTest.cpp +++ b/mert/OptimizerFactoryTest.cpp @@ -9,11 +9,11 @@ namespace { inline bool CheckBuildOptimizer(unsigned dim, const vector<unsigned>& to_optimize, + const vector<bool>& positive, const vector<parameter_t>& start, const string& type, unsigned int num_random) { - boost::scoped_ptr<Optimizer> optimizer( - OptimizerFactory::BuildOptimizer(dim, to_optimize, start, type, num_random)); + boost::scoped_ptr<Optimizer> optimizer(OptimizerFactory::BuildOptimizer(dim, to_optimize, positive, start, type, num_random)); return optimizer.get() != NULL; } @@ -39,8 +39,11 @@ BOOST_AUTO_TEST_CASE(optimizer_build) { start.push_back(0.1); start.push_back(0.2); const unsigned int num_random = 1; + std::vector<bool> positive(dim); + for (int k=0; k < dim; k++) + positive[k] = false; - BOOST_CHECK(CheckBuildOptimizer(dim, to_optimize, start, "powell", num_random)); - BOOST_CHECK(CheckBuildOptimizer(dim, to_optimize, start, "random", num_random)); - BOOST_CHECK(CheckBuildOptimizer(dim, to_optimize, start, "random-direction", num_random)); + BOOST_CHECK(CheckBuildOptimizer(dim, to_optimize, positive, start, "powell", num_random)); + BOOST_CHECK(CheckBuildOptimizer(dim, to_optimize, positive, start, "random", num_random)); + BOOST_CHECK(CheckBuildOptimizer(dim, to_optimize, positive, start, "random-direction", num_random)); } |