290 likes | 445 Views
Example of Draft KobrA-2 PIM. Jacques Robin. Case-Studies for Agent and Game Related Extensions. Small scale: soccer penalty simulation Large scale: Rollerslam simulation. gameOver, goal. action(s,legs,shoot(2)) action(k,legs,move(right)). actions(k,legs,move(right)).
E N D
Example of Draft KobrA-2 PIM Jacques Robin
Case-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)) actions(k,legs,move(right)) action(k,hands,grab(yes)) action(s,legs,shoot(3)) action(k,legs,move(right)) gameOver, nogoal
<<enumeration>> SimStateKind created running stopped <<Interface>> IPenaltySim <<create>> +new() +run() +stop() +getSimState(): SimStateKind PenaltySim Specification Class Diagram <<Subject Component>> <<MAS>> PenaltySim
<<Subject Component>> <<MAS>> PenaltySim -state:SimStateKind <<create>> -new(): -getSimState(): SimStateKind -run() -stop() - connect(RIPort:Port,PIPort:Port) PenaltySim SpecificationComponent Diagram IPenaltySim PPenaltySim
PenaltySim SpecificationProtocol State Machine new() created run() run() running stopped stop()
<<enumeration>> Coord 0 1 2 <<enumeration>> Dir left right <<enumeration>> Role shooter keeper <<enumeration>> ChannelStateKind created perceptsReceived perceptsSensed actionReceived actionSensed <<enumeration>> AgStateKind empty initialized perceptsReceived actionChosen actionSent <<AgentAction>> MoveAction to: Dir <<AgentAction>> KickAction to: XYCoord <<enumeration>> EnvStateKind empty initialized actionsReceived perceptsUpdated perceptsSent <<Percept>> XYCoord x:Coord y:Coord PenaltySim Realization Class Diagram 1 <<Subject Component>> <<MAS>> PenaltySim 2 <<ReflexAgent>> Player <<AgentAction>> PlayerAction Ball * 9 Goal 3 <<AgentAction>> LegAction <<AgentAction>> ArmAction FieldZone FieldObject <<AgentAction>> GrabAction
<<Interface>> IPlayer <<create>> +new() +initialize() +getState(): AgStateKind +getRole(): Role +reason(percepts:XYCoord[3]{ordered}): PlayerAction <<Sensor>> Eyes <<signal>> +sense():XYCoord[3]{ordered} <<Effector>> Arms +do(role:Role,action:ArmAction) PenaltySim Realization Class Diagram 2 <<Subject Component>> <<MAS>> PenaltySim 2 2 <<Effector>> Legs +do(role:Role,action:LegAction) 2 <<use>> <<use>> <<ReflexAgent>> Player <<use>> <<ReflexAgent>> Kicker <<ReflexAgent>> Keeper
<<Sensor>> GetActions <<signal>> +getAction(role:Role):PlayerAction <<Effector>> SendPercepts +sendPercept(role:Role):XYCoord[3]{ordered} PenaltySim Realization Class Diagram 3 <<Subject Component>> <<MAS>> PenaltySim <<Environment>> <<AutomataAgent>> PenaltyEnv <<use>> <<use>> <<Interface>> IPenaltyEnv <<create>> +new() +initialize() +getEnvState(): EnvStateKind -reason(shooterAction:PlayerAction{in}, keeperAction:PlayerAction{in}, shooterPercepts:XYCoord[3]{out,ordered}, keeperPercepts:XYCoord[3]{out, ordered})
<<Interface>> ICommunicationChanel <<create>> +new() +getChannelState:ChannelStateKind <<Sensor>> GetActions <<signal>> +getAction(role:Role):PlayerAction <<Effector>> SendPercepts +sendPercept(role:Role):XYCoord[3]{ordered} <<Effector>> Legs +do(role:Role,action:LegAction) <<Sensor>> Eyes <<signal>> +sense():XYCoord[3]{ordered} <<Effector>> Arms +do(role:Role,action:ArmAction) PenaltySim Realization Class Diagram 4 <<Subject Component>> <<MAS>> PenaltySim <<Component>> CommincationChannel
<<Component>> CommunicationChannel <<create>> -new() -getChannelState:ChannelStateKind <<signal>> -sendPercepts(role:Role):XYCoord[3]{ordered} -sense():XYCoord[3]{ordered} <<signal>> -do(role:Role,action:LegAction) <<signal>> -do(role:Role,action:ArmAction) -getAction(role:Role):Action PenaltySim Realization Component Diagram <<Subject Component>> <<MAS>> PenaltySim REnv RPlayer[2] RChannel PEnv PPlayer <<Environment>> <<AutomataAgent>> PenaltyEnv <<create>> -new() -initialize() -getEnvState(): EnvStateKind -reason(shooterAction:PlayerAction{in}, keeperAction:PlayerAction{in}, shooterPercepts:XYCoord[3]{out,ordered}, keeperPercepts:XYCoord[3]{out, ordered}) <<ReflexAgent>> Player <<create>> -new() -initialize() -getState(): AgStateKind -getRole(): String -reason(percepts:XYCoord[3]{ordered}): PlayerAction RLegs REyes RGetActions RSendPercepts PChannel PEyes[2] PLegs[2] <<Agent>> Shooter PGetActions RArms PArms <<Agent>> Keeper PSendPercepts
PenaltySim RealizationComposite Structure Diagram rs:RPlayer re:REnv <<MAS>> : PenaltySim pe;PEnv <<Environment>> <<AutomataAgent>> : PenaltyEnv <<SubjectComponent>> <<MAS>> penaltySim <<create>> -new() rga:RGetActions rsp:RSendPercepts pga:RGetActions psp:RSendPercepts <<Component>> : CommunicationChannel rls:RLegs pls:PLegs <<Reflex Agent>> : Shooter res:REyes pes:PEyes ps:PPlayer plk:RLegs rak:RArms pc:PChannel rlk:RLegs pak:PArms <<ReflexAgent>> : Keeper rek:REyes pk:PPlayer pek:PEyes rc:RChannel rk:RPlayer
PenaltySim RealizationActivity Diagram 1 PenaltySim.new() connect(rs,ps) connect(rk,pk) connect(re,pe) PenaltyEnv.new() connect(rc,pc) connect(rls,pls) Shooter.new() connect(res,pes) connect(rlk,plk) connect(rak,pak) Keeper.new() connect(rek,pek) connect(rga,pga) CommunicationChannel.new() connect(rsp,psp)
k.sense() s.sense() stop() e.getAction(k) e.getAction(s) PenaltySim Realization Activity Diagram 2 run() s:Shooter e:PenaltyEnv k:Keeper e.initialize() k.initialize() s.initialize() sp:XYCoord[3] e.sendPercepts(s) e.sendPercepts(k) kp:XYCoord[3] k.reason(kp) s.reason(sp) sa:LegAction ka:PlayerAction s.do(shooter,sa) k.do(keeper,ka) sa:LegAction ka:PlayerAction e.reason(sa,ka,sp,kp)
<<Effector>> Legs +do(Role,LegAction) <<enumeration>> Coord 0 1 2 <<enumeration>> Role shooter keeper <<enumeration>> Dir left right <<Interface>> IPlayer <<create>> +new() +initialize() +getState(): AgStateKind +getRole(): Role <<AgentAction>> KickAction to: Coord <<AgentAction>> MoveAction to: Dir <<Percept>> XYCoord x:Coord y:Coord <<Sensor>> Eyes <<signal>> +sense():XYCoord[3]{ordered} <<Effector>> Arms +do(Role,ArmAction) Player Specification Class Diagram FieldObj Ball <<AgentAction>> PlayerAction <<Subject Component>> <<ReflexAgent>> Player <<use>> * <<use>> <<AgentAction>> LegAction <<AgentAction>> ArmAction <<use>> <<ReflexAgent>> Kicker <<ReflexAgent>> Keeper <<AgentAction>> GrabAction <<enumeration>> AgStateKind empty initialized perceptsReceived actionChosen actionSent
<<ReflexAgent>> Keeper -reason(percepts:XYCoord[3]{ordered}): PlayerAction <<ReflexAgent>> Shooter -reason(percepts:XYCoord[3]{ordered}): LegAction Player Specification Component Diagram IPlayer PPlayer <<Subject Component>> <<ReflexAgent>> Player <<create>> -new() -getState(): AgStateKind -getRole(): String -reason(percepts:XYCoord[3]{ordered}): PlayerAction <<sensor>> Eyes REyes <<effector>> Legs RLegs <<effector>> Arms RArms
Player SpecificationProtocol State Machine new() empty initialize() initialized CommunicationChannler^self.sense() perceptsReceived CommunicationChannler^self.sense() reason(percepts:XYCoord[3]{ordered}) actionSent actionChosen self^CommunicationChannel.do(Role,Action)
<<Effector>> Legs +do(Role = shooter,LegAction) <<Interface>> IPlayerReflexReasoner <<create>> +new() +reason(percepts:XYCoord[3]{ordered}):LegAction <<Sensor>> Eyes <<signal>> +sense():XYCoord[3]{ordered} Shooter Realization Class Diagram <<Subject Component>> <<ReflexAgent>> Shooter <<ReflexReasoner>> ShooterReflexReasoner
Shooter Realization Component Diagram IPlayer PPlayer <<Subject Component>> <<ReflexAgent>> Shooter REyes <<sensor>> Eyes <<effector>> Legs RLegs RPRR IPlayerReflexReasoner PPRR REyes <<ReflexReasoner>> ShooterReflexReasoner <<create>> -new() +reason(percepts:XYCoord[3]{ordered}):LegAction <<sensor>> Eyes <<effector>> Legs RLegs
<<Subject Component>> <<ReflexAgent>> Shooter <<create>> -new() Shooter RealizationComposite Structure Diagram ps:PPlayer <<ReflexAgent>> : Shooter rlsrr:RLegs rls:RLegs resrr:REyes <<ReflexReasonert>> : ShooterReflexReasoner <<delegate>> <<delegate>> res:REyes psrr:PPRR rsrr:RPRR
Shooter Realization Activity Diagram 1 Shooter.new() connect(rsrr,psrr) delegate(resrr,res) ShooterReflexReasoner..new() delegate(rlsrr,rls)
mr = MoveAction.new() ml = MoveAction.new() mr.to = right ml.to = left sa = mr sa = ml klr = KickAction.new() kr = KickAction.new() kl = KickAction.new() klr.to = 0 or klr = 1 or klr = 2 kr.to = 0 kl.to = 2 sa = klr sa = kr sa = kl Shooter Realization Activity Diagram 2 sp:XYCoord[3]{ordered} Shooter.reason(sp) ballX = sp[3].x ballY = sp[3].y shooterX = sp[1].x keeperX = sp[2].x [shooterX < ballX] [ballX < shooterX] [shooterX = ballX] [ballY = 0] [else] [shooterX < keeperX] [keeperX < shooterX] [shooter X = keeper X] sa = void sa:LegAction
<<Effector>> Legs +do(Role = keeper,LegAction) <<Effector>> Arms +do(Role = keeper,ArmAction) <<Interface>> IPlayerReflexReasoner <<create>> +new() +reason(percepts:XYCoord[3]{ordered}):PlayerAction <<Sensor>> Eyes <<signal>> +sense():XYCoord[3]{ordered} Keeper Realization Class Diagram <<Subject Component>> <<ReflexAgent>> Keeper <<ReflexReasoner>> KepperReflexReasoner
<<ReflexReasoner>> KeeperReflexReasoner <<create>> -new() +reason(percepts:XYCoord[3]{ordered}):PlayerAction Keeper Realization Component Diagram IPlayer PPlayer RLegs <<Subject Component>> <<ReflexAgent>> Keeper REyes <<effector>> Legs <<sensor>> Eyes <<effector>> Arms RArms RPRR IPlayerReflexReasoner PPRR REyes RLegs <<sensor>> Eyes <<effector>> Legs <<effector>> Arms RArms
<<Subject Component>> <<ReflexAgent>> Keeper <<create>> -new() Keeper RealizationComposite Structure Diagram pk:PPlayer <<ReflexAgent>> : Keeper rlk:RLegs <<delegate>> rlkrr:RLegs rekrr:REyes <<ReflexReasoner>> : KeeperrReflexReasoner <<delegate>> rek:REyes rakrr:RArms <<delegate>> rak:RArms pkrr:PPRR rkrr:RPRR
Shooter Realization Activity Diagram 1 Shooter.new() connect(rkrr,pkrr) delegate(rlkrr,rlk) ShooterReflexRuleBaseComponent..new() delegate(rakrr,rak) delegate(rekrr,rek)
mr = MoveAction.new() ml = MoveAction.new() mr.to = right ml.to = left sa = mr sa = ml Keeper Realization Activity Diagram 2 kp:XYCoord[3]{ordered} Keeper.reason(sp) ballX = sp[3].x ballY = sp[3].y shooterX = sp[1].x keeperX = sp[2].x [keeperX < ballX] [ballX < keeperX] [keeperX = ballX] [ballY = keeperY] [else] sa = GrabAction.new() sa = void ka:PlayerAction
<<Subject Component>> <<Environment>> <<AutomataAgent>> PenaltyEnv <<enumeration>> Coord 0 1 2 <<enumeration>> Dir left right <<enumeration>> Role shooter keeper <<AgentAction>> MoveAction to: Dir <<AgentAction>> KickAction to: Coord <<Percept>> XYCoord x:Coord y:Coord <<Effector>> SendPercepts +sendPercept(role:Role):XYCoord[3]{ordered} <<Sensor>> GetActions <<signal>> +getAction(role:Role):PlayerAction PenaltyEnv Specification Class Diagram <<use>> <<use>> <<AgentAction>> PlayerAction <<Interface>> IPenaltyEnv <<create>> +new() +initialize() +getEnvState(): EnvStateKind -reason(shooterAction:PlayerAction{in}, keeperAction:PlayerAction{in}, shooterPercepts:XYCoord[3]{out,ordered}, keeperPercepts:XYCoord[3]{out, ordered}) <<AgentAction>> LegAction <<AgentAction>> ArmAction <<AgentAction>> GrabAction <<enumeration>> EnvStateKind empty initialized actionsReceived perceptsUpdated perceptsSent
PenaltyEnv SpecificationComponent Diagram IPenaltyEnv PPenaltyEnv <<Subject Component>> <<Environment>> <<AutomataAgent>> PenaltyEnv <<create>> -new() initialize() -getEnvState(): EnvStateKind -reason(shooterAction:PlayerAction{in}, keeperAction:PlayerAction{in}, shooterPercepts:XYCoord[3]{out,ordered}, keeperPercepts:XYCoord[3]{out, ordered}) <<sensor>> GetActions RGetActions RSendPercepts <<effector>> SendPercepts
PenaltyEnv SpecificationProtocol State Machine initialize() new() empty initialized < CommunicationChannler^self.getAction(keeper,PlayerAction) CommunicationChannler^self.getAction(shooter,LegAction) actionsReceived reason(shooterAction:PlayerAction{in}, keeperAction:PlayerAction{in}, shooterPercepts:XYCoord[3]{out,ordered}, keeperPercepts:XYCoord[3]{out, ordered}) perceptsUpdated self^CommunicationChannel.sendPercepts(shooter) self^CommunicationChannel.sendPercepts(keeper) perceptsSent