MCPcopy Create free account
hub / github.com/avaneev/biteopt / CMiniBiteOpt

Class CMiniBiteOpt

mbopt.h:48–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 */
47
48class CMiniBiteOpt : public CBiteOptBase< double >
49{
50public:
51 CMiniBiteOpt()
52 : ParOpt( this )
53 {
54 addSel( MethodSel, "MethodSel" );
55 }
56
57 /**
58 * Function updates dimensionality of *this object. Function does nothing
59 * if dimensionality has not changed since the last call. This function
60 * should be called at least once before calling the init() function.
61 *
62 * @param aParamCount The number of parameters being optimized.
63 * @param PopSize0 The number of elements in population to use. If set to
64 * 0 or negative, the default formula will be used.
65 */
66
67 void updateDims( const int aParamCount, const int PopSize0 = 0 )
68 {
69 const int aPopSize = ( PopSize0 > 0 ? PopSize0 :
70 calcPopSizeBiteOpt( aParamCount ));
71
72 if( aParamCount == ParamCount && aPopSize == PopSize )
73 {
74 return;
75 }
76
77 initBuffers( aParamCount, aPopSize );
78
79 ParOpt.updateDims( aParamCount, aPopSize * 4 / 3 );
80 }
81
82 /**
83 * Function initializes *this optimizer. Does not perform objective
84 * function evaluations.
85 *
86 * @param rnd Random number generator.
87 * @param InitParams If not NULL, initial parameter vector, also used as
88 * centroid for initial population vectors.
89 * @param InitRadius Initial radius, multiplier relative to the default
90 * sigma value.
91 */
92
93 void init( CBiteRnd& rnd, const double* const InitParams = NULL,
94 const double InitRadius = 1.0 )
95 {
96 initCommonVars( rnd );
97
98 StartSD = 0.25 * InitRadius;
99
100 if( InitParams != NULL )
101 {
102 copyParams( StartParams, InitParams );
103 UseStartParams = true;
104 }
105

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected