# What is the meaning of `we search for a 1 filled list individual`

I am looking a python lib named `deap`, but stuck at beginning.

The first paragraph says:

This is the first complete example built with DEAP. It will help new users to overview some of the framework possibilities. The problem is very simple, we search for a 1 filled list individual. This problem is widely used in the evolutionary computation community since it is very simple and it illustrates well the potential of evolutionary algorithms.

What I can't understand is:

The problem is very simple, we search for a 1 filled list individual.

Sorry for my poor English, but it is realy quite hard to understand for me.
What is `1 filled list` means? Search a 1 filled list , from where? individual list or individual 1 ?

PS: I remove some research about this question because those are in datascience area, not relate to English, if you want to see can go here .

• I have no idea what a "1 filled list" is. It is not standard English, and may be a CS or Python term. I suggest you ask in Computational Science.SE or one of related computing sites.
– Mick
Commented Dec 13, 2016 at 7:12
• Not very farther down the page, "Let see an example of how to use the creator ...", which is a mistake. This makes me wonder if "a 1 filled list individual" is a correct term. My guess for the intended meaning is either "an individual in a filled list" or "an individual, which is a filled list". Reading everything all the page should clear this point. Commented Dec 13, 2016 at 7:15
• I understand the author now. In the middle of the page, "The evaluation function is pretty simple in this case, we need to count the number of ones in the individual. This is done by the following lines of code." So, they want to search for a list that is called "Individual" (see `creator.create` in the code) that contains all 1's (i.e. each and every individual in the list has the value 1). Commented Dec 13, 2016 at 7:21

I don't understand a `1` filled list individual, either.

Because if I read it like English, it should be an individual that is an "1 filled list".
And the idea of an individual that is an "1 filled list" doesn't make sense to me.

To understand the intended meaning, I had to read more of the page. Fortunately, the author provides enough information and source code to make this understandable.

Around the middle of the page:

The evaluation function is pretty simple in this case, we need to count the number of ones in the individual. This is done by the following lines of code.

``````def evalOneMax(individual):
return sum(individual),
``````

Scrolling up a page or two, you will see this code:

``````creator.create("FitnessMax", base.Fitness, weights=(1.0,))
creator.create("Individual", list, fitness=creator.FitnessMax)
``````

And under the section Toolbox, there is this code:

``````toolbox.register("individual", tools.initRepeat, creator.Individual,
toolbox.attr_bool, 100)
toolbox.register("population", tools.initRepeat, list, toolbox.individual)
``````

And under the section Create the Population, there is this code:

``````def main():
pop = toolbox.population(n=300)
``````

So, individual (i.e., `Individual`) is a list. It's a list that is initialized by a random generator returning either 0 or 1 (`toolbox.attr_bool()`). Each individual is a 100-element list (see the line with `toolbox.register`). You can think of these 100 elements of each individual, which is a list in the code, as "genes". The entire population has 300 individuals (see the line with `toolbox.population`), and these 300 hundred individuals mate and mutate (see the details in the section The Appeal of Evolution). In other words the code "evolve" the population, from one generation to another generation. After a certain number of generations (which is pre-defined, elsewhere, not in the code we can see on that page), the program will stop and start tallying the stats.

This is, as that page is titled, the OneMax problem.

At this point, I think I can really understand why the author chose to name it a `1` filled list individual, and write we search for a `1` filled list individual, though I wouldn't personally phrase it that way. (I might write We examine individuals which are implemented as lists of zeros and ones.)

But according to the page, the code examines individuals (in the population), and it happens that each individual is implemented as a list, and because each element (i.e., a "gene") in this list is either zero or one, the author calls each individual a `1` filled list individual.

• Thanks for the detail explanation.Though I read the entire doc but still cound't get the reason why they generate random list and search all-ones list. By reading many articles about genetic-algorithm usage help me understand this kind of algorithm. Additional remark by my understanding: this is a genetic-algorithm, it is used to evolve `populations`, which consist of many `Individual `(groups of patterns, combinations, parameters or something similar) , `Individual ` would mutate in evolution, the purpose is to get the best one fit fitness function(`evalOneMax` here) . Commented Dec 14, 2016 at 0:57