Introduction Agent Programming - PowerPoint PPT Presentation

Loading...

PPT – Introduction Agent Programming PowerPoint presentation | free to download - id: 75807d-OTg2Z



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Introduction Agent Programming

Description:

Agent Programming Multi-Agent Systems Course Koen Hindriks Delft University of Technology, The Netherlands Learning to program teaches you how to think. – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 31
Provided by: Koen59
Learn more at: http://ii.tudelft.nl
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Introduction Agent Programming


1
IntroductionAgent Programming
Multi-Agent Systems Course
Koen Hindriks Delft University of Technology, The
Netherlands
Learning to program teaches you how to
think. Computer science is a liberal art. Steve
Jobs
2
Introducing Myself
  • Dr. Koen Hindriks
  • PhD on Agent Programming Languages (Utrecht, 1996
    - 2000)
  • Consultant at Accenture (Amsterdam, 2000 - 2005)
  • Assistant Professor Artificial Intelligence
    (Nijmegen, 2005 - 2006)
  • Assistant Professor MMI Group (Delft, 2006 - )
  • Main Research Interests
  • Rational agent programming and theory
  • Automated negotiation
  • Logic (with applications to agent modeling and
    NLP semantics)
  • Cognitive engineering and architectures

3
Outline
  • This lecture
  • Blocks, Blocks, Blocks
  • Basic Blocks World example in
  • the Goal agent programming language
  • Actions
  • Rule-Based Action Selection

4
This Part BW4T Assignment
  • Abstract simulated environment called Blocks
    World for Teams (BW4T)
  • Search and retrieval task
  • Control robot by cognitive agent program
  • Your task implement decision-making

5
The GoalAgent Programming Language
6
The Blocks World
  • The Hello World example of Agent Programming

7
The Blocks World
A classic AI planning problem.
Objective Move blocks in initial state such that
result is goal state.
  • Positioning of blocks on table is not relevant.
  • A block can be moved only if it there is no other
    block on top of it.

8
Mental State of Goal Agent
The knowledge, belief, and goal sections together
constitute the specification of the mental state
of a Goal Agent.
knowledge block(X) - on(X, _). clear(X)
- block(X), not(on(Y,X)). clear(table).
tower(X) - on(X,table). tower(X,YT) -
on(X,Y), tower(YT). beliefs on(a,b).
on(b,c). on(c,table). on(d,e). on(e,table).
on(f,g). on(g,table). goals on(a,e),
on(b,table), on(c,table), on(d,c), on(e,b),
on(f,d), on(g,table).
Initial mental state of agent
9
Previous Lecture
Percepts
agent
events
beliefs
environment
actions
goals
Action
plans
10
This Lecture
Percepts
agent
events
beliefs
environment
actions
goals
Action
plans
11
Next Lecture
Percepts
agent
events
beliefs
environment
actions
goals
Action
plans
12
Why Hello World Example?
  • The Blocks World is
  • Single agent
  • no other agents that can change the world
  • Fully observable
  • the agent can see everything
  • Static
  • only actions of agent can change the world
  • We do not need sensing / percepts.

13
Agent Oriented Programming
  • Agents provide a very effective way of building
    applications for dynamic and complex environments
  • Develop agents based on Belief-Desire-Intention
    agent metaphor, i.e. develop software components
    as if they have beliefs and goals, act to achieve
    these goals, and are able to interact with their
    environment and other agents.

14
Actions specifications
  • Changing Blocks World Configurations

15
Actions Change the Environment
move(a,d)
16
and Require Updating Mental States.
  • To ensure adequate beliefs after performing an
    action the belief base needs to be updated (and
    possibly the goal base).
  • Add effects to belief base insert on(a,d) after
    move(a,d).
  • Delete old beliefs delete on(a,b) after
    move(a,d).

