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

Method generateSol5c

biteopt.h:1121–1157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1119 */
1120
1121 void generateSol5c( CBiteRnd& rnd )
1122 {
1123 ptype* const Params = TmpParams;
1124
1125 const CBitePop& ParPop = selectParPop( 6, rnd );
1126 const int ParPopSize = ParPop.getCurPopSize();
1127
1128 const ptype* const rp1 = ParPop.getParamsOrdered(
1129 rnd.getSqrInt( ParPopSize ));
1130
1131 const ptype* const rp2 = ParPop.getParamsOrdered(
1132 rnd.getSqrInt( ParPopSize ));
1133
1134 const ptype* const rp3 = ParPop.getParamsOrdered(
1135 rnd.getSqrIntInv( ParPopSize ));
1136
1137 int i;
1138
1139 for( i = 0; i < ParamCount; i++ )
1140 {
1141 // Produce a bit-mixing mask.
1142
1143 ptype crm = ( (ptype) 1 << rnd.getInt( IntMantBits )) - 1;
1144
1145 if( rnd.getBit() )
1146 {
1147 crm ^= IntMantMask;
1148 }
1149
1150 Params[ i ] = ( rp1[ i ] & crm ) | ( rp2[ i ] & ~crm );
1151
1152 // Randomize, depending on difference between better and worse
1153 // parameter values.
1154
1155 Params[ i ] += (ptype) (( rp1[ i ] - rp3[ i ]) * rnd.getTPDF() );
1156 }
1157 }
1158
1159 /**
1160 * A short-cut solution generator. Parameter value short-cuts: they

Callers

nothing calls this directly

Calls 7

getCurPopSizeMethod · 0.80
getParamsOrderedMethod · 0.80
getSqrIntMethod · 0.80
getSqrIntInvMethod · 0.80
getIntMethod · 0.80
getBitMethod · 0.80
getTPDFMethod · 0.80

Tested by

no test coverage detected