sysc5103 software agents robocup and bdi architecture fall 2006 yousif al ridhawi morvarid sehatkar...

19
SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Upload: jonathan-mason

Post on 17-Dec-2015

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

SYSC5103 Software Agents RoboCup and BDI Architecture

Fall 2006

• Yousif Al Ridhawi• Morvarid Sehatkar• Walter Kung• Gayathri Jayaraman

Page 2: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

• Multi-Agent System and BDI Architecture;• Jason and AgentSpeak(L);• RoboCup;• Design and Implementation of Jason

Environment;• Design and Implementation of soccer player

behavior;• Performance Results;• Evaluate Jason as a BDI Programming system;

Outline

Page 3: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Multi-Agent System and BDI Architecture

• Multi-agent system is the sub field of artificial intelligence, which studies systems involving multiple agents and their coordination.

• When a group of agents in a multi-agent system share a common long-term goal, they can be said to form a team.

• The BDI architecture is being widely used in dynamic and complex scenarios where agents may need to act under incomplete and incorrect information about other agents and the environment where they are situated.

• The BDI model has some philosophical basis in the Belief-Desire-Intention theory of human practical reasoning.

Page 4: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Jason and AgentSpeak(L)• Jason is a Java-based platform for the development of multi-agent

systems • Jason is one of the interpreter for an extended version of

AgentSpeak(L). • AgentSpeak(L) is the abstract languages based on BDI architecture.• AgentSpeak(L) maintains a set of beliefs and a set of plans.• The set of beliefs represents the information an agent presently has

about the world • A plan is a sequence of steps the agent needs to execute in order to

handle some perceived event. • A AgentSpeak(L) plan has

– A head: triggering event– A context: predicate for the plan to be considered applicable.– A body: a sequence of basic actions – head : context <- body – e.g. “+e : true <- !g”

Page 5: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

RoboCup

• Soccer Server– Provides a virtual field that

simulates all movements of a ball and players.

– Send field information to Clients via UDP/IP socket.

• Soccer Monitor– Display graphical

representation of the game.– Initial kick-off command.

• Clients– client controls movements of

one player by sending commands through UDP/IP socket to the server.

Page 6: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Design and Implementation of Jason Environment

SoccerPlayer

int isActionint timedelay

NewBrain brain

void init(String a[]) void move(double x, double y)

void turn(double moment)void turn_neck(double moment)void dash(double

power)void kick(double power, double direction)

void say(String message)void changeView(String angle, String quality)void mainLoop(String[] a) throws IOException

void send(String message)void see(VisualInfo info)

void hear(int time, String message)

jason.environment.Environment

boolean executeAction(String ag, Term action)

void stop()

addPercept(Literal l)

NewBrain

1 n

interface: SendCommand

move(double x, double y);turn(double moment);

turn_neck(double moment);dash(double power);

kick(double power, double direction);say(String message);

SensorInput

void see(VisualInfo info);void hear(int time, int direction, String message);

void hear(int time, String message);

VisualInfo

Vector m_objectsStringTokenizer m_tokenizer

String m_message

Vector getBallList()Vector getPlayerList()Vector getGoalList()Vector getLineList()Vector getFlagList()

void parse()

Memory

void store(VisualInfo info)ObjectInfo getObject(String name)

void waitForNewInfo()

Page 7: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Communication between threadsActivity Chart

Send "Init"

Add Perception toJason

init()

ProcessPerception.

Generate actions

RoboCUPServer

ThreadNewBrain(n)

ThreadSoccerPlayer

Jason

receive team side

send t ea m

i nf o

Send player visualinfo

executeActionhandle the actions

Send actionsProcess actions

Page 8: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Issues and Lessons Learned

• Issue: Perceptions were added before the previous action could be completed.

Solution Introduced a time delay between an action and the next perception received.

• Open Issue: In multiplayer environment, multiple threads (one for each player) access the same environment

methods resulting in socket overwrite.

Recommendation (from Jomi Hubner) Use of Agent Architecture class (for each agent) instead of using environment class (Work in Progress)

