From d9f662d8857c1ae15d72d6212b616a10a5181f67 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Sun, 14 Nov 2010 17:15:48 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@143 ed2142bd-67ad-457f-ba7c-d818d4011675 --- distributions/uniformed.hpp | 58 +++++++++++++++++++++++++++++++++++++++++++++ test/makefile | 2 +- test/many_dims.cpp | 18 +++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 distributions/uniformed.hpp diff --git a/distributions/uniformed.hpp b/distributions/uniformed.hpp new file mode 100644 index 0000000..ccafd01 --- /dev/null +++ b/distributions/uniformed.hpp @@ -0,0 +1,58 @@ +#ifndef UNIFORMED_MODEL_H_ +#define UNIFORMED_MODEL_H_ +#define OPT_HEADER +#include +#include +#include + +namespace opt_utilities +{ + template + class uniformed + :public model,optvec,optvec,std::string> + { + private: + uniformed* do_clone()const + { + return new uniformed(*this); + } + + const char* do_get_type_name()const + { + return "1d normed gaussian"; + } + public: + uniformed() + { + this->push_param_info(param_info >("a",0.)); + this->push_param_info(param_info >("b",1.)); + } + + + public: + optvec do_eval(const optvec& x,const optvec& param) + { + T a=get_element(param,0); + T b=get_element(param,1); + optvec y; + resize(y,get_size(x)); + for(int i=0;i > { + long long n_eval; +public: + foo1() + :n_eval(0) + { + } + + ~foo1() + { + cerr<& p) { + ++n_eval; double result=0; for(int i=0;i!=p.size();++i) { @@ -123,7 +138,7 @@ class foo5 void test_opt(const func_obj >& fo, const opt_method >& optm) { - const int problem_size=500000; + const int problem_size=100000; optimizer > opt; opt.set_func_obj(fo); @@ -170,6 +185,7 @@ int main() //powell_method > agam; //aga_method > agam(100,50); test_opt(foo1(),agam); + // test_opt(foo1(),agam); // test_opt(foo2(),agam); //test_opt(foo3(),agam); //test_opt(foo4(),agam); -- cgit v1.2.2