遗传算法是机器学习算法嘛?

Today, we will solve a real-world problem is to design a robotic controller. There are many techniques that can be used to solve this problem. Some of them include genetic algorithm (GA), particle swarm optimization and neural network (NN).

今天,我们要解决的一个现实问题是设计一个机器人控制器。 有许多技术可用于解决此问题。 其中一些包括遗传算法(GA),粒子群优化和神经网络(NN)。

What we need to do is to apply an algorithm to the robotic as a method of designing robotic controllers that enable the robot to perform complex tasks and behaviors.

我们需要做的是将一种算法应用于机器人,以此作为设计机器人控制器的一种方法,从而使机器人能够执行复杂的任务和行为。

Autonomous robot is a robot that can perform certain work independently without the human help.

自主机器人是无需人工帮助即可独立执行某些工作的机器人。

One of the capabilities of robots is to move from one point to another which called is autonomous navigation. Imagine that we have built a robot that can move goods around a warehouse. In this article, we will implement this capability using the Python language. How the robot can see its local environment? Yes, we would install sensors, which allow the robot can look around and we have given it wheels so it can navigate based on input from its sensors. The biggest problem is how we can link the sensor data to motor actions so that the robot can navigate the warehouse.

机器人的功能之一是从一个点移动到另一个点,这就是自主导航。 想象一下,我们已经建造了一个可以在仓库中移动货物的机器人。 在本文中,我们将使用Python语言实现此功能。 机器人如何查看其本地环境? 是的,我们将安装传感器,使机器人可以环顾四周,并且已经给它赋予轮子,以便它可以基于来自传感器的输入进行导航。 最大的问题是我们如何将传感器数据链接到动作,以便机器人可以导航仓库。

In general, we frequently use neural networks to successfully map robotic sensors to outputs by using reinforcement learning algorithms to the learning process. But we will use another way today, it is to use genetic algorithms. Typically, a genetic algorithm will evaluate a large population of individuals to find the best individuals for the next generation by using a fitness function that compute the performance of and individual based on certain predefined rules.

通常,我们经常使用神经网络通过在学习过程中使用强化学习算法来成功地将机器人传感器映射到输出。 但是,今天我们将使用另一种方法,即使用遗传算法。 通常,遗传算法将通过使用适应度函数评估大量个体,以找到下一代的最佳个体,该适应度函数根据某些预定义规则计算个体和个体的表现。

However, we will be facing a new challenge, physically evaluating each robot controller is not feasible for a large population due to the difficulty in physically testing each robotic controller and the time it would take to do so. For this reason, we will use our knowledge of genetic algorithms to design and implement a robotic controller and apply it to a virtual robot in a virtual environment.

但是,我们将面临一个新的挑战,因为对每个机器人控制器进行物理测试非常困难,并且需要花费大量的时间,因此对大量机器人进行物理评估是不可行的。 因此,我们将使用遗传算法的知识来设计和实现机器人控制器,并将其应用于虚拟环境中的虚拟机器人。

目标 (The target)

Our robot can take four actions: move one step forward, turn left, turn righ and do nothing.

我们的机器人可以执行以下四个动作:向前移动一步,向左转,向右转或什么都不做。

The robot also has six sensors in the figure below.

下图中机器人也有六个传感器。

a robot with 6 sensors
具有6个传感器的机器人
  • three on the front前面三个
  • one on the left一个在左边
  • one on the right一个在右边
  • one on the back一个在后面

The maze is comprised of walls that the robot can’t cross and will have an outlined route. We are going to design a robotic controller that can use the robot sensors to navigate a robot successfully through a maze.

迷宫由机器人无法越过的墙壁组成,并具有勾勒出的路线。 我们将设计一个机器人控制器,该控制器可以使用机器人传感器在迷宫中成功导航机器人。

解决方案 (The Solution)

遗传算法伪代码 (The genetic algorithm pseudocode)

The pseudo code for a basic genetic algorithm is as follows

基本遗传算法的伪代码如下

generation = 0;population[generation] = initializePopulation(populationSize); evaluatePopulation(population[generation]);While isTerminationConditionMet() == false do     parents = selectParents(population[generation]);     population[generation+1] = crossover(parents);     population[generation+1] = mutate(population[generation+1]);    evaluatePopulation(population[generation]);    generation++;End loop;