• Open Issue: Lack of good explanation of the APIs and examples in Jason documentation.

• Open Issue: Debugging the code using breakpoints.

Page 9: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

State Diagram for Soccer Player Behavior

Checking(ball)

ba ll(nu ll)tu rn(20)

Found(ball)

D ist>1D ash(25*D ist)

D ir <> 0tu rn(D ir)

ball(Dist, Dir, 0, 0)

ball(null)

Checking(goal)

Dist:d

istan

ce fr

om th

e ba

ll.

Dist >

1

Dist <

= 1

GD

ir - Dire

ction to th

e g

oal

kick(GD

ir, 100)

ball(n

ull)G oa l(nu ll)tu rn(20)

kickoffid le

Page 10: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

AgentSpeak(L) Code//BELIEFSchecking(ball).

//PLANS// If the ball is not visible. go to checking(ball) state+ball(null) : true

<--ball(null);-ball(Dist, Dir, DistChang, DirChng);turn(40);+checking(ball);-checking(goal).

// If kickOff occurs.+kickOff <-

?ball(Dist, Dir, DistChang, DirChng);-ball(Dist, Dir, DistChang, DirChng).

// The ball Dir is not correct, turn to match dir

+ball(Dist, Dir, DistChang, DirChng) : not (Dir = 0) & not checking(goal)<-

-ball(null);turn(Dir).

// If ball is out of reach, run toward it.+ball(Dist, Dir, DistChang, DirChng) : Dist > 1

<--ball(null);-checking(goal);-ball(Dist, Dir, DistChang, DirChng);dash(Dist * 25);.wait(kickOff).

// REACHBALL: The ball Dir is correct and dist is okay. Search for the goal

+ball(Dist, Dir, DistChng, DirChng) : Dist <= 1 <- +checking(goal);

!kick(goal);-ball(null).

// Sub Goal 1: see goal, then kick ball+!kick(goal): goal(GDist, GDir, GDistChng, GDirChng) &

checking(goal)<-

kick(100, GDir);-goal(GDist, GDir, GDistChng, GDirChng);-checking(goal).

// Sub Goal 2: do not see goal, then search for goal+!kick(goal): goal(null) & checking(goal)

<-turn(40).

// if I see the goal, that means is not goal(null)+goal(GDist, GDir, GDistChng, GDirChng)

<- -goal(null).// vice versa+goal(null)

<- -goal(GDist, GDir, GDistChng, GDirChng).

Page 11: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Time Comparison Jason Implementation vs Krislet

Time(ms) for first goal in each Trial Run

Krislet SoccerPlayer

539 927

553 976

455 960

447 955

452 1019

465 967

522 915

486 1014

507 975

514 1047

Jason Implementation vs Krislet

0

200

400

600

800

1000

1200

1 2 3 4 5 6 7 8 9 10

Trial Run

Time i

n ms

SoccerPlayer Krislet

Page 12: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

BDI Programming System Requirements

• The programming language has to be expressive– Able to describe the agent behavior without regarding

how agent is implemented.

• Reasoning of system has to be flexible – Able to decide, moment by moment, which action to

perform in the furtherance of its goals.

• Has to be responsive to the environment – Interpreter must be fast.– Must have correct response to all situations.

Page 13: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Expressive: AgentSpeak(L) describe agent using abstract notions.

// FOUND BALL: The ball Dir is correct and dist is okay. Search for the goal

+ball(Dist, Dir, DistChng, DirChng) : Dist <= 1 <- +checking(goal); !kick(goal); -ball(null).

// Kick if the agent see the goal.

+!kick(goal): goal(GDist, GDir, GDistChng, GDirChng) & checking(goal)<- kick(100, GDir); -goal(GDist, GDir, GDistChng, GDirChng); -checking(goal);

+checking(ball).

// Turn if the agent do not see the goal.+!kick(goal): goal(null) & checking(goal)

<- turn(40).

Checking(ball)

ba ll(nu ll)tu rn(20)

Found(ball)

