Agent Programming in Goal Modules

Click here to load reader

download Agent Programming in  Goal Modules

of 46

  • date post

    23-Feb-2016
  • Category

    Documents

  • view

    62
  • download

    0

Embed Size (px)

description

Agent Programming in Goal Modules. Multi-Agent Systems Course. Koen Hindriks Delft University of Technology, The Netherlands. Agents in Games. Multi-Agent Systems Project. Course Multi-Agent Systems: Learn to program a multi-agent system. Project Multi-Agent Systems: - PowerPoint PPT Presentation

Transcript of Agent Programming in Goal Modules

GOAL

Agent Programming in GoalModulesKoen HindriksDelft University of Technology, The NetherlandsMulti-Agent Systems CourseKoen HindriksProgramming Multi-Agent SystemsKoen HindriksProgramming Multi-Agent SystemsAgents in GamesKoen HindriksProgramming Multi-Agent SystemsKoen HindriksProgramming Multi-Agent SystemsMulti-Agent Systems Project3

Project Multi-Agent Systems:CTF Competition in UT2004Control 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 systemDevelop logic-based agents programs:Apply reasoning technology (Prolog) Write agent programs (GOAL)Hands-on experience by various programming assignments.

Koen HindriksProgramming Multi-Agent SystemsKoen HindriksProgramming Multi-Agent SystemsOutlineModules

BW4T AssignmentKoen HindriksProgramming Multi-Agent SystemsKoen HindriksProgramming Multi-Agent SystemsModulesKoen HindriksProgramming Multi-Agent SystemsKoen HindriksProgramming Multi-Agent SystemsAn Agent is a Set of ModulesBuilt-in modules:init module:Define global knowledgeDefine initial beliefs & goalsProcess send once perceptsSpecify environment actionsmain moduleAction selection strategyevent moduleProcess perceptsProcess messagesGoal 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 %%% }}Koen HindriksProgramming Multi-Agent SystemsKoen HindriksProgramming Multi-Agent SystemsDefined Module ComponentsUser-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}

Koen HindriksProgramming Multi-Agent SystemsKoen HindriksProgramming Multi-Agent SystemsCurrently, no submodules; working on that. Also working on making agent = module hold.7Tower 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. Koen HindriksProgramming Multi-Agent SystemsKoen HindriksProgramming Multi-Agent SystemsTower 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.Koen HindriksProgramming Multi-Agent SystemsKoen HindriksProgramming Multi-Agent SystemsTower 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