# Genetic Algorithm

Printable View

• July 1st 2009, 10:14 AM
Sampras
Genetic Algorithm
Find the value of $x$ that maximizes $\sin^{4}(x)$, $0 \leq x \leq \pi$ to an accuracy of at least one part in a million. Use a population size of fifty and a mutation rate of $1/(\text{twice the length of string})$.

So randomly select a population of 50 binary string of length 8. Decode them into base 10. Look at their fitness levels (e.g. $\sin^{4}(x)$). Now exclude $25$ of the strings with the lowest fitness levels. Use crossover between random pairs of strings to get 25 "child strings." Now use a mutation rate of $1/16$ on this new population of strings? Because you dont want a population of strings with end digit 0. This will cause domination.

Is this generally correct? How would you decide the length of the strings?
• July 2nd 2009, 09:28 AM
Sampras
The maximum value of $\sin x$ is $1$. So the maximum value of $\sin^{4} x$ is $1$. So maybe use a string length of $3$? Because $111 = 7$ in base 10.
All times are GMT -8. The time now is 01:00 PM.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 13, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.8641897439956665, "perplexity_flag": "middle"}