D ist>1D ash(25*D ist)

D ir <> 0turn(D ir)

Checking(goal) G oal(nu ll)tu rn(20)

kickoffid le

Page 14: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Flexibility : Deliberate to Select Achievable Option.

// Option 1: If the ball is in range, kick the ball

+ball(Dist, Dir, DistChng, DirChng) : Dist <= 1 <- +checking(goal); !kick(goal); -ball(null).

// Option 2: If the ball is in range, find goal+ball(Dist, Dir, DistChng, DirChng) : Dist <= 1 <- +checking(goal); !check(goal); -ball(null).

// SubGoal 1: Kick ball to goal+!kick(goal): goal(GDist, GDir, GDistChng,

GDirChng) & checking(goal)<- kick(100, GDir); -goal(GDist, GDir, GDistChng, GDirChng); -checking(goal).

// SubGoal 2: Check the goal location+!check(goal): goal(null) & checking(goal)

<- turn(40).

• The following perceptions are added– +ball(0.5, 0, 0, 0)– +goal(null)

• There are two options that could be triggered.

– Option 1 has an unachievable sub goal (!kick(goal)) which required the goal location is known.

– Option 2 has achievable sub-goal. (!check(goal)).

• The interpreter should pick option 2.• However, Jason pick option 1 and

generate the following error.– [test1] Found a goal for which there is no

applicable plan:– +!kick(goal)– @l__4[source(self)]

+ball(Dist,Dir,DistChng,DirChng)[source(percept)] : (Dist <= 1) <- !kick(goal); -ball(null). : {Dist=1, Dir=0, DirChng=0, DistChng=0}

– [test1] No fail event was generated for +!kick(goal)

Page 15: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Flexibility (cont’)

// REACHBALL: The ball Dir is correct and dist is okay. Search for the goal

+ball(Dist, Dir, DistChng, DirChng) : Dist <= 1 <- +checking(goal); !kick(goal); -ball(null).

// SubGoal 1: kick ball to goal+!kick(goal): goal(GDist, GDir, GDistChng,

GDirChng) & checking(goal)<- kick(100, GDir); -goal(GDist, GDir, GDistChng, GDirChng); -checking(goal).

// SubGoal 2: check goal location+!kick(goal): goal(null) & checking(goal)

<- turn(40).

• Jason was successful in picking the achievable plan if the condition is specified in the context part of the plan.

Page 16: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Responsive to the Environment

// If ball is out of reach, run toward it.+ball(Dist, Dir, DistChang, DirChng) : Dist > 1

<- -ball(null); -ball(Dist, Dir, DistChang, DirChng); dash(Dist * 25).

• Jason handled goal as event.• When event occurs, it triggers

plans.• Advantage: responds quickly

to the environment. It behaves like reflex action.

• Disadvantage: there is no check whether the goal is accomplished or not.

• Jason does not respond to incomplete goal.

RobuCup Jason

Send PerceptionAction

Processing Send Command

Before Kick-Off

ball(20, 10, 0, 0)   dash(500)

 Dash(500) and failed  

ball(20, 10, 0, 0)  No response to the

old perception

Page 17: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Conclusions

• Successfully implement soccer player in RoboCUP using BDI development framework.

• Noticeable performance difference in terms of speed between the Java code implementation of Krislet and the Jason version;

• Agent Speak(L) can express agent behavior using abstract notions;

• Jason BDI reasoning engine is not flexible with the option deliberation;

• Jason has no verification whether the goal has been accomplished;

Page 18: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Backup slide: Jason Environment

IntensionPerceptions Actions

P lanLibrary

BeliefBase

Jason Environom ent

BDI Engine

IntentionSelection

RoboCup Server

Soc

cer

Fie

ldV

isua

l Inf

o

Pla

yer

Act

ions

Page 19: SYSC5103 Software Agents RoboCup and BDI Architecture Fall 2006 Yousif Al Ridhawi Morvarid Sehatkar Walter Kung Gayathri Jayaraman

Backup slide: An interpretation cycle of an AgentSpeak(L) program