intelligent agents
play

Intelligent Agents 2 AI Slides (6e) c Lin Zuoquan@PKU 1998-2020 2 - PowerPoint PPT Presentation

Intelligent Agents 2 AI Slides (6e) c Lin Zuoquan@PKU 1998-2020 2 1 2 Intelligence Agents 2.1 Agents 2.2 Agent programs 2.3 Rationality 2.4 Environments 2.5 Agent structures AI Slides (6e) c Lin Zuoquan@PKU 1998-2020 2 2 Agents


  1. Intelligent Agents 2 AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 1

  2. 2 Intelligence Agents 2.1 Agents 2.2 Agent programs 2.3 Rationality 2.4 Environments 2.5 Agent structures AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 2

  3. Agents An agent is an entity that perceives and acts in an environment Agents include – animal agents – human agents – robotic agents (robots) – software agents (softbots) – – internet agents – – – crawler – – – webbot – – – email agent – – – search agent, etc. – – chatbots – – – Cortana/Siri/GAssistant/Waston/Alexa/FMessenger/ · · · Single agent or usually multi-agents (so-called distributed AI) AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 3

  4. Agents and environments sensors percepts ? environment agent actions actuators An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 4

  5. Sensors and actuators A sensor measures some aspect of the environment in a form that can be used as input by an agent – vision, hearing, touch – radio, infrared, GPS, wireless signals – active sensing: send out a signal (such as radar or ultrasound) and sense the reflection of this signal off of the environment ⇒ IoT (Internet of Things) Perception provides agents with information about the world they inhabit by interpreting the response of sensors Actuators – hands, legs, vocal tract etc. – automated taxi: those available to a human driver e.g., accelerator, steering, braking and so on AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 5

  6. Agent functions An agent is completely specified by the agent function : maps from percept histories to actions f : P ∗ → A For any given class of environments and tasks, we seek the agent (or class of agents) with the best performance Find a way to implement the rational agent function concisely AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 6

  7. Agent programs The agent program runs on the physical architecture to produce the agent function agent = architecture + program program = algorithm + data The agent program takes a single percept as input, keeps internal state function Skeleton-Agent ( percept ) returns action persistent : memory , the agent’s memory of the world memory ← Update-Memory ( memory, percept ) action ← Choose-Best-Action ( memory ) memory ← Update-Memory ( memory, action ) return action The algorithm is described by the pseudocode AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 7

  8. Another form of algorithm A procedure for the skeleton-agent that takes a single percept as input, keeps internal state Procedure of Skeleton-Agent Input : percept Output : action memory the agent’s memory of the world 1. memory ← Update-Memory ( memory, percept ) 2. action ← Choose-Best-Action ( memory ) 3. memory ← Update-Memory ( memory, action ) The algorithm is also described by the pseudocode AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 8

  9. Algorithm Recall: an algorithm is an explicit effective set of instructions for a computing procedure – may be used to find the answers to any of a given class of questions – can be precisely defined by computational models, e.g., Turing machine, etc. Analysis of algorithms, independently of the particular implementation and input – time complexity: speed in seconds e.g., the worst T worst ( n ) or the average T avg ( n ) – space complexity: memory consumption in bytes Complexity analyzes problems rather than algorithms AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 9

  10. Algorithm O -notation: asymptotic analysis T ( n ) is O ( f ( n )) if T ( n ) ≤ kf ( n ) for some k , for all n > 0 O ( n k ) for some k : polynomial time/space, called P or “easiness” Otherwise, exponential time/space, e.g., O (2 n ) , called NP , hardness – class of nondeterministic (Turing machine) polynomial problems guess a solution and then verify whether the guess is correct in polynomial time – NP -complete problems (the hardest subclass of NP ) – – co- NP (-complete) is the complement of NP (-complete) “yes” and“no” answers reversed Theorem: either all the NP -complete problems are in P or none of them is AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 10

  11. Algorithm NP = P ?? if you could try all the guesses at once, or you were very lucky and always guess right the first time # P : counting problems corresponding to decision problems in NP decision problems have a yes-or-no answer, counting problems have an integer answer: how many solutions at least as hard as any NP problems PSPACE : require a polynomial amount of space, even on a non- deterministic machine it is believed that PSPACE -hard problems are worse than NP - complete problems although it could turn out that NP = PSPACE , just as P = NP AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 11

  12. The pseudocode The pseudocode is a simple language to describe algorithms – similar to programming language like Java, C, Python or Lisp – informal to use mathematical formulas or ordinary English to describe parts • Persistent variables (global and local variables): a variable is given an initial value the first time a function is called and re- tains that value on all subsequent calls to the function. The agent programs use persistent variables for memory. Variables have low- ercase italic names. • Function as values : The value of a variable is allowed to be a function. Functions and procedures have capitalized names • Indentation is significant : the scope of a loop or conditional AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 12

  13. The pseudocode • Assignment : ” x ← value ” means that the right-hand side eval- uate to the left-hand side variable – Destructuring assignment : ” x, y ← pair ” means that the right-hand side evaluate to a two-element tuple, and the first element is assigned to x and the second to y . Or ” for each x, y in pair do ” • if-then (-else) : ” if c then · · · else · · · ” means that if the con- dition c is hold then doing something; otherwise doing something else • for each : ” for each x in c do ” means that the loop is executed with the variable x bound to successive elements of the collection c . Or ” while c do ” or even ” loop · · · ” • Generators and yield : ” generator G ( x ) yields number” de- fines G as a generator function AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 13

  14. The pseudocode • Lists : [ x, y, z ] , [ first | rest ] • Sets : { x, y, z } • Arrays start at 1 : as in usual mathematical notation, not 0 as in Java and C • /* the explanations can be given as remarks */ AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 14

  15. The code The algorithms in the pseudocode can be implemented in Java, C/C++, Python, Lisp and Prolog etc. The (Lisp) code for each topic is divided into four directories: – agents : code defining agent types and programs – algorithms : code for the methods used by the agent programs – environments : code defining environment types, simulations – domains : problem types and instances for input to algorithms (Often run algorithms on domains rather than agents in environ- ments) AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 15

  16. A coding (Lisp) (setq joe (make-agent :name ’joe :body (make-agent-body) :program (make-dumb-agent-program))) (defun make-dumb-agent-program () (let ((memory nil)) #’(lambda (percept) (push percept memory) ’no-op))) AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 16

  17. Rationality A rational agent is one that does right thing – to achieve the best performance “goals” specifiable by performance measure defining a numerical value for any environment history Rational action: whichever action maximizes the expected value of the performance measure given the percept sequence to date Limited rationality : computational limitations make perfect ra- tionality unachievable ⇒ design best program for given machine resources Rational � = omniscient – percepts may not supply all relevant information Rational � = clairvoyant – action outcomes may not be as expected ⇒ rational � = successful AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 17

  18. Vacuum-cleaner world Example: Robot cleaner, say, iRobot Roombat A B Percepts: location and contents, e.g., [ A, Dirty ] Actions: Left , Right , Suck , NoOp AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 18

  19. A vacuum-cleaner agent 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 . . . . . . function Reflex-Vacuum-Agent ( [ location , status ]) returns an action if status = Dirty then return Suck else if location = A then return Right else if location = B then return Left What is the right function? Can it be implemented in a program? AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 19

  20. Vacuum-cleaner rational agent Fixed 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? AI Slides (6e) c � Lin Zuoquan@PKU 1998-2020 2 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend