1
00:00:00,610 --> 00:00:08,770
Hello and welcome to this lecture, where we are going to generate a graph to better visualize the results

2
00:00:09,250 --> 00:00:12,760
going back to our genetic algorithm glass.

3
00:00:13,060 --> 00:00:17,560
We can see these attributes list of solutions.

4
00:00:17,980 --> 00:00:27,760
It was initialized as an empty list and now we are going to put in each position of the list.

5
00:00:28,360 --> 00:00:35,500
The best solutions are the best individual in each one of the generations.

6
00:00:35,890 --> 00:00:47,200
Let's go back to our sole function and after our during the population, we will access our attributes.

7
00:00:47,200 --> 00:00:54,130
Based solution equals self population in position zero.

8
00:00:54,370 --> 00:01:03,280
After we are order, we know that the best solution is in this position and we are starting needs in

9
00:01:03,280 --> 00:01:05,380
these three boat here.

10
00:01:05,800 --> 00:01:09,850
Then we will access our new lists.

11
00:01:10,510 --> 00:01:12,250
Self thoughts.

12
00:01:12,430 --> 00:01:14,470
List of solutions.

13
00:01:15,040 --> 00:01:16,420
Thoughts of bands.

14
00:01:16,900 --> 00:01:20,080
Self based solution.

15
00:01:20,560 --> 00:01:21,310
Thoughts.

16
00:01:22,150 --> 00:01:24,100
Score evaluation.

17
00:01:24,370 --> 00:01:26,650
So we are adding to the list.

18
00:01:26,950 --> 00:01:31,500
The best solution of the first generation.

19
00:01:31,990 --> 00:01:42,520
And then after setting the best solution regarding the other generations, we will access again our

20
00:01:42,520 --> 00:01:44,530
list of solutions.

21
00:01:45,140 --> 00:01:47,260
Thoughts up bands.

22
00:01:48,130 --> 00:01:53,000
And again, let's specify here best thoughts.

23
00:01:53,260 --> 00:01:57,040
Our evaluation, which is the total price.

24
00:01:57,520 --> 00:02:02,620
Let's run this code again, should create the glass.

25
00:02:03,190 --> 00:02:08,440
Run this part of the code again to have the solutions.

26
00:02:08,780 --> 00:02:13,900
Basically, this code Winkler meant it's now is a story.

27
00:02:14,080 --> 00:02:24,430
Each one of these values here we can see that's the best solution is in generation number 20.

28
00:02:24,910 --> 00:02:32,950
Let's open a new set of codes just to make sure the variable was created correctly.

29
00:02:33,280 --> 00:02:39,610
Let's implement that for a loop for our value in genetic algorithm.

30
00:02:39,760 --> 00:02:44,980
List of solutions and let's Bryants the values.

31
00:02:45,280 --> 00:02:54,340
As we can see here, we have the list of the best individuals regarding each one of the generations.

32
00:02:54,700 --> 00:03:04,820
Now let's go to the graph boards bloodily boards xpress aspects.

33
00:03:05,230 --> 00:03:14,950
This is a very nice library to work with graphs, and by then I will create a Figure B X dots line.

34
00:03:15,280 --> 00:03:19,510
It is a line graph in the x axis.

35
00:03:19,900 --> 00:03:31,600
We will puts the range from zero to one hundred and one, so it will goes from zero to 100 because that

36
00:03:31,600 --> 00:03:39,010
are 100 generations and regarding y axis genetic algorithm.

37
00:03:39,520 --> 00:03:44,800
List of solutions we can specify the title of the graph.

38
00:03:45,220 --> 00:03:49,810
For example, genetic algorithm results.

39
00:03:50,260 --> 00:03:56,560
Finally, lets type your lot show to see the results.

40
00:03:56,950 --> 00:04:04,360
Let's run these codes, and now you can see a very nice graph showing all the results.

41
00:04:04,960 --> 00:04:16,080
For example, generation zero, their result was nine then generation 20, which was the best one twenty

42
00:04:16,090 --> 00:04:17,320
four thousand.

43
00:04:17,680 --> 00:04:27,310
In other generations, for example, thirty two, we have the results and then you can follow their

44
00:04:27,310 --> 00:04:30,670
values in order to check the results.

45
00:04:31,120 --> 00:04:37,870
We can also run this code again every time you run this code.

46
00:04:37,930 --> 00:04:40,630
You will get different results.

47
00:04:41,050 --> 00:04:46,990
Now, the best one was found on generation nine to one.

48
00:04:47,770 --> 00:04:49,930
Let's run this code again.

49
00:04:49,990 --> 00:04:51,430
Just see the new graph.

50
00:04:51,790 --> 00:04:55,120
It is quite different from the other one.

51
00:04:55,420 --> 00:05:00,040
And this graph is very useful, especially when you.

52
00:05:00,120 --> 00:05:10,170
Run the called for margin operations, for example, 5000, 10000 generations, so you can easily find

53
00:05:10,170 --> 00:05:12,930
where the best solution is.

54
00:05:13,440 --> 00:05:17,850
And I encourage you to change this parameters.

55
00:05:18,090 --> 00:05:27,570
For example, if you are working in a real world problem regarding trucks, you can change these limits

56
00:05:27,630 --> 00:05:28,170
here.

57
00:05:28,440 --> 00:05:36,240
According to the size of the truck, and you can also add more products here.

58
00:05:36,570 --> 00:05:42,480
Change the population, size the number of generations and so on.

59
00:05:42,840 --> 00:05:53,340
As this problem is quite small, there are only Fardeen products when running this code for only 100

60
00:05:53,610 --> 00:05:56,970
generations, we can get good results.

61
00:05:57,240 --> 00:06:04,900
However, if you are working in our real world projects, maybe you need to change its parameters,

62
00:06:04,920 --> 00:06:10,080
increasing the population size and also the number of generations.

63
00:06:10,440 --> 00:06:12,210
And that's all for this lecture.

64
00:06:12,450 --> 00:06:13,740
See you next time.
