Intelligent AgentsChapter 2Chapter 2 1RemindersAssignment 0 (lisp refresher) due 1/28Lisp/emacs/AIMA tutorial: 11-1 today and Monday, 271 SodaChapter 2 2Outline♦ Agents and environments♦ Rationality♦ PEAS (Performance measure, Environment, Actuators, Sensors)♦ Environment types♦ Agent typesChapter 2 3Agents and environments?agentperceptssensorsactionsenvironmentactuatorsAgents include humans, robots, softbots, thermostats, etc.Theagent function maps from percept histories to actions:f : P∗→ ATheagent program runs on the physical architecture to produce fChapter 2 4Vacuum-cleaner worldA BPercepts: location and contents, e.g., [A, Dirty]Actions: Left, Right, Suck, NoOpChapter 2 5A vacuum-cleaner agentPercept sequence Action[A, Clean] Right[A, Dirty] Suck[B, Clean] Left[B, Dirty] Suck[A, Clean], [A, Clean] Right[A, Clean], [A, Dirty] Suck......function Reflex-Vacuum-Agent( [location,status]) returns an actionif status = Dirty then return Suckelse if location = A then return Rightelse if location = B then return LeftWhat is the right function?Can it be implemented in a small agent program?Chapter 2 6RationalityFixed performance measure evaluates the environment sequence– one point per square cleaned up in time T ?– one point per clean square per time step, minus one per move?– penalize for > k dirty squares?Arational agent chooses whichever action maximizes the expected value ofthe performance measuregiven the percept sequence to dateRational 6= omniscient– percepts may not supply all relevant informationRational 6= clairvoyant– action outcomes may not be as expectedHence, rational 6= successfulRational ⇒ exploration, learning, autonomyChapter 2 7PEASTo design a rational agent, we must specify the task environmentConsider, e.g., the task of designing an automated taxi:Performance measure??Environment??Actuators??Sensors??Chapter 2 8PEASTo design a rational agent, we must specify the task environmentConsider, e.g., the task of designing an automated taxi:Performance measure?? safety, destination, profits, legality, comfort, . . .Environment?? US streets/freeways, traffic, pedestrians, weather, . . .Actuators?? steering, accelerator, brake, horn, speaker/display, . . .Sensors?? video, accelerometers, gauges, engine sensors, keyboard, GPS, . . .Chapter 2 9Internet shopping agentPerformance measure??Environment??Actuators??Sensors??Chapter 2 10Internet shopping agentPerformance measure?? price, quality, appropriateness, efficiencyEnvironment?? current and future WWW sites, vendors, shippersActuators?? display to user, follow URL, fill in formSensors?? HTML pages (text, graphics, scripts)Chapter 2 11Environment typesSolitaire Backgammon Internet shopping TaxiObservable??Deterministic??Episodic??Static??Discrete??Single-agent??Chapter 2 12Environment typesSolitaire Backgammon Internet shopping TaxiObservable?? Yes Yes No NoDeterministic??Episodic??Static??Discrete??Single-agent??Chapter 2 13Environment typesSolitaire Backgammon Internet shopping TaxiObservable?? Yes Yes No NoDeterministic?? Yes No Partly NoEpisodic??Static??Discrete??Single-agent??Chapter 2 14Environment typesSolitaire Backgammon Internet shopping TaxiObservable?? Yes Yes No NoDeterministic?? Yes No Partly NoEpisodic?? No No No NoStatic??Discrete??Single-agent??Chapter 2 15Environment typesSolitaire Backgammon Internet shopping TaxiObservable?? Yes Yes No NoDeterministic?? Yes No Partly NoEpisodic?? No No No NoStatic?? Yes Semi Semi NoDiscrete??Single-agent??Chapter 2 16Environment typesSolitaire Backgammon Internet shopping TaxiObservable?? Yes Yes No NoDeterministic?? Yes No Partly NoEpisodic?? No No No NoStatic?? Yes Semi Semi NoDiscrete?? Yes Yes Yes NoSingle-agent??Chapter 2 17Environment typesSolitaire Backgammon Internet shopping TaxiObservable?? Yes Yes No NoDeterministic?? Yes No Partly NoEpisodic?? No No No NoStatic?? Yes Semi Semi NoDiscrete?? Yes Yes Yes NoSingle-agent?? Yes No Yes (except auctions) NoThe environment type largely determines the agent designThe real world is (of course) partially observable, stochastic, sequential,dynamic, continuous, multi-agentChapter 2 18Agent typesFour basic types in order of increasing generality:– simple reflex agents– reflex agents with state– goal-based agents– utility-based agentsAll these can be turned into learning agentsChapter 2 19Simple reflex agentsAgentEnvironmentSensorsWhat the worldis like nowWhat action Ishould do nowCondition−action rulesActuatorsChapter 2 20Examplefunction Reflex-Vacuum-Agent( [location,status]) returns an actionif status = Dirty then return Suckelse if location = A then return Rightelse if location = B then return Left(setq joe (make-agent :name ’joe :body (make-agent-body):program (make-reflex-vacuum-agent-program)))(defun make-reflex-vacuum-agent-program ()#’(lambda (percept)(let ((location (first percept)) (status (second percept)))(cond ((eq status ’dirty) ’Suck)((eq location ’A) ’Right)((eq location ’B) ’Left)))))Chapter 2 21Reflex agents with stateAgentEnvironmentSensorsWhat action Ishould do nowStateHow the world evolvesWhat my actions doCondition−action rulesActuatorsWhat the worldis like nowChapter 2 22Examplefunction Reflex-Vacuum-Agent( [location,status]) returns an actionstatic: lastA, last B, numbers, initially ∞if status = Dirty then . . .(defun make-reflex-vacuum-agent-with-state-program ()(let ((last-A infinity) (last-B infinity))#’(lambda (percept)(let ((location (first percept)) (status (second percept)))(incf last-A) (incf last-B)(cond((eq status ’dirty)(if (eq location ’A) (setq last-A 0) (setq last-B 0))’Suck)((eq location ’A) (if (> last-B 3) ’Right ’NoOp))((eq location ’B) (if (> last-A 3) ’Left ’NoOp)))))))Chapter 2 23Goal-based agentsAgentEnvironmentSensorsWhat it will be like if I do action AWhat action Ishould do nowStateHow the world evolvesWhat my actions doGoalsActuatorsWhat the worldis like nowChapter 2 24Utility-based agentsAgentEnvironmentSensorsWhat it will be like if I do action AHow happy I will be in such a stateWhat action Ishould do nowStateHow the world evolvesWhat my actions doUtilityActuatorsWhat the worldis like nowChapter 2 25Learning agentsPerformance standardAgentEnvironmentSensorsPerformance elementchangesknowledgelearning goals Problem generator feedback Learning elementCriticActuatorsChapter 2 26SummaryAgents interact with environments through actuators and sensorsThe agent function describes what the
View Full Document