| 566 | */ |
| 567 | |
| 568 | void generateSol1( CBiteRnd& rnd ) |
| 569 | { |
| 570 | ptype* const Params = TmpParams; |
| 571 | |
| 572 | const CBitePop& ParPop = selectParPop( 0, rnd ); |
| 573 | const int ParPopSize = ParPop.getCurPopSize(); |
| 574 | |
| 575 | copyParams( Params, ParPop.getParamsOrdered( |
| 576 | getMinSolIndex( 0, rnd, ParPopSize ))); |
| 577 | |
| 578 | // Select a single random parameter or all parameters for further |
| 579 | // operations. |
| 580 | |
| 581 | int a; |
| 582 | int b; |
| 583 | bool DoAllp = false; |
| 584 | |
| 585 | if( rnd.get() < 1.8 * ParamCountI ) |
| 586 | { |
| 587 | if( select( Gen1AllpSel, rnd )) |
| 588 | { |
| 589 | DoAllp = true; |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | if( DoAllp ) |
| 594 | { |
| 595 | a = 0; |
| 596 | b = ParamCount; |
| 597 | } |
| 598 | else |
| 599 | { |
| 600 | a = rnd.getInt( ParamCount ); |
| 601 | b = a + 1; |
| 602 | } |
| 603 | |
| 604 | // Bitmask inversion operation, works as the main "driver" of |
| 605 | // optimization process. |
| 606 | |
| 607 | const double r1 = rnd.get(); |
| 608 | const double r12 = r1 * r1; |
| 609 | const int ims = (int) ( r12 * r12 * 48.0 ); |
| 610 | const ptype imask = ( ims > IntMantBits ? 0 : IntMantMask >> ims ); |
| 611 | |
| 612 | const int im2s = rnd.getSqrInt( 96 ); |
| 613 | const ptype imask2 = ( im2s > IntMantBits ? 0 : IntMantMask >> im2s ); |
| 614 | |
| 615 | const int si1 = (int) ( r1 * r12 * ParPopSize ); |
| 616 | const ptype* const rp1 = ParPop.getParamsOrdered( si1 ); |
| 617 | int i; |
| 618 | |
| 619 | for( i = a; i < b; i++ ) |
| 620 | { |
| 621 | Params[ i ] = (( Params[ i ] ^ imask ) + |
| 622 | ( rp1[ i ] ^ imask2 )) >> 1; |
| 623 | } |
| 624 | |
| 625 | if( rnd.get() < 1.0 - ParamCountI ) |
nothing calls this directly
no test coverage detected