| 42 | */ |
| 43 | |
| 44 | class CDEOpt : public CBiteOptBase< int64_t > |
| 45 | { |
| 46 | public: |
| 47 | typedef int64_t ptype; ///< Parameter value storage type (should be a |
| 48 | ///< signed integer type, same as CBiteOptBase template parameter). |
| 49 | |
| 50 | /** |
| 51 | * Function updates dimensionality of *this object. |
| 52 | * |
| 53 | * @param aParamCount The number of parameters being optimized. |
| 54 | * @param PopSize0 The number of elements in population to use. If set to |
| 55 | * 0 or negative, the default formula will be used. |
| 56 | */ |
| 57 | |
| 58 | void updateDims( const int aParamCount, const int PopSize0 = 0 ) |
| 59 | { |
| 60 | const int aPopSize = ( PopSize0 > 0 ? PopSize0 : 30 * aParamCount ); |
| 61 | |
| 62 | if( aParamCount == ParamCount && aPopSize == PopSize ) |
| 63 | { |
| 64 | return; |
| 65 | } |
| 66 | |
| 67 | initBuffers( aParamCount, aPopSize ); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Function initializes *this optimizer. |
| 72 | * |
| 73 | * @param rnd Random number generator. |
| 74 | * @param InitParams If not NULL, initial parameter vector, also used as |
| 75 | * centroid. |
| 76 | * @param InitRadius Initial radius, multiplier relative to the default |
| 77 | * sigma value. |
| 78 | */ |
| 79 | |
| 80 | void init( CBiteRnd& rnd, const double* const InitParams = NULL, |
| 81 | const double InitRadius = 1.0 ) |
| 82 | { |
| 83 | initCommonVars( rnd ); |
| 84 | |
| 85 | StartSD = 0x1p-4 * InitRadius; |
| 86 | setStartParams( InitParams ); |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Function performs the parameter optimization iteration that involves 1 |
| 91 | * objective function evaluation. |
| 92 | * |
| 93 | * @param rnd Random number generator. |
| 94 | * @return The number of non-improving iterations so far. |
| 95 | */ |
| 96 | |
| 97 | int optimize( CBiteRnd& rnd ) |
| 98 | { |
| 99 | int i; |
| 100 | |
| 101 | if( DoInitEvals ) |
nothing calls this directly
no outgoing calls
no test coverage detected