---
title: AI Ch.2
---
# Artificial Intelligence
NTNU 人工智慧
##### [Back to Note Overview](https://reurl.cc/XXeYaE)
##### [Back to Artificial Intelligence](https://hackmd.io/@NTNUCSIE112/AI110-2)
{%hackmd @sophie8909/pink_theme %}
###### tags: `AI` `110-2` `CSIE` `選修` `NTNU`
<!-- tag順序 [學校] [系 必選] or [學程 學程名(不含學程的 e.g. 大師創業)] [課程] [開課學期]-->
<!-- 網址名稱 AI110-1_[] -->
## Ch.02 Intelligent Agents
#### What is an Agent?
- An agent interacts with its environments
- Perceive through sensor
- Human agent: 五官
- Robotic agent: cameras, infrared range finder(紅線測距儀)
- Soft agent: receiving keystrokes, network packages etc.
- Act through actuators
- human agent: hands, legs, mouth etc
- robotic agent: arms, wheel, motors etc
- soft agent: display, sending network packages etc.
- A **rational** agent is
- one that **does the right thing**
- one that act so as to **achieve best expected outcome**
### 2.1 Agents and Environments
- Percept($P$)知覺
- The agent's perceptual inputs at any given time
任何時間點的輸入
- Percept sequence($P^*$)
- The complete history of everything the agent has ever
許多時間點輸入的 seq
- Agent function
- A mapping of any given percept to an action
一個 mapping function,map percept 到 action
- $f:P^*(P_0, P_1, \cdots, P_n)\to A$
- Agent function is implemented by an agent program
- Agent program
- Run on the physical agent architecture to produce $f$
實作 mapping function 的地方
- e.g. 掃地機器人
- A made-up world
- Agent
- Percepts
- location and content
e.g. [A, dirty], [B, Clean]
- Actions
- Right, Left, Suck, NoOp
### 2.2 Good behavior: Concept of Rationality
- 對於每個可能的 percept sequence, rational agent 應該要選擇一個預期可以最大化 performance measure(to be most successful) 的 action
#### Performance Measure
The **right action** is the one that will cause the agent to be **most successful**
- The measure should be objective
- How does one evaluate success?
- When does one evaluate success?
### 2.3 The Nature of Environment 環境的本質
Specify the task environments for building a rational agent
- **PEAS** description
- Performance 表現
- Environment 環境
- Actuators 驅動器
- Sensors 感測器
#### Task Environment
Task environment 的特性:informally identified in some dimensions
- Fully vs. partially observable
- 是否可以完全取得所有相關狀態
- Fully
- Agent can access to the complete state of the environment at each point in time
- Agent can detect all aspect that are relevant to the choice of action
- Partially
- Deterministic vs. Stochastic(隨機)
- 下一個 environment 的 state 是否完全由當前 state 跟 agent 的當前動作決定
- Deterministic
- The next state of the environment is completely determined by the current state and the agent's current action
- Stochastic
- Episodic(片段式的) vs. sequential
- 下一個片段是否與之前的動作有關
- Episodic
- The agent's experience is divided into episode.
agent's 的 experience 被切成 episode
- Each episode consists of the agent perceiving and then performing a single action.
每個片段包含 perceiving 跟表現一個 action,下一個 episode 不 depend on 上個 episode 的動作
- The next episode doesn't depend on the actions taken in previous episode (depend only on episode itself)
- Sequential
- Static vs. Dynamic
- Environment 在 agent 還在思考的時候是否還在變動
- Dynamic
- The environment can change while the agent is deliberating(仔細思考)
- Agent is continuously asked what to do next
- Thinking means do "nothing"
- Static
- Semi-dynamic
- environment 不會變,但是 agent 的表現分數會
- e.g. 計時的西洋棋局(time passage degrades the agent's performance)
- Discrete vs. Continuous
- 環境的狀態是連續還是離散的
- Single vs. Multi agent
- 一個/多個 agent
- Multi-agent 的種類
- Cooperative 合作
- 需要 communicate
- Competitive 競爭

- The most hardest case
- Partially observable
- multi-agent
- stochastic
- sequential
- dynamic
- continuous
### 2.4 The Structure of Agents
- How do the insides of agents work?
- Not just talk about the behaviors of agents
- A general agent structure
- Agent = Program + Architecture
- Agent program = Job of AI
- Implement the agent function to map percepts (input) from the sensor to actions (output) of the actuators(執行器)
- Run on a specific architecture
- Agent architecture
- e.g. a PC with sensors and actuators
#### 6 kinds of agent programs
- Table-driven agents → doesn't work well
- Simple reflex agents
- Model-based reflex agents
- Goal-based agents
- Utility-based agents
- Learning agents
#### 2.4.1 The table-driven-agent program
<!-- This is the end of the note. -->