Title: Example of Draft KobrA-2 PIM
1Example of Draft KobrA-2 PIM
2Case-Studies for Agent andGame Related Extensions
- Small scale soccer penalty simulation
- Large scale Rollerslam simulation
gameOver, goal
action(s,legs,shoot(2)) action(k,legs,move(right))
3
2 b k
1 s
Y X 1 2 3
3 b
2 k
1 s
Y X 1 2 3
actions(k,legs,move(right))
3
2 k
1 s, b
Y X 1 2 3
3
2 k, b
1 s
Y X 1 2 3
3
2 k, b
1 s
Y X 1 2 3
action(k,hands,grab(yes))
action(s,legs,shoot(3)) action(k,legs,move(right))
gameOver, nogoal
3PenaltySim Specification Class Diagram
ltltSubject Componentgtgt ltltMASgtgt PenaltySim
4PenaltySim SpecificationComponent Diagram
IPenaltySim
PPenaltySim
5PenaltySim SpecificationProtocol State Machine
new()
created
run()
run()
running
stopped
stop()
6PenaltySim Realization Class Diagram 1
ltltSubject Componentgtgt ltltMASgtgt PenaltySim
2
ltltReflexAgentgtgt Player
ltltAgentActiongtgt PlayerAction
Ball
9
Goal
3
ltltAgentActiongtgt ArmAction
ltltAgentActiongtgt LegAction
FieldObject
FieldZone
ltltAgentActiongtgt GrabAction
7PenaltySim Realization Class Diagram 2
ltltSubject Componentgtgt ltltMASgtgt PenaltySim
2
2
ltltEffectorgtgt Legs do(roleRole,actionLegAction)
2
ltltusegtgt
ltltusegtgt
ltltReflexAgentgtgt Player
ltltusegtgt
ltltReflexAgentgtgt Kicker
ltltReflexAgentgtgt Keeper
8PenaltySim Realization Class Diagram 3
ltltSubject Componentgtgt ltltMASgtgt PenaltySim
ltltEnvironmentgtgt ltltAutomataAgentgtgt PenaltyEnv
ltltusegtgt
ltltusegtgt
ltltInterfacegtgt IPenaltyEnv ltltcreategtgt
new() initialize() getEnvState()
EnvStateKind -reason(shooterActionPlayerActionin
, keeperActionPlayerActionin,
shooterPerceptsXYCoord3out,ordered,
keeperPerceptsXYCoord3out, ordered)
9PenaltySim Realization Class Diagram 4
ltltSubject Componentgtgt ltltMASgtgt PenaltySim
ltltComponentgtgt CommincationChannel
10PenaltySim Realization Component Diagram
ltltSubject Componentgtgt ltltMASgtgt PenaltySim
REnv
RPlayer2
RChannel
PEnv
PPlayer
ltltEnvironmentgtgt ltltAutomataAgentgtgt PenaltyEnv
ltltcreategtgt -new() -initialize()
-getEnvState() EnvStateKind
-reason(shooterActionPlayerActionin,
keeperActionPlayerActionin,
shooterPerceptsXYCoord3out,ordered,
keeperPerceptsXYCoord3out, ordered)
ltltReflexAgentgtgt Player ltltcreategtgt -new()
-initialize() -getState() AgStateKind
-getRole() String -reason(perceptsXYCoord3
ordered) PlayerAction
RLegs
REyes
RSendPercepts
RGetActions
PChannel
PEyes2
PLegs2
ltltAgentgtgt Shooter
PGetActions
RArms
PArms
ltltAgentgtgt Keeper
PSendPercepts
11PenaltySim RealizationComposite Structure Diagram
rsRPlayer
reREnv
ltltMASgtgt PenaltySim
pePEnv
ltltEnvironmentgtgt ltltAutomataAgentgtgt PenaltyEnv
ltltSubjectComponentgtgt ltltMASgtgt penaltySim ltltcreate
gtgt -new()
rspRSendPercepts
rgaRGetActions
pspRSendPercepts
pgaRGetActions
ltltComponentgtgt CommunicationChannel
rlsRLegs
plsPLegs
ltltReflex Agentgtgt Shooter
resREyes
pesPEyes
psPPlayer
plkRLegs
rakRArms
pcPChannel
rlkRLegs
pakPArms
ltltReflexAgentgtgt Keeper
rekREyes
pkPPlayer
pekPEyes
rcRChannel
rkRPlayer
12PenaltySim RealizationActivity Diagram 1
PenaltySim.new()
connect(rs,ps)
connect(rk,pk)
connect(re,pe)
PenaltyEnv.new()
connect(rc,pc)
connect(rls,pls)
connect(res,pes)
Shooter.new()
connect(rlk,plk)
connect(rak,pak)
connect(rek,pek)
Keeper.new()
connect(rga,pga)
CommunicationChannel.new()
connect(rsp,psp)
13PenaltySim Realization Activity Diagram 2
run()
sShooter
ePenaltyEnv
kKeeper
e.initialize()
k.initialize()
s.initialize()
e.sendPercepts(s)
e.sendPercepts(k)
spXYCoord3
kpXYCoord3
k.reason(kp)
s.reason(sp)
saLegAction
kaPlayerAction
k.do(keeper,ka)
s.do(shooter,sa)
saLegAction
kaPlayerAction
e.reason(sa,ka,sp,kp)
14Player Specification Class Diagram
FieldObj
Ball
ltltAgentActiongtgt PlayerAction
ltltSubject Componentgtgt ltltReflexAgentgtgt Player
ltltusegtgt
ltltusegtgt
ltltAgentActiongtgt LegAction
ltltAgentActiongtgt ArmAction
ltltusegtgt
ltltReflexAgentgtgt Kicker
ltltReflexAgentgtgt Keeper
ltltAgentActiongtgt GrabAction
ltltenumerationgtgt AgStateKind empty initialized per
ceptsReceived actionChosen actionSent
15Player Specification Component Diagram
IPlayer
PPlayer
ltltSubject Componentgtgt ltltReflexAgentgtgt Player ltltcr
eategtgt -new() -getState() AgStateKind -getRole()
String -reason(perceptsXYCoord3ordered)
PlayerAction
ltltsensorgtgt Eyes
REyes
ltlteffectorgtgt Legs
RLegs
ltlteffectorgtgt Arms
RArms
16Player SpecificationProtocol State Machine
new()
empty
initialize()
initialized
CommunicationChannlerself.sense()
perceptsReceived
CommunicationChannlerself.sense()
reason(perceptsXYCoord3ordered)
actionSent
actionChosen
selfCommunicationChannel.do(Role,Action)
17Shooter Realization Class Diagram
ltltSubject Componentgtgt ltltReflexAgentgtgt Shooter
ltltReflexReasonergtgt ShooterReflexReasoner
18Shooter Realization Component Diagram
IPlayer
PPlayer
ltltSubject Componentgtgt ltltReflexAgentgtgt Shooter
REyes
ltltsensorgtgt Eyes
ltlteffectorgtgt Legs
RLegs
RPRR
IPlayerReflexReasoner
PPRR
REyes
ltltReflexReasonergtgt ShooterReflexReasoner ltltcreat
egtgt -new() reason(perceptsXYCoord3ordered)L
egAction
ltltsensorgtgt Eyes
ltlteffectorgtgt Legs
RLegs
19Shooter RealizationComposite Structure Diagram
psPPlayer
ltltReflexAgentgtgt Shooter
rlsrrRLegs
rlsRLegs
resrrREyes
ltltReflexReasonertgtgt ShooterReflexReasoner
resREyes
ltltdelegategtgt
ltltdelegategtgt
psrrPPRR
rsrrRPRR
20Shooter Realization Activity Diagram 1
Shooter.new()
connect(rsrr,psrr)
delegate(resrr,res)
ShooterReflexReasoner..new()
delegate(rlsrr,rls)
21Shooter Realization Activity Diagram 2
spXYCoord3ordered
Shooter.reason(sp)
shooterX sp1.x
keeperX sp2.x
ballX sp3.x
ballY sp3.y
ballX lt shooterX
shooterX lt ballX
shooterX ballX
ballY 0
else
shooterX lt keeperX
keeperX lt shooterX
shooter X keeper X
sa void
saLegAction
22Keeper Realization Class Diagram
ltltSubject Componentgtgt ltltReflexAgentgtgt Keeper
ltltReflexReasonergtgt KepperReflexReasoner
23Keeper Realization Component Diagram
IPlayer
PPlayer
RLegs
ltltSubject Componentgtgt ltltReflexAgentgtgt Keeper
REyes
ltlteffectorgtgt Legs
ltltsensorgtgt Eyes
ltlteffectorgtgt Arms
RArms
RPRR
IPlayerReflexReasoner
PPRR
REyes
RLegs
ltltsensorgtgt Eyes
ltlteffectorgtgt Legs
ltlteffectorgtgt Arms
RArms
24Keeper RealizationComposite Structure Diagram
pkPPlayer
ltltReflexAgentgtgt Keeper
rlkRLegs
ltltdelegategtgt
rlkrrRLegs
rekrrREyes
ltltReflexReasonergtgt KeeperrReflexReasoner
rekREyes
ltltdelegategtgt
rakRArms
ltltdelegategtgt
rakrrRArms
pkrrPPRR
rkrrRPRR
25Shooter Realization Activity Diagram 1
Shooter.new()
connect(rkrr,pkrr)
delegate(rlkrr,rlk)
ShooterReflexRuleBaseComponent..new()
delegate(rakrr,rak)
delegate(rekrr,rek)
26Keeper Realization Activity Diagram 2
kpXYCoord3ordered
Keeper.reason(sp)
shooterX sp1.x
keeperX sp2.x
ballX sp3.x
ballY sp3.y
ballX lt keeperX
keeperX lt ballX
keeperX ballX
ballY keeperY
else
sa GrabAction.new()
sa void
kaPlayerAction
27PenaltyEnv Specification Class Diagram
ltltusegtgt
ltltusegtgt
ltltAgentActiongtgt PlayerAction
ltltInterfacegtgt IPenaltyEnv ltltcreategtgt
new() initialize() getEnvState()
EnvStateKind -reason(shooterActionPlayerActionin
, keeperActionPlayerActionin,
shooterPerceptsXYCoord3out,ordered,
keeperPerceptsXYCoord3out, ordered)
ltltAgentActiongtgt LegAction
ltltAgentActiongtgt ArmAction
ltltAgentActiongtgt GrabAction
ltltenumerationgtgt EnvStateKind empty initialized ac
tionsReceived perceptsUpdated perceptsSent
28PenaltyEnv SpecificationComponent Diagram
IPenaltyEnv
PPenaltyEnv
ltltSubject Componentgtgt ltltEnvironmentgtgt ltltAutomataA
gentgtgt PenaltyEnv ltltcreategtgt -new()
initialize() -getEnvState() EnvStateKind
-reason(shooterActionPlayerActionin,
keeperActionPlayerActionin,
shooterPerceptsXYCoord3out
,ordered, keeperPerceptsXYCoo
rd3out, ordered)
ltltsensorgtgt GetActions
RGetActions
RSendPercepts
ltlteffectorgtgt SendPercepts
29PenaltyEnv SpecificationProtocol State Machine
initialize()
new()
empty
initialized
lt
CommunicationChannlerself.getAction(shooter,LegAc
tion)
CommunicationChannlerself.getAction(keeper,Player
Action)
actionsReceived
reason(shooterActionPlayerActionin,
keeperActionPlayerActionin,
shooterPerceptsXYCoord3out,ordered,
keeperPerceptsXYCoord3out,
ordered)
perceptsUpdated
selfCommunicationChannel.sendPercepts(shooter)
selfCommunicationChannel.sendPercepts(keeper)
perceptsSent