| 711 | */ |
| 712 | |
| 713 | void generateSol2b( CBiteRnd& rnd ) |
| 714 | { |
| 715 | ptype* const Params = TmpParams; |
| 716 | |
| 717 | // rand/2/none DE-alike mutation. |
| 718 | |
| 719 | const int si1 = getMinSolIndex( 2, rnd, CurPopSize ); |
| 720 | const ptype* const rp1 = getParamsOrdered( si1 ); |
| 721 | |
| 722 | const int si2 = rnd.getInt( CurPopSize ); |
| 723 | const ptype* const rp2 = getParamsOrdered( si2 ); |
| 724 | const ptype* const rp3 = getParamsOrdered( CurPopSize1 - si2 ); |
| 725 | |
| 726 | const CBitePop& AltPop = selectAltPop( 0, rnd ); |
| 727 | |
| 728 | const int si4 = rnd.getInt( CurPopSize ); |
| 729 | const ptype* const rp4 = AltPop.getParamsOrdered( si4 ); |
| 730 | const ptype* const rp5 = AltPop.getParamsOrdered( CurPopSize1 - si4 ); |
| 731 | |
| 732 | const int Mode = select( Gen2bModeSel, rnd ); |
| 733 | int i; |
| 734 | |
| 735 | if( Mode == 0 ) |
| 736 | { |
| 737 | for( i = 0; i < ParamCount; i++ ) |
| 738 | { |
| 739 | Params[ i ] = rp1[ i ] + ((( rp2[ i ] - rp3[ i ]) + |
| 740 | ( rp4[ i ] - rp5[ i ])) >> 1 ); |
| 741 | } |
| 742 | } |
| 743 | else |
| 744 | { |
| 745 | const ptype* const rp1b = getParamsOrdered( |
| 746 | rnd.getSqrInt( CurPopSize )); |
| 747 | |
| 748 | for( i = 0; i < ParamCount; i++ ) |
| 749 | { |
| 750 | Params[ i ] = ( rp1[ i ] + rp1b[ i ] + |
| 751 | ( rp2[ i ] - rp3[ i ]) + ( rp4[ i ] - rp5[ i ])) >> 1; |
| 752 | } |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | /** |
| 757 | * "Differential Evolution"-based solution generator, almost an exact |
nothing calls this directly
no test coverage detected