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

Method init

smaesopt.h:80–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 */
79
80 void init( CBiteRnd& rnd, const double* const InitParams = NULL,
81 const double InitRadius = 1.0 )
82 {
83 initCommonVars( rnd );
84
85 cure = 0;
86 curem = (int) ceil( CurPopSize * Ort.EvalFac );
87
88 // Provide initial centroid and sigma (PopParams is used here
89 // temporarily, otherwise initially undefined).
90
91 const double sd = 0.25 * InitRadius;
92 int i;
93
94 if( InitParams == NULL )
95 {
96 for( i = 0; i < ParamCount; i++ )
97 {
98 PopParams[ 0 ][ i ] = MinValues[ i ] + DiffValues[ i ] * 0.5;
99 PopParams[ 1 ][ i ] = fabs( DiffValues[ i ]) * sd;
100 }
101 }
102 else
103 {
104 for( i = 0; i < ParamCount; i++ )
105 {
106 PopParams[ 0 ][ i ] = InitParams[ i ];
107 PopParams[ 1 ][ i ] = fabs( DiffValues[ i ]) * sd;
108 }
109 }
110
111 Ort.init( PopParams[ 0 ], PopParams[ 1 ]);
112 }
113
114 /**
115 * Function samples a random population vector based on the current

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected