Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Question: Use binary coded GA(Genetic algorithms), your problem is to find vector with real numbers $\in [0,5]$ and you want your answer at least to three decimal places(0.001).

a) How many bits you need to represent one variable

b) the dimension of your problem is 10 or you optimize ten variables. How many integers( 16 or 32 bits) you need when programming the problem, in case you use bit-fields, in which you have reserved for each variable the bits it exactly needs?

share|improve this question
2  
There are 5001 possible different values of each variable. What is the smallest $n$ such that $2^n$ is at least 5001? –  Henning Makholm Feb 13 '12 at 16:37
    
$5001<2^{13}$, but what it has to do with the problem a)? Do you mean that you need 13 bits( what is bit?) to represent one variable? –  laovultai Feb 13 '12 at 16:45
1  
Bit is a binary digit. It can store one of 2 values: 0 and 1. By using combinations of 0 & 1, you can represent any number. For instance, 7 in Binary is 0111. en.wikipedia.org/wiki/Bit –  Inquest Feb 13 '12 at 16:47
    
No, this isn't "my problem". Do your own homework. –  user5137 May 24 '12 at 16:31
add comment

1 Answer

up vote 1 down vote accepted

Since the problem is still open, let me take a shot at it.

For one variable, if you store the integer part separately and the decimal part separately, you need $3$ bits for real numbers $\in [0,5]$ and the decimal part could be $0.001$ upto $0.999$ (since your condition was three decimal places). Which means the decimal part storage needs $$\left\lceil log_2 \hspace{4pt}999 \right\rceil = 10 $$

Therefore for a single variable you need $3$ bits for real part and $10$ bits for decimal part.

For part b, if you are optimizing $10$ variables, it depends if what kind of arithmetic or computation you have with those variables. If multiplication and exponents are also involved, you have to know the bounds of those computation, then one can make a reasonable justification.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.