Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Annotation of /trunk/paramin-beta/datascaler.h
[mareframe] / trunk / paramin-beta / datascaler.h Repository:
ViewVC logotype

Annotation of /trunk/paramin-beta/datascaler.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #ifndef datascaler_h
2 :     #define datascaler_h
3 :    
4 :     #include "paramin.h"
5 :     #include "mathfunc.h"
6 :     #include "doublevector.h"
7 :    
8 :     /**
9 :     * \class DataScaler
10 :     * \brief Class DataScaler can be used to scale/unscale x[0..numVar-1] where x is a vector of numVar parameters. Vectors are scaled using the formula:
11 :     * x[i].scaled = (x[i] - ((ubd[i] + lbd[i])/2))/((ubd[i]-lbd[i])/2);
12 :     * And unscaled using the formula:
13 :     * x[i].unscaled = (x[i]*(ubd[i]-lbd[i])/2.0 + (lbd[i] + ubd[i])/2.0);
14 :     * Upper bound (ubd) and lower bound (lbd) must have same number of parameters as vector to be scaled/unscaled. DataScaler can also be used to scale variable y using the formula:
15 :     * for all parameters in vector x:
16 :     * outside = (x[i]<0.) ?(-x[i]): ((x[i]>1.) ? (x[i]-1.):(0.)) ;
17 :     * penalty[id] = MAX(outside,penalty[id]);
18 :     * y *= (1. + sqrt(penalty[id]));
19 :     * return p;
20 :     * where outside is based on a given vector and penalty is a vector[0...maxNum-1] which identifies the datapair (x[i..numVar-1], y)
21 :     *
22 :     * Lower and upperbound must be set before trying to scale/unscale vectors and must have number of variables > 0. and penalty must have been set before trying to scale variable y, and must have length > 0. DataScaler also has functions to get information about number of variables in vector to be scaled and setting/getting lower/upper bound and penalty.
23 :     */
24 :    
25 :     class DataScaler {
26 :     private:
27 :     int numVar;
28 :     DoubleVector lbd;
29 :     DoubleVector ubd;
30 :     DoubleVector penalty;
31 :     DoubleVector x_vec;
32 :     public:
33 :     DataScaler();
34 :     ~DataScaler();
35 :     void setInitialData(const DoubleVector& l, const DoubleVector& u);
36 :     double scaleResult(double y, int id, const DoubleVector& v1);
37 :     double scale(double p, int i);
38 :     const DoubleVector& scaleX(const DoubleVector& v1);
39 :     double unscale(double p, int i);
40 :     const DoubleVector& unscaleX(const DoubleVector& v1);
41 :     void setPenalty(int numIndexes);
42 :     const DoubleVector& getLower();
43 :     const DoubleVector& getUpper();
44 :     int getNumVariables();
45 :     };
46 :    
47 :     #endif

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge