Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory
Principles of Ar ficial Intelligence
Vasant Honavar Ar ficial Intelligence Research Laboratory College of Informa on Sciences and Technology Bioinforma cs and Genomics Graduate Program The Huck Ins tutes of the Life Sciences Pennsylvania State University
[email protected] h p://vhonavar.ist.psu.edu h p://faculty.ist.psu.edu/vhonavar
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Goal-based agents
• The agent seeks to achieve a specified goal • A aining a goal may require a long sequence of ac ons • Needs a model (representa on) of the world
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Goal-based agents: Problem solving as search
• Goal-based agents • Design of simple goal-based agents – Discrete, fully observable states – Discrete ac ons • Problem formula on – Problem solving as search – State space search – Example problems • (Review of) Basic (Uninformed) Search Algorithms
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Problem Formula on
• Formulate the goals – Explicit specifica on – Implicit specifica on (goal predicate) • Formulate the ac ons – Precondi ons (before) – Post-condi ons (a er) • Design a representa on that – Captures relevant aspects of the world – Abstracts away unimportant details
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Example: 8-puzzle
• States? – Posi on of each le on the board • Ini al state? – Any state can be ini al • Ac ons? – {Le , Right, Up, Down} • Goal test? Check whether goal configura on is reached
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Problem Formula on
Simplifying assump ons • Discrete, fully observable states – ‘in class’, ‘at home’ • Discrete ac ons – Mary executes ac on ‘Go home’ in state ‘in class’ to reach the ‘at home’ state – In this setup, we can’t speak of Mary being on her way home • Passive environment – All state changes due to the agent’s ac on – Mary can’t end up at home because her mom picked her up
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Representa on
A representa on • Maps each (physical) state of the external environment into the corresponding abstract state via sensors • Maps each (physical) ac on on an environmental state into an abstract ac on on the corresponding abstract state • Maps effects of an abstract ac on on an abstract state into a corresponding effect on the corresponding environmental state via effectors The mapping from • environmental states and abstract states is many to one • abstract state to an environmental state is one to many
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Representa on The mapping from environmental states and abstract states is many to one abstract state to an environmental state is one to many A representa on induces a par on over environmental states
4 abstract states, ac ons may allow only lateral or ver cal moves – not all environmental state transi ons can be modeled by the agent Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Representa on • Effects of abstract ac ons in the abstract state space may be fully determinis c and predictable… but… • The corresponding effects of the physical ac ons on the environmental state space are predictable only to the extent – allowed by the resolu on of the representa on and the fidelity of sensors and effectors – That the environment is indeed determinis c
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Representa on • Is a surrogate inside an agent’s ‘brain’ for en es that exist in the external world • Is not just a data structure – why? • Derives its seman cs through seman c grounding (sensors, effectors) – Correspondence between descrip ons and states of the world or ac ons that change the state of the world • Embodies a set of ontological commitments – assump ons about the en es, proper es, rela onships, and ac ons that we care about • Choice of representa on ma ers!
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Problem Formula on
• Formulate the goals – Explicit specifica on – Implicit specifica on (goal predicate) • Formulate the ac ons – Precondi ons (before) – Post-condi ons (a er) • Design a representa on that – Captures relevant aspects of the world – Abstracts away unimportant details
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Example: Missionaries and Cannibals • Ini al state: 3 missionaries, 3 cannibals, and the boat on the le bank of the river • Goal: all on the right bank • Constraints: – The boat which can carry at most 2 people at a me – If missionaries are outnumbered by cannibals, the cannibals will eat the missionaries • States: The posi ons of missionaries, cannibals, and the boat on either side of the river • Ac ons: Movement of the boat with its occupants from one side of the river to the other • Solu on: A sequence of boat trips across the river complete with their passenger lists
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Example: Ge ng around in Romania
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Example: Ge ng around in Romania
• On holiday in Romania; currently in Arad – Flight leaves tomorrow from Bucharest • Formulate goal – Be in Bucharest • Formulate problem – States: various ci es – Ac ons: drive between ci es • Find solu on – Sequence of ci es; e.g. Arad, Sibiu, Fagaras, Bucharest, …
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Problem formula on in the observable, determinis c case
• A problem is defined by: – An ini al state, e.g. Arad – Successor func on S(X)= set of ac on-state pairs • e.g. S(Arad)={
• Ini al state + successor func on defines a state space • A solu on is a sequence of ac ons from the ini al to goal state
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Basic State Space Search Problem
A state space search problem is specified by a 3-tuple (s, A, G) where • s is a start state – s ∈ S, the set of possible start states • O is the set of ac ons (operators) – Par al func ons that map a state into another • G the set of goal states – G may be explicitly enumerated or implicitly specified using a goal predicate goal (g) = True iff g ∈ G Solu on to a state space search problem is a sequence of ac on applica ons leading from the start state s to a goal g ∈ G
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Problem formula on – finding an op mal solu on • A problem is defined by: – An ini al state, e.g. Arad – Successor func on S(X)= set of ac on-state pairs • e.g. S(Arad)={
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Finding an op mal solu on
• All operator applica ons may not be equally expensive • Suppose we have a cost func on c: S x O à ℜ+ • c (s,o,r) = cost of applying operator o in state q to reach state r • Path cost is typically assumed to be the sum of costs of operator applica ons along the path • An op mal solu on is one with the lowest cost path from the specified start state s to a goal g ∈ G
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory State space representa on
• Real world can be absurdly complex • State space representa on is an abstrac on – (Abstract) state corresponds to a set of real world states – (Abstract) ac on corresponds to a complex combina on of real world ac ons – e.g. Arad → Zerind represents a complex set of possible routes, detours, rest stops, etc. – The abstrac on is valid if the path between two states is reflected in the real world. • (Abstract) solu on = set of real paths that are solu ons in the real world.
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Importance of Representa on
S cks and Squares Problem • 17 s cks arranged in 6 squares • Goal remove 5 s cks so we are le with exactly 3 squares (no extra s cks) • What is the size of the state space?
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Importance of Representa on
S cks and Squares Problem • 17 s cks arranged in 6 squares • Goal remove 5 s cks so we are le with exactly 3 squares (no extra s cks) • What is the size of the state space? – Depends on the representa on
! 17 $ ⎛6⎞ # & ⎜ ⎟ 5 ⎜ ⎟ " % ⎝3⎠
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Importance of representa on • Ontological commitment ma ers • Abstrac on ma ers • Granularity of the representa on ma ers • Good representa ons – preserve the relevant aspects of the problem – expose the relevant problem structure • Bad representa ons – Lose poten ally relevant informa on – obscure the relevant problem structure • How to automa cally discover good representa ons is a fundamental problem in AI • Millions of years of evolu on have given humans a head-start
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Example: vacuum world
• States? • Ini al state? • Ac ons? • Goal test? • Path cost?
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Example: vacuum world
• States? two loca ons with or without dirt, with or without the vacuum cleaner: 2 x 22=8 states. • Ini al state? Any state can be ini al • Ac ons? {Le , Right, Cleanup} • Goal test? Check whether both loca ons are clean. • Path cost? Number of ac ons to reach goal Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Example: 8-puzzle
• States? • Ini al state? • Ac ons? • Goal test? • Path cost?
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Example: 8-puzzle
• States? Integer loca on of each le • Ini al state? Any state can be ini al • Ac ons? {Le , Right, Up, Down} • Goal test? Check whether goal configura on is reached • Path cost? Number of ac ons to reach goal
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Example: 8-queens problem
Constraints: No two queens can share – A row – A column – A diagonal
• States? • Ini al state? • Ac ons? • Goal test? • Path cost?
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Example: 8-queens problem
Problem formula on • States? – Any arrangement of 0 to 8 queens on the board • Ini al state? – Empty board (no queens) • Ac ons? – Add a queen in empty square • Goal test? – 8 queens on board and none under a ack
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory State space representa on: 8-queens problem
Solu on 1
Any arrangement of 0 to 8 queens on the board • 64 squares, 8 queens – (64)(63)(62)(61)..(57) ≈ 3 × 1014 ≈ 1.2681 × 247 states!
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory State space representa on: 8-queens problem
Solu on 2
Any arrangement of 0 to 8 queens on the board • 8 rows – need to specify the column in which a queen is placed in each row – (8)(7)(6)(5)(4)(3)(2) ≈ 1.231 × 215 states! – Absorbed the `no two queens can share a row’ constraint into the representa on!
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Example: 8-queens problem
Solu on 3
Any arrangement of 0 to 8 queens on the board • States: n (0≤ n≤ 8) queens on the board, one per column in the n le most columns with no queen a acking another • Ac ons: Add a queen to the le most empty column so as not to a ack the other queens • Number of states = 2057 Representa on ma ers!
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory Finding solu on – State space search
Let L be a list of nodes yet to be expanded 1. Let L = (s) 2. If L is empty, return failure else pick a node n from L (which node?) 3. If n is a goal node, a. return path from s to n and stop. b. Otherwise i. Delete n from L ii. Expand n: Add to L all of n’s successors (where?) 4. Return to 2.
Principles of Artificial Intelligence, IST 597F, Fall 2014, (C) Vasant Honavar Pennsylvania State University College of Information Sciences and Technology Artificial Intelligence Research Laboratory State space search • A state is an (internal representa on of) a physical configura on • A node is a data structure that is used to construct a search tree – A node has a parent, successors, and includes bookkeeping informa on e.g., depth, … – node =