17
and Require Updating Mental States.
  • If a goal has been (believed to be) completely
    achieved, the goal is removed from the goal base.
  • It is not rational to have a goal you believe to
    be achieved.
  • Default update implements a blind commitment
    strategy.

move(a,b)
beliefs on(a,table), on(b,table). goals
on(a,b), on(b,table).
beliefs on(a,b), on(b,table). goals
18
Action Specifications
  • Actions in GOAL have preconditions and
    postconditions.
  • Executing an action in GOAL means
  • Preconditions are conditions that need to be
    true
  • Check preconditions on the belief base.
  • Postconditions (effects) are add/delete lists
    (STRIPS)
  • Add positive literals in the postcondition
  • Delete negative literals in the postcondition
  • STRIPS-style specification

move(X,Y) pre clear(X), clear(Y),
on(X,Z), not( on(X,Y) ) post
not(on(X,Z)), on(X,Y)
19
Actions Specifications
  • move(X,Y)
  • pre clear(X), clear(Y), on(X,Z), not( on(X,Y)
    )
  • post not(on(X,Z)), on(X,Y)
  • Example move(a,b)
  • Check clear(a), clear(b), on(a,Z), not( on(a,b)
    )
  • Remove on(a,Z)
  • Add on(a,b)
  • Note first remove, then add.

table
20
Actions Specifications
  • move(X,Y)
  • pre clear(X), clear(Y), on(X,Z), not( on(X,Y)
    )
  • post not(on(X,Z)), on(X,Y)
  • Example move(a,b)

beliefs on(a,table). on(b,table).
beliefs on(b,table). on(a,b).
21
Actions Specifications
EXERCISE
  • move(X,Y)
  • pre clear(X), clear(Y), on(X,Z), not( on(X,Y)
    )
  • post not(on(X,Z)), on(X,Y)
  • Is it possible to perform move(a,b)?
  • Is it possible to perform move(a,d)?

knowledge block(a), block(b), block(c),
block(d), block(e), block(f), block(g), block(h),
block(i). clear(X) - block(X), not(on(Y,X)).
clear(table). tower(X) - on(X,table).
tower(X,YT) - on(X,Y), tower(YT). beliefs
on(a,b). on(b,c). on(c,table). on(d,e).
on(e,table). on(f,g). on(g,table).
No, clear(b) fails.
Yes.
22
Actions Specifications
EXERCISE
  • move(X,Y)
  • pre clear(X), clear(Y), on(X,Z), not( on(X,Y)
    )
  • post not(on(X,Z)), on(X,Y)
  • We already check clear(Y). Why do we also have
    not(on(X,Y)) in the precondition?

knowledge block(a), block(b), block(c),
block(d), block(e), block(f), block(g), block(h),
block(i). clear(X) - block(X), not(on(Y,X)).
clear(table). tower(X) - on(X,table).
tower(X,YT) - on(X,Y), tower(YT). beliefs
on(a,b). on(b,c). on(c,table). on(d,e).
on(e,table). on(f,g). on(g,table).
Since we always have clear(table). The
condition prevents moving blocks that are already
on the table.
23
Action Rules
  • Selecting actions to perform

24
Agent-Oriented Programming
  • How do humans choose and/or explain actions?
  • Examples
  • I believe it rains so, I will take an umbrella
    with me.
  • I go to the video store because I want to rent
    I-robot.
  • I dont believe busses run today so I take the
    train.
  • Use intuitive common sense concepts
  • beliefs goals gt action

See Chapter 1 of the Programming Guide
25
Selecting Actions Action Rules
  • Action rules are used to define a strategy for
    action selection.
  • Defining a strategy for blocks world
  • If constructive move can be made, make it.
  • If block is misplaced, move it to table.

