Koen HindriksProgramming Multi-Agent Systems Agent Programming in G OAL Modules Koen Hindriks Delft...

Click here to load reader

  • date post

    17-Dec-2015
  • Category

    Documents

  • view

    214
  • download

    1

Embed Size (px)

Transcript of Koen HindriksProgramming Multi-Agent Systems Agent Programming in G OAL Modules Koen Hindriks Delft...

  • Slide 1
  • Koen HindriksProgramming Multi-Agent Systems Agent Programming in G OAL Modules Koen Hindriks Delft University of Technology, The Netherlands Multi-Agent Systems Course
  • Slide 2
  • Koen Hindriks Programming Multi-Agent Systems Koen HindriksProgramming Multi-Agent Systems Agents in Games
  • Slide 3
  • Koen Hindriks Programming Multi-Agent Systems Koen HindriksProgramming Multi-Agent Systems Multi-Agent Systems Project 3 Project Multi-Agent Systems: CTF Competition in UT2004 Control a team of bots by means of a multi-agent system. Compete at the end of the project. Course Multi-Agent Systems: Learn to program a multi-agent system Develop logic-based agents programs: Apply reasoning technology (Prolog) Write agent programs (GOAL) Hands-on experience by various programming assignments.
  • Slide 4
  • Koen Hindriks Programming Multi-Agent Systems Koen HindriksProgramming Multi-Agent Systems Outline Modules BW4T Assignment
  • Slide 5
  • Koen Hindriks Programming Multi-Agent Systems Koen HindriksProgramming Multi-Agent Systems Modules
  • Slide 6
  • Koen Hindriks Programming Multi-Agent Systems Koen HindriksProgramming Multi-Agent Systems An Agent is a Set of Modules Built-in modules: init module: Define global knowledge Define initial beliefs & goals Process send once percepts Specify environment actions main module Action selection strategy event module Process percepts Process messages Goal management User-defined modules. init module{ knowledge{ } beliefs{ %% INITIAL BELIEFS ONLY IN INIT MODULE %% } goals{ } program{ %% PROCESS SEND ONCE PERCEPTS HERE %% } actionspec{ %% SPECIFY ENVIRONMENT ACTIONS HERE %% } main module{ % OPTIONAL knowledge section % NO beliefs section HERE! % OPTIONAL goal section (not advised in main) program{ %% ENVIRONMENT ACTION SELECTION HERE %% } event module{ program{ %% PROCESS PERCEPTS HERE %% %% PROCESS MESSAGES HERE %% %% PERFORM GOAL MANAGEMENT HERE %% }
  • Slide 7
  • Koen Hindriks Programming Multi-Agent Systems Koen HindriksProgramming Multi-Agent Systems Defined Module Components User-defined module is similar to any other module. Even though knowledge may be specified within a module, knowledge is global. I.e. all knowledge is put in a global knowledge base. Goals, macros, rules and actions specified within a module are local: They can only be used within that module. init module{... } main module{ program{ } event module{... } %% YOUR OWN MODULES GO HERE %% %% CAN ALSO IMPORT MODULES %% module moduleName { % may have: [ ] knowledg{ } % optional goals{ } % optional program{ } % OBLIGATORY actionspec{ } % optional }
  • Slide 8
  • Koen Hindriks Programming Multi-Agent Systems Koen HindriksProgramming Multi-Agent Systems Tower Env: Agent Design % moving X on top of Y is a constructive move if that move results in X being % in position. #define constructiveMove(X, Y) a-goal( tower([X, Y | T]) ), bel( tower([Y | T]), clear(Y), (clear(X) ; holding(X)) ). main module{ program{ % pick up a block if you can and want to. if a-goal( holding(X) ) then pickup(X). % put a block you're holding down, ideally where you want it, but otherwise put it on the table. if bel( holding(X) ) then { if constructiveMove(X,Y) then putdown(X, Y). if true then putdown(X, table). } % otherwise, there is nothing to do, so we can move the gripper to the top left corner. % no need to check whether we're holding a block because of linear order. if true then nil. } Design rule: Only use action rules that select environment actions in main module. Use main module to define a strategy for handling the environment as above.
  • Slide 9
  • Koen Hindriks Programming Multi-Agent Systems Koen HindriksProgramming Multi-Agent Systems Tower Env: Agent Design main module{ program{ if a-goal( holding(X) ) then pickup(X). if bel( holding(X) ) then { if constructiveMove(X,Y) then putdown(X, Y). if true then putdown(X, table). } if true then nil. } event module{ program{ % process percepts from Tower World environment. rules below assume full observability. forall bel( block(X), not(percept(block(X))) ) do delete( block(X) ). forall bel( percept(block(X)), not(block(X)) ) do insert( block(X) ). forall bel( holding(X), not(percept(holding(X))) ) do delete( holding(X) ). forall bel( percept(holding(X)), not(holding(X)) ) do insert( holding(X) ). forall bel( on(X,Y), not(percept(on(X,Y))) ) do delete( on(X,Y) ). forall bel( percept(on(X,Y)), not(on(X,Y)) ) do insert( on(X,Y) ). } Process percepts first in event module. Always use most up-to-date information.
  • Slide 10
  • Koen Hindriks Programming Multi-Agent Systems Koen HindriksProgramming Multi-Agent Systems Tower Env: Agent Design event module{ program{ % a block is *in position* if it achieves a goal. #define inPosition(X) goal-a( tower([X|T]) ). % GOAL MANAGEMENT % check for reasons to DROP a goal FIRST. if goal( holding(X) ) then { % first reason: cannot pick up block X because it's not clear. if bel( not(clear(X)) ) then drop( holding(X) ). % second reason: cannot pick up block X because now holding other block! if bel( holding(_) ) then drop( holding(X) ). % third reason: block X is already in position, don't touch it. if inPosition( X ) then drop( holding(X) ). % fourth reason: we can do better by moving another block constructively. listall L