can we determine input varibles accuracy in genetic algorithm?

hello dears,
I'm using genetic algorithm in matlab and i have two input variables (they are temperatures). I want the variables have the exact accuracy of 0.1. Is this possible?

3 Comments

What does it mean that a variable has an accuracy of 0.1? Do you mean that you want the input to always equal 0.1?
no i mean the inputs be like 5.3 or 7.4 or 58.6 ...... in the optimization i get numbers like 1.008 or 2.358 ....... but i want the genetic algorithm consider inputs with just one decimal number.
Ahh.... that's 'precision', not accuracy.

Sign in to comment.

 Accepted Answer

You can round the numbers to one decimal place like this.
round(x*10)/10
Also note the 2nd optional input to round() since r2014b.

5 Comments

thanks for your thorough answer but this can act just on output values I want the inputs have 0.1 precision. i want the input numbers that are given to my program by ga have 0.1 precision.
Where are the inputs coming from? What's preventing you from doing the rounding just before the numbers go into the algorithm? maybe I'm not understanding the problem.
Ahhhhhhhhhh............. now I got it!!!!Yes this is a good way thanks a lot.
Another question: Is'nt there any way that ga takes inputs with 0.1 precision itself without us doing it?may be by some change in the options or ....?
thanks a lot for all your help and attention.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!