machine intelligence

73
Machine Intelligence Cairo University Faculty of Engineering Computer Engineering Department Course Instructor: Prof. Dr. Nevin Darwish

Upload: cardea

Post on 24-Feb-2016

44 views

Category:

Documents


0 download

DESCRIPTION

Cairo University Faculty of Engineering Computer Engineering Department. Machine Intelligence. Course Instructor: Prof. Dr. Nevin Darwish. Team members. Sylvia Boshra Lydia Wahid Madonna Samuel Wessam Wagdy. - PowerPoint PPT Presentation

TRANSCRIPT

Machine Intelligence

Machine Intelligence

Cairo UniversityFaculty of EngineeringComputer Engineering DepartmentCourse Instructor: Prof. Dr. Nevin DarwishTeam membersSylvia BoshraLydia WahidMadonna SamuelWessam WagdyArtificial Intelligence A Modern Approach 3rd Edition Chapter 11Planning and Acting in the Real WorldAgendaRecall classical planningTypes of the environmentMethods To deal with different types of the environmentSensorless (Conformant)PlanningContingent Planning Online ReplanningMultiagent PlanningPlanning with multiple simultaneous actionsPlanning with multiple agentsSummary

1. Recall Classical PlanningClassical PlanningExample: The spare tire problem Init(Tire(Flat) Tire(Spare) At(Flat, Axle) At(Spare, Trunk)) Goal(At(Spare, Axle)) Action(Remove(obj , loc), PRECOND: At(obj , loc) EFFECT: At(obj ,loc) At(obj, Ground)) Action(PutOn(t. Axle), PRECOND: Tire(t) At(t, Ground) At(Flat, Axle) EFFECT: At(t, Ground) At(t, Axle))

-classical planning: perform complex tasks to achieve complex goals. -Plan: is sequence of actions to reach the goal from initial state(progression) or the opposite(Regression).62. Types of the EnvironmentFully ObservablePartially ObservableNon Observable-Fully: as the last example-Partially: as wampus-Belief state