This pseudocode demonstrates the basic process of a genetic algorithm. Next steps, we will implement them in Python.

此伪代码演示了遗传算法的基本过程。 下一步,我们将在Python中实现它们。

将传感器值映射到动作 (Mapping the sensor values to actions)

As mentioned in the previous section, the robot will have four actions that can be represented in binary as follows:

如上一节所述,机器人将具有四个可以用二进制表示的动作,如下所示:

  • “00” — do nothing;“ 00”-不执行任何操作;
  • “01” — move forward;“ 01”-前进;
  • “10” — turn left;“ 10”-向左转;
  • and “11” — turn right.和“ 11” —向右转。

We also have six different sensors. To simplify the representation we limit the measurements to binary encoding, that is, values less than a threshold indicate obstacle detection and larger than threshold indicate a clear path. 6 sensors are giving us 2⁶ = 64 possible combinations of sensor inputs. Since an action requires 2 bits, our controller requires 64*2 = 128 bits of storage to represent any possible input. Given that 128 bits are our requirement for representing instructions different combinations. But how should we organize the chromosome so we can encode and decode it?

我们还有六个不同的传感器。 为了简化表示,我们将测量值限制为二进制编码,即,小于阈值的值表示障碍物检测,大于阈值的值表示畅通路径。 6个传感器为我们提供2⁶= 64种可能的传感器输入组合。 由于一个动作需要2位,因此我们的控制器需要64 * 2 = 128位存储来表示任何可能的输入。 鉴于我们需要128位来表示不同组合的指令。 但是,我们应该如何组织染色体,以便对它进行编码和解码?

We have a human readable list of inputs and outputs as follows:

我们有一个易于理解的输入和输出列表,如下所示:

  • Sensor #1 (front): on传感器#1(正面):开
  • Sensor #2 (front-left): off传感器#2(左前):关闭
  • Sensor #3 (front-right): on传感器#3(右前):开
  • Sensor #4 (left): off传感器#4(左):关闭
  • Sensor #5 (right): off传感器#5(右):关闭
  • Sensor #6 (back): off传感器#6(背面):关闭

We also have an instruction that is “turn left” with a value of 10 in binary. Our next is to take the six sensor values and encode those further.

我们还有一条指令“向左转”,二进制值为10。 我们的下一步是获取六个传感器值,并对它们进行进一步编码。

000101 => 10

If we now convert the sensor values’ bit string to decimal, we get the following:

如果现在将传感器值的位字符串转换为十进制,则会得到以下信息:

5 => 10

So, we can use the sensor’s decimal value as the position in the chromosome that represents a combination of sensor inputs as follows.

因此,我们可以使用传感器的十进制值作为代表传感器输入组合的染色体位置,如下所示。

xx xx xx xx xx 10 xx xx xx xx (… 54 more pairs…)

As can be seen in the following figure, a combination of sensor values produces a binary output that describes how a typical chromosome can map the robot’s sensor values to actions.

如下图所示,传感器值的组合产生二进制输出,该输出描述典型染色体如何将机器人的传感器值映射到动作。

This encoding scheme may seem obtuse at first and the chromosome is not human-readable but it has a couple of helpful properties.

这种编码方案乍一看似乎很钝,并且染色体不是人类可读的,但是它具有几个有用的属性。

  • First, the chromosome can be manipulated as an array of bits which makes crossover, mutation, and other manipulations much easier.首先,可以将染色体按位阵列进行操作,从而使交叉,突变和其他操作变得更加容易。
  • Secondly, every 128-bit value is a valid solution.其次,每个128位值都是有效的解决方案。

实作 (Implementation)

Firstly, we need to create and initialize a maze to run the robot in (world.py file). The maze object we’ve created uses integers to represent different terrain types:

首先,我们需要创建并初始化一个迷宫来运行( world.py文件)中的机器人。 我们创建的迷宫对象使用整数表示不同的地形类型:

  • 1 defines a wall;1定义墙;
  • 2 is the starting position;2是起始位置;
  • 3 traces the best route through the maze;3追踪穿过迷宫的最佳路线;
  • 4 is the goal position;4是目标位置;
  • and 0 is an empty position that the robot can travel over but isn’t on the route to the goal.0是机器人可以越过但未到达目标路线的空位置。

We write a constructor to create a new maze from a double int array and implement public methods to get the start position, score a route through the maze.

