Hello and welcome to this lecture, where we are going to implement another step of the genetic algorithm.
Last lecture, we implemented the codes to evaluate the population and also order the results.
We are keeping the best solutions should they lower positions of the list.
And now we will continue talking about the evaluation.
We can see here the results.
For example, in the first position of the list, we can see the best solution.
Fifteen thousand five hundred and forty four.
And in this sad composition, this score is equal to fifteen thousand one hundred and thirty two.
And now what we need to do is to set the best solution to our genetic algorithm objects.
For example, before we had defined these three here, best solution initialized as none.
And when we initialize the population, we are setting the best solution, as the first was the issue
of the list position number zero.
However, at this point of these codes, we haven't ordered the population yet, so we need to implement
another function chalkboards.
The first was the issue of the list should these best solution here.
So we are going to implement and the will function bethe best individual it will receive as a barometer,
ie specific individual.
And we are going to implement an if statement if individual dots score evaluation is greater than the
best solution, but score evaluation.
We are comparing this score of the parameter that we are going to sans with this score of the best solution,
which is these are true both here, which is initialized as the first position.
We will do some tests in some sequence, then it will be easier to understand.
So let's axis self based solution.
If this if statement is true, the best solution we receive the individual let's run this code again
should create the glass.
Let's go back to this part of the implementation.
I will create a new population.
We can check the values here.
Let's run this sale of codes.
We can see that's the first position is the best results and the last position is the worst results.
Now we can take a look at the values genetic algorithm based solution, the attributes.
Let's take a look at the score, which is equal to five thousand, which means these individual 16.
So when we initialize the the population for the first time, this individual 16 was in the first position
of the list in position number zero and see that the value is not a good solution.
So now when this to gets the best individual off this list and boards in these attribute here, the
best solution.
Just to compare the results, we can access genetic algorithm population in position zero.
Let's see.
Score evaluation.
Run this code.
See that the bad their value is seventeen thousand exactly the same we have here in the first position
of the list.
Now we can just call our new function genetics.
Or Adam Dot's best individual and the wind is to sand as a barometer.
The first elements of the list, let's run this codes.
That's if statement we implement it will be executed, so we will just change the individuals before
the best in the video.
Was this one here?
VIDEO 16.
And now that basked in the video of the population is the first position of the list.
To see the results, we can just copy paste and run these codes.
Before this was the best solution, and now we change, it's should the best solution.
Considering the ordered list, it's a very simple function just to update these attributes here.
We can also take a look at the chromosome genetic algorithm based solution thoughts from a sun room.
This codes we can see here the list of products that we are going to load on the truck to get this value
here in the next lecture, we are going to continue the implementation.
See you there!