Question: Need help with coding assignment in CPP . (10 points) Design a simple reflex agent for the vacuum cleaner world as specified on page 38,
Need help with coding assignment in CPP . (10 points) Design a simple reflex agent for the "vacuum cleaner world" as specified on page 38, with the following changes: * The room is rectangular and represented by a matrix of squares (the floor tiles), with 0 indicating clean and 1 indicating dirty. Thus the room in Figure 2.2 has 1 row and 2 columns and the matrix is [1 1]. The agent is only allowed to see if its current square is clean or dirty. * The agent is allowed to know the room dimensions and the fact that it starts in the top left square (row 0, column 0). * The available actions are Left, Right, Up, Down, Suck. If the vacuum cleaner hits a wall the move returns failure and the vacuum cleaner does not move. Now write a program named hw1pr1.cpp which reads the number of rows, the number of columns, and the rows of the dirt matrix, then runs the agent and outputs the performance measure. Thus the input for Figure 2.2 would be 1 2 1 1 Take input from the keyboard, but to avoid retyping test cases remember you can put data in a file and use Unix redirection. For example, with C++ you can write ./a.out38 Chapter 2.Intelligent Agents 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 in Figure 2.3. Is this a rational agent? That depends! First, we need to say what the performance measure is, what is known about the environment, and what sensors and actuators the agent has. Let us assume the following: 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 (Figure 2.2) but the dirt distri- bution and the initial location of the agent are not. Clean squares stay clean and sucking cleans the current square. The Left and Right actions move the agent left and right except when this would take the agent outside the environment, in which case the agent remains where it is The only available actions are Leji, Righi, and Suck. The agent correctly perceives its location and whether that location contains dirt We claim that under these circumstances the agent is indeed rational; its expected perfor- mance is at least as high as any other agent's. Exercise 2.2 asks you to prove this One can see easily that the same agent would be irrational under different circum stances. 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 un- known, the agent will need to explore it rather than stick to squares A and B. Exercise 2.2 asks you to design agents for these cases 38 Chapter 2.Intelligent Agents 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 in Figure 2.3. Is this a rational agent? That depends! First, we need to say what the performance measure is, what is known about the environment, and what sensors and actuators the agent has. Let us assume the following: 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 (Figure 2.2) but the dirt distri- bution and the initial location of the agent are not. Clean squares stay clean and sucking cleans the current square. The Left and Right actions move the agent left and right except when this would take the agent outside the environment, in which case the agent remains where it is The only available actions are Leji, Righi, and Suck. The agent correctly perceives its location and whether that location contains dirt We claim that under these circumstances the agent is indeed rational; its expected perfor- mance is at least as high as any other agent's. Exercise 2.2 asks you to prove this One can see easily that the same agent would be irrational under different circum stances. 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 un- known, the agent will need to explore it rather than stick to squares A and B. Exercise 2.2 asks you to design agents for these cases
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
