I have a binary vector of 32 bit. This vector represents an integer in my solution space. Now I want to perform exploitation in this vector for searching in the search space.I have learnt that I have to flip more bits around the LSB in the binary string to perform exploitation.So,I thought of generating an exponential distribution and mutate(flip) the bits according to it.Will it be a viable solution. ?
Also ,it would be a great help if somebody could please help with the code.I am having a hard time coding this logic.I was trying to do something like this :
double exploit_probs[32]={2.1760605535605863e-14,5.915145860370273e-14,1.6079033504929256e-13,4.3707344595633353e-13,1.1880888058450779e-12,3.229560211524282e-12,8.778854836900806e-12,2.3863401577827254e-11,6.486745087422874e-11,1.763280129698758e-10,4.793092335043042e-10,1.3028975796473835e-09,3.5416428150987542e-09,9.627183307175482e-09,2.6169397443139367e-08,7.113579753140834e-08,1.933671457825691e-07,5.256263986017488e-07,1.4288006878775044e-06,3.883882946347204e-06,1.0557488436917582e-05,2.869822897223955e-05,7.800987432419569e-05,0.00021205282381583498,0.0005764193376520116,0.001566870211111862,0.004259194822419162,0.011577691889648859,0.031471429479130154,0.08554821486874982,0.23254415793483257,0.6321205588285657};
int i=0;
for(int k=0;k<32;k++){
if( (rand()/RAND_MAX) < exploit_probs[i++]){
if(key[k]==0){ //key is the binary array.
key[k]=1;
}
else{
key[k]=0;
}
}
}
But ,I feel the above code will be biased ,since rand()/RAND_MAX will generate values between 0-1.But my probability distribution ranges from 2.1760605535605863e-14 to 0.6321205588285657.So there is very less probability that my bits will be flipped.The last bits has 63% chance of getting flipped.