人工智能第二章——Agent(附JADE开发包及源码+Agent相关PPT)

摘要

  本文会讲明白1)Agent定义(及其理性);2)PEAS及环境特性;3)Agent程序的结构;4)Agent程序的部件如何运转。

前言

接上一章——人工智能简介。
本章主要讲Agent,也对应人工智能定义维度中的Acting rationally (理性Agent)。

此外(划重点):在此和大家分享JADE(Java Agent DEvelopment Framework)一个很酷的在Java上进行Agent开发的框架。你可以用这个框架很轻易的搭建一个MAS(多智能体系统),在这些系统中,各个Agent是自治的,而且可以互相通信,很酷诶!

大家可以去我的CSDN资源页下载,内附JADE安装包,源码,以及官方给的一些必要的说明文档,还有一些很有意思的有关Agent系统实例。


一、Agent定义

1.1 What is an agent? (概念,定义)

定义:
  Anything that can be seen as 1) perceiving its environment through sensors 2) acting upon it through actuators. [1]

特点
  It will run in cycles of perceiving, thinking and acting.
  
例子
  拿我们人类做类比:我们的五官(五感)就是sensors,我们的身体各部分(手,足等)就是actuators。
而robotic agents靠我们给的sensors(camera,microphones 麦克风,infrared detectors 红外探测)来感知环境,它们进行一些计算(computing/think),然后通过各种各样的motors(马达,发动机)/actuators来做出行动。

Agent在身边
Now, it should be clear that the world around you is full of agents like your cell phone, vaccum cleaner, smart fridge, thermostat, camera and even yourself. (移动电话(手机),真空吸尘器,智能冰箱,恒温器,摄像头,甚至你自己,都是Agent)

  这样看来,Agent的概念确实有些广泛…当然,我们也可以具体研究Agent in AI,这时候我们就可以把人给排查在外了。

Agent形象图
图一 Agent(一个很萌的形象图)[2]

1.2 What is an intelligent agent (也叫做Rational Agents)?

定义
  An agent which acts in a way that is expected to maximize to its performance measure, given the evidence provided by what it perceived and whatever built-in knowledge it has.

如何衡量/评估Agent的理性?
  The rationality of the agent is measured by its performance measure (that defines the criterion of sucess for an agent), the prior knowledge it has, the environment it can perceive and actions it can perform.


二、Agent的PEAS特性及其环境特性

2.1 PEAS是什么?

定义
PEAS是Agent四个特性的缩写。
Performance, Environment, Actuators and Sensors (PEAS).

例子
自动驾驶汽车拥有以下PEAS:

  • Performance: Safety, time, legal drive, comfort.
  • Environment: Roads, other cars, pedestrians, road signs(道路标志).
  • Actuators: Steering(转向装置,方向盘), accelerator, brake, signal(信号灯), horn(喇叭).
  • Sensors: Camera, sonar(声呐), GPS, speedometer(速度计), odometer(里程表), accelerometer(加速剂), engine sensors, keyboard.

2.2 环境特性

  因为人们需求众多,所以产生了各种各样的intelligent agents,name对应的环境也有不同的类型(特性)

特性1 Fully observable and partially obeservable
  An agent’s sensors give it access to the complete state of the environment at each point in time, if fully observable, otherwise not.
  例子:chess是全局可察的,但是poker(纸牌游戏,你可以想成是斗地主)不是。

特性2 Deterministic and stochastic
  The next state of the environment is completely determined by the current state and the action executed by the agent. (If the environment is deterministic except for (除了) the actions of other agents, then the environment is strategic). Stochastic environment is random in nature and cannot be completely determined. (就是说随机环境不仅仅只是由当前agent的状态和行动决定)
  例子:8-puzzle(九宫格)拥有一个确定性的环境,但是无人驾驶车没有(当然啦,因为这个无人驾驶可是在大马路上开,各种因素影响着环境)。

特性3 Static and dynamic
  The static environment is unchanged while an agent is deliberating (慎重,仔细考虑,深思熟虑). (The environment is semi-dynamic if the environment itself does not change with the passage of time (时间的流逝) but the agent’s performance score does.). A dynamic environment, on the other hand, does change.
  例子:Backgammon (西洋双陆跳棋) has static environment and a roomba (扫地机器人) has dynamic.

特性4 Discrete and continuous
  A limited number of distinct, clearly defined perceptions and actions, constitute a discrete environment.
  E.g., checkers is an example of a discrete environment, while self-driving car evolves in a continuous one.

特性5 Single agent and Multi-agent
  An agent operating just by itself has a single agent environment. However if there are other agents involved, then it’s a multi agent environment.
  例子:Self-driving cars have multi agent environment.

三、Agent的结构,种类

3.1 Agent程序的结构

Agent = architecture + program.

所有Agent都有一样的程序框架!具体如下:
输入:当前感知到的信息
输出:行为
程序:manipulates(操作,控制) input to produce output

3.2 Agent分类

  从Agent能够处理的任务复杂度和智能程度来分类,Agent可以分为四类,而这四类都可以概括为Learning Agents。

