| 44 | */ |
| 45 | |
| 46 | class CNMSeqOpt : public CBiteOptBase< double > |
| 47 | { |
| 48 | public: |
| 49 | CNMSeqOpt() |
| 50 | : y( NULL ) |
| 51 | , x2( NULL ) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | virtual ~CNMSeqOpt() |
| 56 | { |
| 57 | delete[] y; |
| 58 | delete[] x2; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Function updates dimensionality of *this object. |
| 63 | * |
| 64 | * @param aParamCount The number of parameters being optimized. |
| 65 | * @param PopSize0 The number of elements in population to use. If set to |
| 66 | * 0 or negative, the default formula will be used. |
| 67 | */ |
| 68 | |
| 69 | void updateDims( const int aParamCount, const int PopSize0 = 0 ) |
| 70 | { |
| 71 | const int aPopSize = ( PopSize0 > 0 ? PopSize0 : |
| 72 | ( aParamCount + 1 ) * 4 ); |
| 73 | |
| 74 | if( aParamCount == ParamCount && aPopSize == PopSize ) |
| 75 | { |
| 76 | return; |
| 77 | } |
| 78 | |
| 79 | N = aParamCount; |
| 80 | M = aPopSize; |
| 81 | M1 = aPopSize - 1; |
| 82 | M1i = 1.0 / M1; |
| 83 | |
| 84 | initBuffers( N, M ); |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Function initializes *this optimizer. Performs N=PopSize objective |
| 89 | * function evaluations. |
| 90 | * |
| 91 | * @param rnd Random number generator. |
| 92 | * @param InitParams If not NULL, initial parameter vector, also used as |
| 93 | * centroid. |
| 94 | * @param InitRadius Initial radius, relative to the default value. |
| 95 | */ |
| 96 | |
| 97 | void init( CBiteRnd& rnd, const double* const InitParams = NULL, |
| 98 | const double InitRadius = 1.0 ) |
| 99 | { |
| 100 | initCommonVars( rnd ); |
| 101 | |
| 102 | double* const xx = x[ 0 ]; |
| 103 | int i; |
nothing calls this directly
no outgoing calls
no test coverage detected