From 7ff0aab5e0dbda497014c6249c27f27a08351988 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Fri, 28 Dec 2012 03:43:48 +0800 Subject: Add the meet_constraint and do_meet_constraint member to class model. deleted: core/constrained_model.hpp modified: core/fitter.hpp --- core/constrained_model.hpp | 22 ---------------------- core/fitter.hpp | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 core/constrained_model.hpp (limited to 'core') diff --git a/core/constrained_model.hpp b/core/constrained_model.hpp deleted file mode 100644 index 378cabd..0000000 --- a/core/constrained_model.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef CONSTRAINED_MODEL_HPP -#define CONSTRAINED_MODEL_HPP -#include "fitter.hpp" - -namespace opt_utilities -{ - template - class constrained_model - :public model - { - public: - bool meet_constraint(const Tp& p)const - { - return do_meet_constraint(p); - } - private: - virtual bool do_meet_constraint(const Tp& p)const=0; - }; - -} - -#endif diff --git a/core/fitter.hpp b/core/fitter.hpp index cc4da3b..7b5af4b 100644 --- a/core/fitter.hpp +++ b/core/fitter.hpp @@ -559,6 +559,19 @@ namespace opt_utilities return Tstr(); } + virtual bool do_meet_constraint(const Tp& p)const + { + Tp p1=this->reform_param(p); + for(size_t i=0;i!=p1.size();++i) + { + if(get_element(p,i)>get_param_info(i).get_upper_limit()|| + get_element(p,i)