我们编写了一个构造函数,以便从double int数组创建一个新的迷宫,并实现公共方法来获取起始位置,在迷宫中刻一条路线。

个人 (Individual)

An individual is represented by a single chromosome composed of multiple genes.

一个个体由一个由多个基因组成的染色体代表。

机器人 (Robot)

Next, we need to create a Robot that can follow instructions and generate a route by executing those instructions.

接下来,我们需要创建一个可以遵循指令并通过执行这些指令生成路线的机器人。

人口 (Population)

The population refers to a group of chromosomes.

种群是指一组染色体。

遗传算法 (Genetic Algorithm)

We implement methods to calculate fitness, select individuals, crossover and do mutation.

我们实现了计算适应度,选择个体,交叉和变异的方法。

机器人控制器 (Robotic Controller)

Finally, we can write a class that actually executes the algorithm. Create another new file called main.py as follows.

最后,我们可以编写一个实际执行算法的类。 如下创建另一个名为main.py新文件。

The output.

输出。

Easy, right?

容易吧?

翻译自: https://towardsdatascience.com/genetic-algorithm-based-approach-for-robotic-controllers-3966a9b874fb

遗传算法是机器学习算法嘛?


http://www.taodudu.cc/news/show-1874067.html

相关文章:

  • ai人工智能对话了_对话式AI:智能虚拟助手和未来之路。
  • mnist 转图像_解决MNIST图像分类问题
  • roc-auc_AUC-ROC技术的局限性
  • 根据吴安德(斯坦福大学深度学习讲座),您应该如何阅读研究论文
  • ibm watson_使用IBM Watson Assistant构建AI私人教练-第1部分
  • ai会取代程序员吗_机器会取代程序员吗?
  • xkcd目录_12条展示AI真相的XKCD片段
  • 怎样理解电脑评分_电脑可以理解我们的情绪吗?
  • ai 数据模型 下载_为什么需要将AI模型像数据一样对待
  • 对话生成 深度强化学习_通过深度学习与死人对话
  • 波普尔心智格列高利心智_心智与人工智能理论
  • 深度学习计算机视觉的简介_商业用途计算机视觉简介
  • slack 聊天机器人_使用Node.js和Symanto的Text Analytics API在Slack中创建情感机器人
  • c语言八数码问题启发式搜索_一种快速且简单的AI启发式语言学习方法
  • 机器学习库线性回归代码_PyCaret回归:更好的机器学习库
  • 元学习:学习学习
  • 深度学习去雨论文代码_将深度学习研究论文转换为有用的代码
  • r-cnn 行人检测_了解对象检测和R-CNN。
  • 情态 语态_情绪与情态与对话情感
  • gan loss gan_我的GAN怎么了?
  • h5py group_人工智能驱动的零售:H&M Group如何做到
  • openai-gpt_GPT-3的不道德故事:OpenAI的百万美元模型
  • 通话时自动中断音乐播放_您知道用户在何处以及为何中断通话吗?
  • 机器视觉科学计算可视化_模因视觉:对模因进行分类的科学
  • 人工智能与自动驾驶汽车_自动驾驶汽车中的道德AI
  • 是你渡过人生难关的助力_人工智能将助力安全返回工作场所。 这是如何做
  • 机器学习 流式特征_Web服务与实时机器学习端点的流式传输
  • 算法 博士_Strangecode博士-我如何学会不再担心并喜欢算法
  • 妲己机器人功能_来自机器人影响者的5个功能强大的Instagram教训
  • 创建dqn的深度神经网络_深度Q网络(DQN)-I

