Answers.Body: <p>You are correct that the robot should never perceive two <code>[A, Clean]</code> events in a row, as it should have moved when perceiving the first one.</p>
  <p>However, this only applies to a perfect agent, which always successfully executes all its actions. What if the dog walks past and blocks the exit to room B? Then the <code>Right</code> action fails, and the agent is still in A. But now, it might only listen to <code>[B, ?]</code> events, because obviously it must now be in room B, since it executed a <code>Right</code> command.</p>
  <p>Having a simple tabulated agent function like this is clearly not adequate for real world problems, as where do you stop? How many <code>[A, Clean]</code> events do you want to list? And, if you start again, why do you have lists of perceptions in the first place? The initial <code>[A, Clean]</code> in the list should suffice, as it would still attempt to move right if it processes perceptions with no internal state/memory.</p>
  <p>But bearing in mind that physical actions can fail in the real world, the agent is still rational, it's just overly cautious: it doesn't try to suck when the location is clean, or move away when it's dirty. It just wants to make sure it's <em>really</em> clean before moving away.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-24T04:04:39.720Z
Answers.Text: Thank you for the answer. But in the assumptions we have: "The Right and Left actions move the agent one square except when this would take the agent outside the environment, in which case the agent remains where it is." So it seems that the closure can not occur. What is your opinion?
Answers.UserDisplayName: user153245
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-19T09:00:11.993Z
Answers.LastActivityDate: 2021-10-19T09:00:11.993Z
Answers.UserDisplayName: Oliver Mason
Answers.Body: <p>The answer answer can be found in the later part of the text which you did not read:</p>
  <p>&quot;One can see easily that the same agent would be irrational under different circumstances&quot;</p>
  <p>For example, once all the dirt is cleaned up, the agent will oscillate needlessly back and forth; if the performance measure includes a penalty of one point for each movement left or right, the agent will fare poorly. <strong>A better agent for this case would do nothing once it is sure that all the squares are clean.</strong> If clean squares can become dirty again, the agent should occasionally check and re-clean them if needed. If the geography of the environment is unknown,
  the agent will need to explore it rather than stick to squares A&quot;</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-12-05T10:29:24.003Z
Answers.LastActivityDate: 2024-12-05T10:40:25.010Z
Answers.LastEditDate: 2024-12-05T10:40:25.010Z
Answers.UserDisplayName: IT user
Answers.Body: <p><strong>The table represents the <em>agent function</em> which takes as input the perception sequence</strong></p>
  <p>In the Vacuum example the rational decision does not depend on the perception sequence, or rather only on the last entry of the perception sequence.</p>
  <p>Think of a more complex game where the optimal decision changes <em>after you have perceived something in the past</em>. An example could be you are standing in front of a door and need a key.</p>
  <pre><code>* [A:door] -&gt; Walk right
  * ...
  * [A:door] ... [found key] ... [A:door] -&gt; Open door
  </code></pre>
  <p>Such a table is intended to be used as a <em>look-up table</em> for the optimal decision for every situation including the past.<br />
  Depending on the setting in could make sense to limit the table to a maximum length of a perception sequence; for the vacuum world to length one.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-02-06T13:33:52.147Z
Answers.LastActivityDate: 2024-02-06T13:46:55.670Z
Answers.LastEditDate: 2024-02-06T13:46:55.670Z
Answers.UserDisplayName: Daraan
Body: <p>This is the vacuum cleaner example of the book &quot;Artificial intelligence: A Modern Approach&quot; (4th edition).</p>
  <p><a href="https://i.sstatic.net/Q5l4t.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Q5l4t.png" alt="enter image description here" /></a></p>
  <p>Consider the simple vacuum-cleaner agent that cleans a square if it is dirty and moves to the other square if not; this is the agent function tabulated as follows.</p>
  <pre><code>Percept sequence                      Action
  [A,Clean]                             Right
  [A,Dirty]                             Suck
  [B,Clean]                             Left
  [B,Dirty]                             Suck
  [A,Clean], [A,Clean]                  Right
  [A,Clean], [A,Dirty]                  Suck
  .                                      .
  .                                      .
  [A,Clean], [A,Clean], [A,Clean]       Right
  [A,Clean], [A,Clean], [A,Dirty]       Suck
  .                                      .    
  .   
                                 .
  </code></pre>
  <p>The characteristics of environment and performance function are as follow:</p>
  <ul>
  <li><p>The performance measure awards one point for each clean square at each time step, over a &quot;lifetime&quot; of 1000 time steps.</p>
  </li>
  <li><p>The &quot;geography&quot; of the environment is known a priori (the above figure) but the dirt distribution and the initial location of the agent are not. Clean squares stay clean and sucking cleans the current square. The Right and Left actions move the agent one square except when this would take the agent outside the environment, in which case the agent remains where it is.</p>
  </li>
  <li><p>The only available actions are <em>Right</em>, <em>Left</em>, and <em>Suck</em>.</p>
  </li>
  <li><p>The agent correctly perceives its location and whether that location contains dirt.</p>
  </li>
  </ul>
  <p>In the book, it is stated that under these circumstances the agent is indeed rational. But I do not understand such percept sequence that consists of multiple <code>[A, clean]</code> percepts, e.g. <code>{[A, clean], [A, clean]}</code>. In my opinion, after first <code>[A, clean]</code>, the agent must be gone to the right square; So, the sequence <code>{[A, clean], [A, clean]}</code> will never be perceived.</p>
  <p>In other words, the second perception of <code>[A, clean]</code> is the consequence of acting <em>left</em> or <em>suck</em> action after perceiving the first <code>[A, clean]</code>. Therefore, we can conclude the agent is not rational.</p>
  <p>Please, help me to understand it.</p>
  
