应用遗传算法求解机器人路径规划问题Python代码程序
立即下载
资源介绍:
机器人的世界由100个正方形组成,这些正方形排列成10*10的网格,每个正方形最多只能有一个汽水罐。无论他现在在哪里,他都可以看到北、南、东、西方向上一个相邻网站的内容,以及他目前所在网站的内容。
每个单独的策略都是243个行动的列表。每个动作由以下七个选项之一组成:向北移动、向南移动、向东移动、向西移动、选择一个随机方向移动、站起来或弯腰捡起罐头。
每个行为都可能产生奖励或惩罚。
如果机器人和罐子在同一个地方并捡起来,他会得到10分的奖励。然而,如果他弯腰在没有罐头的地方捡罐头,他将被罚款1分。
如果他撞到墙上,他将被罚款5分,并跳回当前网站。
当机器人捡起尽可能多的罐子时,它的奖励会最大化,而不会撞到任何墙壁,也不会在没有罐子的时候弯腰捡起罐子。
# RobotsGA
Applying genetic algorithm(GA) to Solve the Path Planning Problem
Robot’s world consists of 100 squares laid in a 10*10 grid, where each square can at most have one soda can. From wherever he currently is, he can see the contents of one adjacent site in the north, south, east, and west directions, as well as the contents of the site he’s currently in.
Each individual strategy is a list of 243 actions. Each action consists of one of the following seven choices: move to north, move to south, move to east, move to west, choose a random direction to move in, stay up, or bend down to pick up a can.
Each action may generate a reward or a punishment.
If robot is in the same site as a can and picks it up, he gets a reward of 10 points. However, if he bends down to pick up a can in a site where there is no can, he is fined 1 point.
If he crashes into a wall, he is fined 5 points and bounces back into the current site.
Robot’s reward is maximized when he picks up as many cans as possible, without crashing into any walls or bending down to pick up a can when no can is there.
Apply GA with the following properties to this problem:
Recombination
Single-point
Mutation
Mutate each number in the chromosome with mutation probability and replace it with a randomly generated number between 0 and 6
Mutation prob.
0.5%
Selection
Roulette wheel