Consider the following vacuum-cleaning world which has 3 squares We assume the f
ID: 3743447 • Letter: C
Question
Consider the following vacuum-cleaning world which has 3 squares We assume the following .The vacuum-cleaning agent knows the configuration of the 3 squares, but does not know which square it is in initially. The initial dirt distribution is not known either .A clean square remains clean and a dirty square remains dirty unless the agent cleans it up. The agent has two sensors: Loc(x) and Status(x). Loc(x) returns the identity ("A" or "B" or "C") of the square x that the agent is located, and Status(x) returns either "Dirty" or "Clean for the square X. Assume that the sensors are 100% reliable Th actions available for the agent are: Left, Right, Suck, NoOp. Each action takes place in The actions are perfectly reliable - perform "Suck" in dirty square will change it to become The agent will be penalized by -1 point for each movement Left, Right, Suck. The agent gets · For a time horizon T (say T = 100) steps, the agent is penalized by-2 points per dirty square one time "step" clean, and moving left when in square C will get the agent to square B +10 points reward for each dirty square cleaned. per time step. (If a square is dirty at the "start" of time step t and the agent performs "Suck" at this time step, the square becomes "clean" at the "end" of step t. Thus for time step t for this particular square, no penality should be applied to the agent) The agent's performance is measured by the total number of points (positive or negative) over T- 100 time steps. (a) Design a simple reflex agent (without states) for this problem - provide pseudo-code for the agent and define the "condition-action" rules. Can such an agent be perfectly rational (i.e., maximizing the expected performance measure) for any initial agent location and dirt distribu- tion? Explain your answer (b) What about a reflex agent with states (i.e., an agent which has an internal state representation of the world environment)? Can such an agent be perfectly rational under the current assump- tions? Design such an agent (pseudo-code, rules, or look-up table, etc.) (c) Now assume that the agent's dirt sensor is more powerful which provides complete information about dirty/clean status of every square in the environment. Can a simple reflex agent be per fectly rational now? And if so, design such an agent (pseudo-code, rules, or look-up table, etcExplanation / Answer
a) Agent without state information cannot be completely rational due to the obvious reason (Since it doesn't know initially which square has more dirt distribution).
PROGRAM Agent:
START
PROCEDURE CheckAndClean :
IF Status Of Current Square is Dirty
THEN CALL Suck;
END IF
END PROCEDURE
CALL CheckAndClean;
IF location is A
THEN
CALL Right;
CALL CheckAndClean;
CALL Right;
CALL CheckAndClean;
END IF
ELSE IF location is B
THEN
CALL CheckAndClean;
CALL Left;
CALL CheckAndClean;
CALL Right;
CALL Right;
CALL CheckAndClean;
END IF
ELSE IF location is C
THEN
CALL CheckAndClean;
CALL Left;
CALL CheckAndClean;
CALL Left;
CALL CheckAndClean;
END IF
END
b) Yes, it can be perfectly rational if it has the capability to maintain states.
PROGRAM RationalAgent:
START
PROCEDURE CheckAndClean :
IF Status Of Current Square is Dirty
THEN CALL Suck;
END IF
END PROCEDURE
CALL CheckAndClean;
IF the location of the square is A
IF Square B is Dirty // Use a mapping table.
THEN
CALL Right;
CALL Suck;
END IF
IF Square C is Dirty
THEN
CALL Right;
CALL Suck;
END IF
END IF
IF the location of the square is B
IF Square A is Dirty
THEN
CALL LEFT;
CALL Suck;
IF Square C is Dirty
THEN
CALL Right;
CALL Right;
CALL Suck;
END IF
END IF
ELSE IF Square C is Dirty
THEN
CALL Right;
CALL Suck;
END IF
END IF
IF the location of the squre is C
IF Square B is Dirty
THEN
CALL LEFT;
CALL Suck;
IF Square A is Dirty
THEN
CALL Left;
CALL Suck;
END IF
END IF
ELSE IF Square A is Dirty
THEN
CALL Left;
CALL Left;
CALL Suck;
END IF
END IF
END
c) Yes. Equivalent to b, only difference is that it will get the status dynamically every single time. Pseudocode also remains same as B.