Tags: <intelligent-agent><norvig-russell><rationality><rational-agents>
Title: Why is this vacuum cleaner agent rational?
UserDisplayName: user153245
ThreadText: # Why is this vacuum cleaner agent rational?
  
  (Asked by: username_0 on 2021-10-18)
  
  This is the vacuum cleaner example of the book "Artificial intelligence: A Modern Approach" (4th edition).
  
  [![enter image description here](https://i.sstatic.net/Q5l4t.png)](https://i.sstatic.net/Q5l4t.png)
  
  Consider the simple vacuum-cleaner agent that cleans a square if it is dirty and moves to the other square if not; this is the agent function tabulated as follows.
  
  ```
  Percept sequence                      Action
  [A,Clean]                             Right
  [A,Dirty]                             Suck
  [B,Clean]                             Left
  [B,Dirty]                             Suck
  [A,Clean], [A,Clean]                  Right
  [A,Clean], [A,Dirty]                  Suck
  .                                      .
  .                                      .
  [A,Clean], [A,Clean], [A,Clean]       Right
  [A,Clean], [A,Clean], [A,Dirty]       Suck
  .                                      .    
  .   
                                 .
  
  ```
  
  The characteristics of environment and performance function are as follow:
  
  * The performance measure awards one point for each clean square at each time step, over a "lifetime" of 1000 time steps.
  * The "geography" of the environment is known a priori (the above figure) but the dirt distribution and the initial location of the agent are not. Clean squares stay clean and sucking cleans the current square. The Right and Left actions move the agent one square except when this would take the agent outside the environment, in which case the agent remains where it is.
  * The only available actions are *Right*, *Left*, and *Suck*.
  * The agent correctly perceives its location and whether that location contains dirt.
  
  In the book, it is stated that under these circumstances the agent is indeed rational. But I do not understand such percept sequence that consists of multiple `[A, clean]` percepts, e.g. `{[A, clean], [A, clean]}`. In my opinion, after first `[A, clean]`, the agent must be gone to the right square; So, the sequence `{[A, clean], [A, clean]}` will never be perceived.
  
  In other words, the second perception of `[A, clean]` is the consequence of acting *left* or *suck* action after perceiving the first `[A, clean]`. Therefore, we can conclude the agent is not rational.
  
  Please, help me to understand it.
  
  **Tags:** intelligent-agent, norvig-russell, rationality, rational-agents
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2021-10-19. Score: 1
  
  You are correct that the robot should never perceive two `[A, Clean]` events in a row, as it should have moved when perceiving the first one.
  
  However, this only applies to a perfect agent, which always successfully executes all its actions. What if the dog walks past and blocks the exit to room B? Then the `Right` action fails, and the agent is still in A. But now, it might only listen to `[B, ?]` events, because obviously it must now be in room B, since it executed a `Right` command.
  
  Having a simple tabulated agent function like this is clearly not adequate for real world problems, as where do you stop? How many `[A, Clean]` events do you want to list? And, if you start again, why do you have lists of perceptions in the first place? The initial `[A, Clean]` in the list should suffice, as it would still attempt to move right if it processes perceptions with no internal state/memory.
  
  But bearing in mind that physical actions can fail in the real world, the agent is still rational, it's just overly cautious: it doesn't try to suck when the location is clean, or move away when it's dirty. It just wants to make sure it's *really* clean before moving away.
  
  > **Comments:**
  > **username_0**: Thank you for the answer. But in the assumptions we have: "The Right and Left actions move the agent one square except when this would take the agent outside the environment, in which case the agent remains where it is." So it seems that the closure can not occur. What is your opinion?  
  
  ---
  
  ### Answer by username_2 on 2024-12-05. Score: 0
  
  The answer answer can be found in the later part of the text which you did not read:
  
  "One can see easily that the same agent would be irrational under different circumstances"
  
  For example, once all the dirt is cleaned up, the agent will oscillate needlessly back and forth; if the performance measure includes a penalty of one point for each movement left or right, the agent will fare poorly. **A better agent for this case would do nothing once it is sure that all the squares are clean.** If clean squares can become dirty again, the agent should occasionally check and re-clean them if needed. If the geography of the environment is unknown,
  the agent will need to explore it rather than stick to squares A"
  
  
  ---
  
  ### Answer by username_3 on 2024-02-06. Score: 0
  
  **The table represents the *agent function* which takes as input the perception sequence**
  
  In the Vacuum example the rational decision does not depend on the perception sequence, or rather only on the last entry of the perception sequence.
  
  Think of a more complex game where the optimal decision changes *after you have perceived something in the past*. An example could be you are standing in front of a door and need a key.
  
  ```
  * [A:door] -> Walk right
  * ...
  * [A:door] ... [found key] ... [A:door] -> Open door
  
  ```
  
  Such a table is intended to be used as a *look-up table* for the optimal decision for every situation including the past.  
  Depending on the setting in could make sense to limit the table to a maximum length of a perception sequence; for the vacuum world to length one.
  
  
  ---
  
  