program if bel(tower(YT)),
a-goal(tower(X,YT)) then move(X,Y). if
a-goal(tower(XT)) then move(X,table).
26
Selecting Actions Action Rules
  • What happens?
  • Check whether condition
  • a-goal(tower(XT)
  • can be derived from the current mental state
    of agent.
  • If so, then apply rule and perform move(X,table).

if a-goal(tower(XT)) then move(X,table).
27
Selecting Actions Action Rules
EXERCISE
  • What happens?

if a-goal(tower(XT)) then move(X,table).
knowledge block(X) - on(X, _). clear(X)
- block(X), not(on(Y,X)). clear(table).
tower(X) - on(X, table). tower(X,YT) -
on(X,Y), tower(YT). beliefs on(a, b).
on(c, d). goals on(a, table), on(c,
table).
c
a
d
b
Random choice for either moving a or c.
28
Order of Action Rules
program if bel(tower(YT)),
a-goal(tower(X,YT)) then move(X,Y). if
a-goal(tower(XT)) then move(X,table).
  • Action rules are executed by default in linear
    order.
  • The first rule that fires is executed.
  • Default order can be changed to random.
  • Arbitrary rule that is able to fire may be
    selected.

programorderrandom if bel(tower(YT)),
a-goal(tower(X,YT)) then move(X,Y). if
a-goal(tower(XT)) then move(X,table).
29
Example Program Action Rules
Agent program may allow for multiple action
choices
programorderrandom if bel(tower(YT)),
a-goal(tower(X,YT)) then move(X,Y). if
a-goal(tower(XT)) then move(X,table).
Random, arbitrary choice
d
To table
30
The Sussman Anomaly (1/5)
  • Non-interleaved planners typically separate the
    main goal, on(A,B),on(B,C) into 2 sub-goals
    on(A,B) and on(B,C).
  • Planning for these two sub-goals separately and
    combining the plans found does not work in this
    case, however.

a
c
b
a
b
c
Initial state
Goal state
31
The Sussman Anomaly (2/5)
  • Initially, all blocks are misplaced
  • One constructive move can be made (c to table)
  • Note move(b,c) not enabled.
  • Only action enabled c to table (2x).
  • Need to check conditions of action rules
  • if bel(tower(YT),a-goal(tower(X,YT))then
    move(X,Y).
  • if a-goal(tower(XT))then move(X,table).
  • We have bel(tower(c,a) and a-goal(tower(c)).

32
The Sussman Anomaly (3/5)
  • Only constructive move enabled is
  • Move b onto c
  • Need to check conditions of action rules
  • if bel(tower(YT), a-goal(tower(X,YT))then
    move(X,Y).
  • if a-goal(tower(XT))then move(X,table).
  • Note that we have
  • a-goal(on(a,b),on(b,c),on(c,table)),
  • but not a-goal(towerc)).

Current state
33
The Sussman Anomaly (4/5)
  • Again, only constructive move enabled
  • Move a onto b
  • Need to check conditions of action rules
  • if bel(tower(YT), a-goal(tower(X,YT))then
    move(X,Y).
  • if a-goal(tower(X,T))then move(X,Y).
  • Note that we have a-goal(on(a,b),on(b,c),on(c,tab
    le)),
  • but not a-goal(towerb,c).

a
b
b
c
a
c
Goal state
Current state
34
The Sussman Anomaly (5/5)
  • Upon achieving a goal completely
  • that goal is automatically removed.
  • The idea is that no resources should
  • be wasted on achieving the goal.
  • In our case, goal(on(a,b),on(b,c),on(c,table))
    has been
  • achieved, and is dropped. The agent has no other
  • goals and is ready.

a
a
b
b
c
c
Goal state
Current state
35
Organisation
  • Read Programming Guide Ch1-3 ( User Manual)
  • See http//ii.tudelft.nl/trac/goalDocumentati
    on
  • Tutorial
  • Download Goal See http//ii.tudelft.nl/trac/goal
  • Practice exercises from Programming Guide
  • BW4T assignments 3 and 4 made available today
  • Next lecture
  • Sensing, perception, environments
  • Other types of rules macros
  • Agent architecture
About PowerShow.com