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

Method generateSol9

biteopt.h:1333–1364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1331 */
1332
1333 void generateSol9( CBiteRnd& rnd )
1334 {
1335 ptype* const Params = TmpParams;
1336
1337 const ptype* const rp1 = getParamsOrdered(
1338 rnd.getInt( CurPopSize ));
1339
1340 const ptype* const rp2 = getParamsOrdered(
1341 rnd.getSqrIntInv( CurPopSize ));
1342
1343 int i;
1344
1345 // Such overall sign inversion seems unuseful, but has benefits in
1346 // practice.
1347
1348 if( rnd.getBit() )
1349 {
1350 for( i = 0; i < ParamCount; i++ )
1351 {
1352 Params[ i ] = rp1[ i ] - (( rp2[ i ] - rp1[ i ]) >> 1 ) *
1353 ( 1 - 2 * rnd.getBit() );
1354 }
1355 }
1356 else
1357 {
1358 for( i = 0; i < ParamCount; i++ )
1359 {
1360 Params[ i ] = rp1[ i ] + (( rp2[ i ] - rp1[ i ]) >> 1 ) *
1361 ( 1 - 2 * rnd.getBit() );
1362 }
1363 }
1364 }
1365
1366 /**
1367 * Solution generator based on SpherOpt's converging hyper-spheroid.

Callers

nothing calls this directly

Calls 3

getIntMethod · 0.80
getSqrIntInvMethod · 0.80
getBitMethod · 0.80

Tested by

no test coverage detected