遗传算法是机器学习算法嘛?_基于遗传算法的机器人控制器方法相关推荐

  1. python 排课算法_基于遗传算法的排课系统

    摘 要:随着高校的发展,在教务管理系统中使用的排课模型也变得越来越复杂,亟需一种适用于开发.重用及设计的方法.针对这种情况,本文给出了排课问题的数学模型,提出基于遗传算法解决方案.结果表明,该算法能比 ...

  2. python自动组卷系统_基于遗传算法(C#编写)的智能组卷系统优化

    原创 guodongwe1991 机器学习算法与Python学习 2016-08-25 最近由于项目的需要,基于.Net 4.0框架和WPF开发window的客户端(开发环境为win7 旗舰版:Vis ...

  3. 遗传算法与爬山算法简介_遗传算法简介

    遗传算法与爬山算法简介 Genetic Algorithms (GAs) are a part of Evolutionary Computing (EC), which is a rapidly g ...

  4. 遗传算法可用什么算法代替_获取可用密码算法的列表

    遗传算法可用什么算法代替 您如何了解可用的密码算法? Java规范列出了几种必需的密码,摘要等,但是提供程序通常提供的不止这些. 幸运的是,这很容易了解我们系统上的可用内容. public class ...

  5. 机器学习算法优缺点_用于机器学习的优化算法的优缺点

    机器学习算法优缺点 A deep-dive into Gradient Descent and other optimization algorithms 深入研究梯度下降和其他优化算法 Optimi ...

  6. 遗传算法系统辨识matlab程序,8.8 基于遗传算法的机械手参数辨识 系统辨识理论及Matlab仿真课件.ppt...

    8.8 基于遗传算法的机械手参数辨识 (1) 8.8.1 系统描述 双关节机械臂动力学方程可写为: 其中 为重力加速度. 参数 分别是机械力臂方程中未知物理参数 的函数,表达如下: 由 的定义,可知: ...

  7. 机器学习算法 拟合曲线_制定学习曲线以检测机器学习算法中的错误

    机器学习算法 拟合曲线 机器学习 (Machine Learning) The learning curve is very useful to determine how to improve th ...

  8. 基于机器学习算法的LTE高投诉小区预判方法

    摘要:将用户投诉映射到网络性能问题,并利用机器学习算法建立 4G KPI 与用户投诉之间的关联,构造基于网络性能指标的用户投诉预警模型.以用户感知层面的大数据分析结论为抓手,提升网络优化和网络运维的质 ...

  9. 遗传算法matlab_智能算法之Genetic Algorithm遗传算法

    智能算法之Genetic Algorithm遗传算法 前言:本文主要围绕 Matlab 的实现展开,Java版本以及Python版本参考文章最后的源码地址,MatLab和python实现大致相同,Ja ...

  10. 三维图形几何变换算法实验_基于深度学习的三维重建算法综述

    点击上方"计算机视觉life",选择"星标" 快速获得最新干货 00 前言 目前,三维重建技术已在游戏.电影.测绘.定位.导航.自动驾驶.VR/AR.工业制造以 ...

最新文章

  1. 【linux草鞋应用编程系列】_2_ 环境变量和进程控制
  2. OpenCV-Python 彩色图像均衡化与规定化
  3. Live Writer
  4. 限时免费下载丨《2021 中国游戏市场挑战与机遇盘点》重磅发布!
  5. 排序算法汇总(转载收藏)
  6. Java 数据类型内存分析
  7. CUDNN v3特性
  8. 2.2. MongoDB 管理
  9. jdk 各版本官网下载
  10. JS根据城市名称获取所在省份
  11. 《开源安全运维平台-OSSIM最佳实践》将于2015年底出版
  12. 8分钟腹肌锻炼日志(第20天)过冬ing
  13. Hadoop开发相关问题
  14. 微光集市-JWT和Token在本项目中的应用(版本5.0)
  15. 现在程序员的工资是不是被高估了?
  16. c++中的 for_each 函数
  17. 大数据分析案例-基于决策树算法构建银行客户流失预测模型
  18. 市场运营:App 渠道追踪的5种方法以及渠道数据分析的两大思路
  19. 利用MP实现分页查询
  20. 怎样使用markdown做笔记、python入门小白

热门文章

  1. The beginning iOS8 Programming with Swift 中文翻译 - 3
  2. poj2485(Kruskal)
  3. pku1274 The Perfect Stall
  4. silverlight:贝塞尔曲线
  5. 数据库优化之MySQL
  6. 190708每日一句 努力VS天赋;假如生活欺骗了你
  7. Opencv打开相机,并在上面用鼠标画框
  8. python 帮助 help
  9. Atitit word结构化提取考试试题读取 poi读取word nlp aiprj 目录 1.1. 结构化后数据 1 1.2. 文字读取 1 1.3. 图片读取 1 1.4. Doc的表格读取 /
  10. Atiitt 日志技术的重大问题解决法 目录 1.1. 只想看某些日志,使用tag过滤法 1 1.2. 能方便清晰的列出某一业务(如支付)的完整的处理流程 业务tag 1 1.3. - NDC(N