1)Simple reflex agents

  在做出行动时,仅仅只基于当前状态,忽略历史(过去的)感知信息。
  They can only work if the environment is fully observable, or the correct action is based on what is perceived currently.

这里写图片描述

2)Model-based reflex agents

  Agents keep track of partially observable environments. These have an internal state depending on perception history. The environment/ world is modeled based on how it evolves independently from the agent, and how the agent actions affects the world.(保留了部分可观察环境的踪迹(一些信息,路径之类的吧),整个environment/world在此基础上建模)

这里写图片描述

3)Goal-based agents

  This is an improvement over model based agents, and used in cases where knowing the current state of the environment is not enough. Agents combine the provided goal information with the environment model, to chose the actions which achieve that goal.

这里写图片描述

  该类agent是在model-based agent上的改进,适用于“光知道当前状态还不够(做出决定,行动)”的情况。其中,agent在做决定的时候考虑了goal information。

  这让我想起了搜索算法。

4)Utility-based agents

  An improvement over goal based agents, helpful when achieving the desired goal is not enough. We might need to consider a cost. For example, we may look for quicker, safer, cheaper trip to reach a destination. This is denoted by a utility function. A utility agent will chose the action that maximizes the expected utility.

  这让我想起了搜索算法中更加复杂的情况(考虑一些其他的cost)。

这里写图片描述

5)Learning Agents
Learning element: responsible for making improvements.
Performance element: responsible for selecting external actions. It is what we considered as agent so far.
Critic: How well is the agent is doing w.r.t. a fixed performance standard.
Problem generator: allows the agent to explore.

四、Agent程序的部件如何运转

  由于前面讨论的四类都可以归为learning agent,所以这里讨论learning agent中的部件如何运转。

4.1 各部件功能

  • 执行部件即前面考虑的整个Agent,接受感知,选择动作。
  • 学习部件根据评判部件的反馈评价Agent做得如何,从而确定如何修改执行部件。
  • 评判部件根据性能标准告知学习部件Agent的运行情况。当“将军”发生了,评判部件告知学习部件:好事情发生了
    (性能标准是固定的,Agent不应该修改性能标准来适应自己的行为)
  • 问题生成器可向执行部件建议探索性行动,短期内可能是次优的行动,但长远而言可能是更好的行动

4.2 例子

自动驾驶

  • 执行部件:使用执行部件在公路上行驶。执行部件包含选择驾驶行动的全部知识和过程集合。
  • 评判部件:观察评价世界,告知学习部件。不打转向灯变道,听到后车喇叭声。
  • 学习部件:制定修改规则。如果是不好的行动,如何修改执行部件。
  • 问题生成器:例如提议在不同路面试验一下刹车效果。

4.3 Agent各部件如何工作

  Agent程序包含回答以下问题的部件:1)当前状态;2)当前应该采取的行动;3行动后果。

如何表示状态及其转换?
  沿着复杂度和表达能力增长的轴线有三种表示:原子表示、要素化表示、结构化表示。

这里写图片描述

1)Atomic representation 原子表示

  The state is stored as black box, i.e. without any internal structure.

例子:
  For example, for Roomba(a robotic vaccum cleaner), the internal state is a patch already vaccumed, you don’t have to know anything else. As depicted in the image, such representation works for model and goal based agents and used in various AI algorithms such as search problems and adversarial games.

2)Factored Representation 要素化表示

  The state, in this representation, is no longer a black box. It now has attribute-value pairs, also known as variables that can contain a value.

例子
  For example, while finding a route, you have a GPS location and amount of gas in the tank. This adds a constraint to the problem. As depicted in the image, such representation works for goal based agents and used in various AI algorithms such as constraint satisfaction and bayesian networks.

3)Structured Representation 结构化表示

  In this representation, we have relationships between the variables/ factored states. This induces(引起 cause) logic in the AI algorithms.
  
例子
  For example, in natural language processing, the states are whether the statement contains a reference to a person and whether the adjective in that statement represents that person. The relation in these states will decide, whether the statement was a sarcastic one. This is high level Artificial Intelligence, used in algorithms like first order logic, knowledge-based learning and natural language understanding. [1]

五、资源

依旧是一些ppt,我看了之后感觉还挺有用的,这里分享给大家,有空可以去我的CSDN资源页下载,如果没有积分,也可以直接评论留言,我发给你。

本次分享的资源包含两个PPT文件:
1)Techniques in Artificial Intelligence (对Ai进行定义,描述世界模型Agent结构,一些实例等)
2)Intelligent Agents: Introduction(对Agent,甚至是整个AI人工智能都有一个比较全面的介绍,可以一看)

六、总结

又搞了一下午。2个小时左右吧。由于时间关系,有时候不得不忽略一些细节,如有疑问请评论留言。

参考文献

[1] Rational Agents for Artificial Intelligence. https://hackernoon.com/rational-agents-for-artificial-intelligence-caf94af2cec5
(我发现这个网站很贴合我们的所学内容诶,有空可以多看看。关注一下)
[2] AI series #1 - What is the meaning of agent in Artificial Intelligence? https://www.youtube.com/watch?v=aBiXwvsGmqA

猜你喜欢

转载自blog.csdn.net/weixin_39278265/article/details/80898403