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

Method update

spheropt.h:262–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260 */
261
262 void update( CBiteRnd& rnd )
263 {
264 static const double WCent[ 4 ] = { 4.5, 6.0, 7.5, 10.0 };
265 static const double WRad[ 4 ] = { 14.0, 16.0, 18.0, 20.0 };
266 static const double EvalFacs[ 3 ] = { 2.1, 2.0, 1.9 };
267
268 const double CentFac = WCent[ select( CentPowSel, rnd )];
269 const double RadFac = WRad[ select( RadPowSel, rnd )];
270 EvalFac = EvalFacs[ select( EvalFacSel, rnd )];
271
272 const double lm = 1.0 / curem;
273 double s1 = 0.0;
274 double s2 = 0.0;
275 int i;
276
277 for( i = 0; i < CurPopSize; i++ )
278 {
279 const double l = 1.0 - i * lm;
280
281 const double v1 = pow( l, CentFac );
282 WPopCent[ i ] = v1;
283 s1 += v1;
284
285 const double v2 = pow( l, RadFac );
286 WPopRad[ i ] = v2;
287 s2 += v2;
288 }
289
290 s1 = 1.0 / s1;
291 s2 = 1.0 / s2;
292
293 const double* ip = PopParams[ 0 ];
294 double* const cp = CentParams;
295 const double* const wc = WPopCent;
296 double w = wc[ 0 ] * s1;
297
298 for( i = 0; i < ParamCount; i++ )
299 {
300 cp[ i ] = ip[ i ] * w;
301 }
302
303 int j;
304
305 for( j = 1; j < CurPopSize; j++ )
306 {
307 ip = PopParams[ j ];
308 w = wc[ j ] * s1;
309
310 for( i = 0; i < ParamCount; i++ )
311 {
312 cp[ i ] += ip[ i ] * w;
313 }
314 }
315
316 const double* const rc = WPopRad;
317 Radius = 0.0;
318
319 for( j = 0; j < CurPopSize; j++ )

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected