Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are not allowed to use advanced data structures such as lists, Tuples, Sets, Dictionaries, Classes, etc. Use of these prohibited concepts earns zero points

You are not allowed to use advanced data structures such as lists, Tuples, Sets, Dictionaries, Classes,
etc. Use of these prohibited concepts earns zero points for the whole project. The goal of this project is to implement a simple genetic algorithm. We call it GeneticGuess Sentencer.
GeneticGuess Sentencer utilizes a basic genetic algorithm to... guess sentences! The user will enter a sentence,
a string composed of lowercase-letters and spaces. Then, it will use strategic randomization to get the users
sentence from several random strings. You will implement the basic genetic algorithm structure, including
several short (but important) functions. The basis of this project can be reused for other problems if you are
interested in it! D5.1.1 Genetic Algorithm Basics
Genetic algorithms work similar to real-life genes and evolutionary principles. You begin by creating a
population. This population will crossover and mutate with one another by selecting individuals with high
fitness. The result of this process leads to a new population, or a new generation. The process works like this:
There are multiple ways to implement the population, fitness, selection, crossover, and mutation. We will focus
on one method of each.
5.2 Population
The population is a large number of individuals. We have set the population size in the variable
NUM POPULATION. The entire population will be stored in a string of length NUM POPULATION
times the length of each individual. The length of each individual will be the length of the target sentence,
provided by the user. As the program continues through several generations, the population will collect
individuals that look more and more similar to the target string. To create an individual, use
random. choice () with a string of lowercase letters and a space (defined as ALPHABET in the starter
code). Do it in this order so your results match the testcases!
Do not separate the individuals by a space. You have the length of the target sentence, so you know where
to split the string for each individual.
For example, try this code:
import random
random. seed (10)
x- "welcome"
print (random.choice (x)) to
print (random.choice (x)) iw
Example
NUM POPULATION =2
Target = "hello workl"
population = "haskd als ajs foj oa j]
*each individual is highlighted
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago