aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorastrojhgu <astrojhgu@gmail.com>2012-12-28 00:25:29 +0800
committerastrojhgu <astrojhgu@gmail.com>2012-12-28 00:25:29 +0800
commitaac95b5cd24e8cc4c189ab92f10a0d4bbb23cc1c (patch)
tree275fc2bac6753133678563deb71ba60c2dc087d8 /core
parentd94df863f7b0d2734ff9f7780bdc2ba731ec2ad2 (diff)
downloadopt-utilities-aac95b5cd24e8cc4c189ab92f10a0d4bbb23cc1c.tar.bz2
constrainted_model: allow to constrain the defining domain of parameters
new file: core/constrained_model.hpp
Diffstat (limited to 'core')
-rw-r--r--core/constrained_model.hpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/constrained_model.hpp b/core/constrained_model.hpp
new file mode 100644
index 0000000..710f76c
--- /dev/null
+++ b/core/constrained_model.hpp
@@ -0,0 +1,22 @@
+#ifndef CONSTRAINED_MODEL_HPP
+#define CONSTRAINED_MODEL_HPP
+#include "fitter.hpp"
+
+namespace opt_utilities
+{
+ template <typename Ty,typename Tx,typename Tp,typename Tstr=std::string>
+ class constrained_model
+ :public model<Ty,Tx,Tp,Tstr=std::string>
+ {
+ public:
+ bool meet_constraint(const Tp& p)
+ {
+ return do_meet_constraint(p);
+ }
+ private:
+ virtual bool do_meet_constraint(const Tp& p)=0;
+ };
+
+}
+
+#endif