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

Method generateSol12

biteopt.h:1472–1498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1470 */
1471
1472 void generateSol12( CBiteRnd& rnd )
1473 {
1474 ptype* const Params = TmpParams;
1475
1476 const ptype* const rp1 = getParamsOrdered(
1477 rnd.getSqrInt( CurPopSize ));
1478
1479 const ptype* const rp2 = getParamsOrdered(
1480 rnd.getSqrIntInv( CurPopSize ));
1481
1482 const ptype* const rpc = getCentroid();
1483 double r = 0.0;
1484 int i;
1485
1486 for( i = 0; i < ParamCount; i++ )
1487 {
1488 const double d1 = (double) ( rp2[ i ] - rp1[ i ]);
1489 r += d1 * d1;
1490 }
1491
1492 r = sqrt( r / ParamCount );
1493
1494 for( i = 0; i < ParamCount; i++ )
1495 {
1496 Params[ i ] = rpc[ i ] + (ptype) ( rnd.getGaussian() * r );
1497 }
1498 }
1499
1500 /**
1501 * Solution generator that applies Differential Evolution in real

Callers

nothing calls this directly

Calls 3

getSqrIntMethod · 0.80
getSqrIntInvMethod · 0.80
getGaussianMethod · 0.80

Tested by

no test coverage detected