7Example: Painting a chair and a tableInit(Object(Table) Object(Chair) Can(C1) Can(C2)) Goal(Color(Chair,c) Color(Table,c) ) Action(RemoveLid(can), PRECOND: Can(can) EFFECT: Open(can)) Action(Paint(x,can), PRECOND: Object(x) Can(can) Color(can,c) Open(can) EFFECT: Color(x,c))Percept (Color(x,c), PRECOND: Object(x) InView(x) Percept (Color(can,c), PRECOND: Can(can) InView(can) Open (can)

We add a percept schema8Example: Painting a chair and a tableInit(Object(Table) Object(Chair) Can(C1) Can(C2) InView(Table)) Goal(Color(Chair,c) Color(Table,c) ) Action(RemoveLid(can), PRECOND: Can(can) EFFECT: Open(can)) Action(Paint(x,can), PRECOND: Object(x) Can(can) Color(can,c) Open(can) EFFECT: Color(x,c))Percept (Color(x,c), PRECOND: Object(x) InView(x) Percept (Color(can,c), PRECOND: Can(can) InView(can) Open (can)

We add a percept schema9Example: Painting a chair and a tableInit(Object(Table) Object(Chair) Can(C1) Can(C2) InView(Table)) Goal(Color(Chair,c) Color(Table,c) ) Action(RemoveLid(can), PRECOND: Can(can) EFFECT: Open(can)) Action(Paint(x,can), PRECOND: Object(x) Can(can) Color(can,c) Open(can) EFFECT: Color(x,c))Percept (Color(x,c), PRECOND: Object(x) InView(x) Percept (Color(can,c), PRECOND: Can(can) InView(can) Open (can)

We add a percept schema10Example: Painting a chair and a tableInit(Object(Table) Object(Chair) Can(C1) Can(C2) InView(Table)) Goal(Color(Chair,c) Color(Table,c) ) Action(RemoveLid(can), PRECOND: Can(can) EFFECT: Open(can)) Action(Paint(x,can), PRECOND: Object(x) Can(can) Color(can,c) Open(can) EFFECT: Color(x,c))Action(LookAt(x), PRECOND: InView(y) (x y) EFFECT: InView(x) InView(y)) ggggggggggg

113. Methods To deal with different types of the environmentSensorless (Conformant)PlanningContingent Planning Online ReplanningSensorless: For unobservableContingent: Partially observable or undeterminstic or bothOnline: for unknown environments

12I. Sensorless PlanningBelief stateBelief state for the coloring problemObject(Table) Object(Chair) Can(C1) Can(C2) Color(x,C(x))bo = Color(x,C(x))

Open-world assumption

-what is belief state: set of all possible physical states.-Example: agent go to right left up down -Make actions that can be done in any state (or their union if possible)-When an action is taken we update the belief state (if I went up therefore I am not in the mast down)

Open world assumption: any fluent not mentioned is unknown, it may be true or false (may be true but agent cant see it)

13Using belief state to reach the goalUpdate belief stateb=RESULT(b,a)=(b-DEL(a)) ADD(a)

-Agent will do actions whose preconditions are satisfied by belief state,And belief state is updated when we apply to it the effects of the action.

14Init(Object(Table) Object(Chair) Can(C1) Can(C2)) Goal(Color(Chair,c) Color(Table,c) ) Action(RemoveLid(can), PRECOND: Can(can) EFFECT: Open(can)) Action(Paint(x,can), PRECOND: Object(x) Can(can) Color(can,c) Open(can) EFFECT: Color(x,c))Percept (Color(x,c), PRECOND: Object(x) InView(x) Percept (Color(can,c), PRECOND: Can(can) InView(can) Open (can)

We add a percept schema15Using belief state to reach the goalUpdate belief stateb=RESULT(b,a)=(b-DEL(a)) ADD(a)After applying action RemoveLid(Can1)b1 = Color(x,C(x)) Open(Can1)

-Agent will do actions whose preconditions are satisfied by belief state,And belief state is updated when we apply to it the effects of the action.

16Init(Object(Table) Object(Chair) Can(C1) Can(C2)) Goal(Color(Chair,c) Color(Table,c) ) Action(RemoveLid(can), PRECOND: Can(can) EFFECT: Open(can)) Action(Paint(x,can), PRECOND: Object(x) Can(can) Color(can,c) Open(can) EFFECT: Color(x,c))Percept (Color(x,c), PRECOND: Object(x) InView(x) Percept (Color(can,c), PRECOND: Can(can) InView(can) Open (can)

17Using belief state to reach the goalUpdate belief stateb=RESULT(b,a)=(b-DEL(a)) ADD(a)After applying action RemoveLid(Can1)b1 = Color(x,C(x)) Open(Can1)After applying action Paint(Chair , Can1)b2 = Color(x,C(x)) Open(Can1) Color(Chair,C(Can1))After applying Paint(Table, Can1)b3= Color(x,C(x)) Open(Can1) Color(Chair,C(Can1)) Color(Table,C(Can1))

-Agent will do actions whose preconditions are satisfied by belief state,And belief state is updated when we apply to it the effects of the action.

18Goal(Color(Chair,c) Color(Table,c) ) Belief state satisfies the goal.Final belief state satisfies the goal19Problem Vacuum worldBelief state= AtL AtRIf we applied action SuckThere is a problem: Two different effects!!If AtL, effect: CleanLIf AtR, effect:CleanR

Same effects for all states whose preconditions are satisfied.Problem when: effect depends on state20SolutionConditional effectAction(SuckEFFECT: when AtL: CleanL when AtR: CleanR)b=(AtL CleanL) (AtR CleanR)Action(SuckLPRECOND: AtL; EFFECT: CleanL)Action(SuckRPRECOND: AtR; EFFECT: CleanR)

Not in 1CNF therefore belief state will be of exponential size21Conservative approachLook for action sequences that keep the belief state as simple as possibleRetain 1-CNF belief stateSome sequences can go outside 1-CNF1CNF: Conjunctive normal form (CNF) is a canonical representation of boolean functions. CNF is the conjunction of disjunctive clauses. Disjunctive clauses use the not and or operators, while conjunction is the and operator. A CNF expression is k-CNF if each clause contains k variables. An example of 2-CNF is (a or b) and (not c or d).

22AgendaRecall classical planningTypes of the environmentMethods To deal with different types of the environmentSensorless (Conformant)PlanningContingent Planning Online ReplanningMultiagent PlanningPlanning with multiple simultaneous actionsPlanning with multiple agentsSummaryII. Contingent Planning:Whats contingent planning:Contingent planning is the generation of plans with conditional branching based on percepts.It is appropriate for environments with partial observability and/or non-determinism.

After an action and subsequent percept, calculating the new belief state is done in two stages:Calculating the belief state after the action.Updating the belief state after perception of the environment.If a percept P has more than one percept axiom then we have to add the disjunction (OR) of the preconditions. Which will take the belief state out of CNF (and of ors).We can generate contingent plans with an extension of the AND-OR forward search over belief states.

III. Online PlanningExample: The spot-welding agent in a car plant:The robot welds the same accurate position in every car that passes down the line, if a car door falls off a car as the robot is trying to apply a spot weld, the robot replaces the welding actuator with a gripper, picks up the door, checks for scratches, reattaches it to the car, email the floor supervisor, switches back to its welding actuator and continues its work.The robots behavior seems purposive. The robot knows what its trying to do.

Conditions for Replanning: Execution monitoring to determine the need for a new plan.The need for a new plan arises when a contingent planning agent gets tired of planning for every contingency such as the sky might fall on its head.Needs for Replanning:If the agents model of the world is incorrect.If the agents model of an action have a missing precondition. Example: Opening a can of paints involves using a screwdriver to remove the lid.If the agents model have a missing effect. Example: Painting a chair may get paint on the floor.If the agents model is missing a state variable. Example: How the amount of paint in the can can effect the agents actions.If the agents model is lacking provision for exogenous events. Events that are out of the hands of the agent, like someone knocking over the can of paint.

Without monitoring and replanning, the agents behavior is as fragile if it relies on absolute correctness of its model.

Levels of monitoring the environment:Action monitoring: Before the execution of an action, the agent verifies that all the preconditions still hold.Plan Monitoring:Before the execution of an action, the agent verifies that the remaining plan will still succeed.Goal Monitoring: Before the execution of an action, the agent checks to see if there is a better set of goals it could be trying to achieve.Action monitoring Vs. Plan Monitoring:

Action monitoring is a simple method of execution monitoring, but it can sometimes lead to less than intelligent behavior.Example: The agent constructs a plan to solve the painting problem by painting both the chair and the table red. Suppose that there is only enough red paint for the chair. With action monitoring, the agent would go ahead and paint the chair red, then notice that it is out of paint and cannot paint the table, at which it would replan a repair, painting the chair and table green.A plan monitoring agent can detect failure whenever the current state is such that the plan no longer works. Thus, it would not waste time painting a chair red.Does it work?We cannot guarantee that the agent always reaches the goal, Because it could arrive to a dead end state from which there is no repair. For example, the Vacuum cleaner agent may have a faulty model of itself and doesnt know that its batteries may run out.

For the agent to always reach the goal, we must assume that: There are no dead ends, the goal is reachable from all states in the environment.Environment is really non-deterministic.

When actions are not really non-deterministic:Trouble occurs when actions depend on some precondition the agent doesnt know about.

Example: The painting agent may not know that the paint can is empty and no amount of retrying to paint would reach the goal.

Two Approaches to solve this problem:Choosing randomly among the set of possible repair plans, rather than trying the same repair.Learning: The agent should be able to modify its model of the world to accord with its percepts.

AgendaRecall classical planningTypes of the environmentMethods To deal with different types of the environmentSensorless (Conformant)PlanningContingent Planning Online ReplanningMultiagent PlanningPlanning with multiple simultaneous actionsPlanning with multiple agentsSummary

4. MULTIAGENT PLANNINGWhen there are multiple agents in the environment, each agent faces a multiagent planning problem.Between the purely single-agent and truly multiagent cases is a wide spectrum of problems .Examples:human who can type and speak at the same timeA fleet of delivery robots in a factory

34Examples: multieffector planning , multibody planning34 The multiple bodies act as a single body as long as the relevant sensor information collected by each body can be pooled form a common estimate of the world state that then informs the execution of the overall plan. When communication constraints make this impossible, we have a decentralized planning problemExample: Multiple reconnaissance robots covering a wide area35A multibody problem is still a "standard" single-agent problemdecentralized planning problem: the planning phase is centralized but the execution phase is at least partially decoupled. (need to include explicit communicative actions with other bodies.)may often be out of radio contact with each other and should share their findings during times when communication is feasible. 35When a single entity is doing the planning, there is really only one goal, which all the bodies necessarily share. When the bodies are distinct agents that do their own planning, they may still share identical goalsExample: two human tennis players who form a doubles team share the goal of winning the match .The multibody and multiagent cases are quite different In a multibody robotic doubles team

36Multibody: which body will go where on the court and which body will hit the ball. Multiagent: each agent decides what to do; without some method for coordination36The clearest case of a multiagent problem, of course is when the agents have different goals.Example: In tennis, the goals of two opposing teams are in direct conflict.Some systems are a mixture of centralized and multiagent planning.Example: a delivery company

37In tennis, the goals of two opposing teams are in direct conflictSpectators could be viewed as agents if their support or disdain is a significant factor , an aspect of naturecentralized, offline planning for the routes of its trucks and planes each day, multiagent system the payment of incentives (salaries and bonuses)

37The issues involved in multiagent planning can be divided roughly into two sets:involves issues of representing and planning for multiple simultaneous actions; these issues occur in all settings from multieffector to multiagent planning. involves issues of cooperation, coordination, and competition arising in true multiagent settings.

38I. Planning with multiple simultaneous actions

For the time being, we will treat the multieffector, multibody, and multiagent settings in the same way.A correct plan is one that, if executed by the actors, achieves the goal.We assume perfect synchronization: each action takes the same amount of time and actions at each point in the joint plan are simultaneous.

39labeling them generically as multiactor settings, using the generic term actor to cover effectors, bodies, and agents.

3940b can be quite largewhere a, is the action taken by the ith actor.

40If the actors have no interaction with one then we can simply solve n separate problems.(Example: n actors each playing a game of solitaire). The standard approach to loosely coupled problems is to pretend the problems are completely decoupled and then fix up the interactions.For the transition model, this means writing action schemas as if the actors acted independently. 4141Problems arise, however, when a plan has both agents hitting the ball at the same time.Technically, the difficulty is that preconditions constrain the state in which an action can be executed successfully, but do not constrain other actions that might mess it up.

42

Init(At(A, LeftBaseline) At(B,RightNet) Approaching(Ball,RightBaseline)) Partner(A,B) Partner(B,A)Goal(Returned(Ball) (At(a,RightNet) OR At(a,LeftNet))42A concurrent action list stating which actions must or must not be executed concurrently.

the Hit action has its stated effect only if no other Hit action by another agent Occurs at the same time. 43

For some actions, the desired effect is achieved only when another action occurs concurrently. Example: two agents are needed to carry a cooler full of beverages to the tennis court

44

AgendaRecall classical planningTypes of the environmentMethods To deal with different types of the environmentSensorless (Conformant)PlanningContingent Planning Online ReplanningMultiagent PlanningPlanning with multiple simultaneous actionsPlanning with multiple agentsSummary

II. Planning with multiple agents:Co-operation and Co-ordination

46Actors(A,B)Init(At(A, LeftBaseline) At(B,RightNet) Approaching(Ball,RightBaseline)) Partner(A,B) Partner(B,A)Goal(Returned(Ball) (At(a,RightNet) OR At(a,LeftNet))Action(Hit(actor,Ball),PRECOND: Approaching(Ball,loc) AT(actor,loc)EFFECR: Returned(Ball))Action(Go(actor,to),PRECOND: AT(actor,loc) to loc,EFFECT: At(actor,to) At(actor,loc))

Plan1A: [Go(A, RightBaseline), Hit( A, Ball)]B: [NoOp(B), NoOp(B)]

Plan2A: [Go(A, LeftNet), NoOp(A)]B: [Go(B, RightBaseline), Hit( B, Ball)]

II. Planning with multiple agents:Co-operation and Co-ordination

47

Initially

Init(At(A, LeftBaseline) At(B,RightNet) Approaching(Ball,RightBaseline)) Partner(A,B) Partner(B,A)Goal(Returned(Ball) (At(a,RightNet) OR At(a,LeftNet))

II. Planning with multiple agents:Co-operation and Co-ordination

48

Plan 1

Plan1A: [Go(A, RightBaseline), Hit( A, Ball)]B: [NoOp(B), NoOp(B)]

II. Planning with multiple agents:Co-operation and Co-ordination

49

Plan 1

Plan1A: [Go(A, RightBaseline), Hit( A, Ball)]B: [NoOp(B), NoOp(B)]

II. Planning with multiple agents:Co-operation and Co-ordination

50

Plan 1

Plan1A: [Go(A, RightBaseline), Hit( A, Ball)]B: [NoOp(B), NoOp(B)]

The GOAL

II. Planning with multiple agents:Co-operation and Co-ordination

51

Plan 2

Plan2A: [Go(A, LeftNet), NoOp(A)]B: [Go(B, RightBaseline), Hit( B, Ball)]

II. Planning with multiple agents:Co-operation and Co-ordination

52

Plan 2

Plan2A: [Go(A, LeftNet), NoOp(A)]B: [Go(B, RightBaseline), Hit( B, Ball)]

II. Planning with multiple agents:Co-operation and Co-ordination

53Plan 2

Plan2A: [Go(A, LeftNet), NoOp(A)]B: [Go(B, RightBaseline), Hit( B, Ball)]

II. Planning with multiple agents:Co-operation and Co-ordination

54Plan 2

Plan2A: [Go(A, LeftNet), NoOp(A)]B: [Go(B, RightBaseline), Hit( B, Ball)]

The GOALII. Planning with multiple agents:Co-operation and Co-ordination

55

Again initially

Init(At(A, LeftBaseline) At(B,RightNet) Approaching(Ball,RightBaseline)) Partner(A,B) Partner(B,A)Goal(Returned(Ball) (At(a,RightNet) OR At(a,LeftNet))

II. Planning with multiple agents:Co-operation and Co-ordination

56

Plan 1 by A

Plan1A: [Go(A, RightBaseline), Hit( A, Ball)]B: [NoOp(B), NoOp(B)]

II. Planning with multiple agents:Co-operation and Co-ordination

57Plan 2 by B

Plan2A: [Go(A, LeftNet), NoOp(A)]B: [Go(B, RightBaseline), Hit( B, Ball)]

II. Planning with multiple agents:Co-operation and Co-ordination

58

Plan 2 by A

Plan2A: [Go(A, LeftNet), NoOp(A)]B: [Go(B, RightBaseline), Hit( B, Ball)]

II. Planning with multiple agents:Co-operation and Co-ordination

59

Plan 2 by A

Plan2A: [Go(A, LeftNet), NoOp(A)]B: [Go(B, RightBaseline), Hit( B, Ball)]

II. Planning with multiple agents:Co-operation and Co-ordination

60

Plan 1 by B

Plan1A: [Go(A, RightBaseline), Hit( A, Ball)]B: [NoOp(B), NoOp(B)]

II. Planning with multiple agents:Co-operation and Co-ordinationHow to coordinate to make sure they agree on the plan?Adopt a conventionUse communicationVerbal ExchangePlan Recognition

61II. Planning with multiple agents:Co-operation and Co-ordination1. Adopt a convention:Any constraint on selection of joint plans.Convention: Stick to your side of the court (Plan 1 is out, both agents will select Plan 2)

Any alternative conventions works equally as long as all agents in an environment agree When the conventions are widespread then called social laws62II. Planning with multiple agents:Co-operation and Co-ordination2. Use communication:To achieve common knowledge of a feasible joint planChapter 22: more mechanisms for comminationCan work as well with competitive agents as with cooperative ones

63II. Planning with multiple agents:Co-operation and Co-ordination

64

Yours!2. Use communication1. By Verbal Exchange

II. Planning with multiple agents:Co-operation and Co-ordination

65

Mine!2. Use communication1. By Verbal Exchange

II. Planning with multiple agents:Co-operation and Co-ordination

66

Then its Plan 1

Plan1A: [Go(A, RightBaseline), Hit( A, Ball)]B: [NoOp(B), NoOp(B)]

II. Planning with multiple agents:Co-operation and Co-ordination

67

2. Use communication2. Plan RecognitionBy Executing the first part of the plan

II. Planning with multiple agents:Co-operation and Co-ordination

68

Its plan 22. Use communication2. Plan RecognitionBy Executing the first part of the plan

II. Planning with multiple agents:Co-operation and Co-ordination

69

2. Use communication2. Plan RecognitionBy Executing the first part of the plan

II. Planning with multiple agents:Co-operation and Co-ordinationAnother Examples:Seed-Eating harvester antsThe queens job is to reproduce not to do centralized planningThere is some learning mechanism that make them able to make successful actions over decades-long life even though individual ants live only about a yearFlocking behavior of birdsObserves the position of its nearest neighbors and choose the heading and acceleration that max the weighted sum of:CohesionSeparationAlignment

70

5.Summary:Resources as numeric measuresTime is handled by specialized scheduling or integrated with planning HTN planning using HLAsEffects of HLAs can be defined with angelic semanticContingent plans allows the agent to sense the world, Sensor-less and Contingent plan can be constructed by search in the space of Belief StatesOnline planning agent can re-plan due to nondeterministic actions or incorrect models of environmentMultiagents to cooperate or compete and must agree on which joint plans to be executedThis chapter extends classical planning to cover nondeterministic environments

7172

Any questions73Thank you