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

Method generateSol11

biteopt.h:1428–1464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1426 */
1427
1428 void generateSol11( CBiteRnd& rnd )
1429 {
1430 ptype* const Params = TmpParams;
1431
1432 const ptype* const rp0 = getParamsOrdered(
1433 rnd.getInt( CurPopSize ));
1434
1435 const ptype* const rp1 = getParamsOrdered(
1436 rnd.getPowInt( 4.0, CurPopSize ));
1437
1438 const ptype* const rp2 = getParamsOrdered(
1439 rnd.getSqrIntInv( CurPopSize ));
1440
1441 double s1 = 1e-300;
1442 double s2 = 1e-300;
1443 double d;
1444 int i;
1445
1446 for( i = 0; i < ParamCount; i++ )
1447 {
1448 d = (double) ( rp1[ i ] - rp2[ i ]);
1449 s1 += d * d;
1450
1451 NewValues[ i ] = rnd.get() - 0.5;
1452 s2 += NewValues[ i ] * NewValues[ i ];
1453 }
1454
1455 const double m1 = sqrt( ParamCountI ) * 0.5;
1456 const double m0 = 1.0 - m1;
1457 d = sqrt( s1 * ParamCountI / s2 ) * 2.0;
1458
1459 for( i = 0; i < ParamCount; i++ )
1460 {
1461 Params[ i ] = (ptype) ( rp0[ i ] * m0 + rp1[ i ] * m1 +
1462 NewValues[ i ] * d );
1463 }
1464 }
1465
1466 /**
1467 * Solution generator that estimates population's standard deviation using

Callers

nothing calls this directly

Calls 4

getIntMethod · 0.80
getPowIntMethod · 0.80
getSqrIntInvMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected