Tardiness em tempo de Simulação (MABS+ - (LES) da PUC-Rio
Transcrição
Tardiness em tempo de Simulação (MABS+ - (LES) da PUC-Rio
Tardiness em tempo de Simulação (MABS+Java) Adaptando MASP para realizar estudos de caso com deslocamento espacial Pier-Giovanni Taranti Sumário Tardiness em Tempo de Simulação MASP Resultados - Dificuldades Trabalhos Futuros 23/08/11 @LES/PUC-Rio 2 Tardiness em MABS + Java Definições: Sistema de Tempo Real • Soft e Hard real-time Java e timeliness Java Real-Time (JSR01) 23/08/11 @LES/PUC-Rio 3 Tardiness em MABS + Java Definições: Simulações • Sistemas Contínuos e Discretos Abstrações de Tempo • Tempo Real, Tempo do Relógio de Parede, Tempo de Simulação Avanço de Tempo em Simulação • Time-stepped e next-event 23/08/11 @LES/PUC-Rio 4 Tardiness em MABS + Java Simulações de Eventos Discretos e Ambientes Virtuais Adequabilidade de Abstrações de Agentes para representar Ambientes Complexos MABS e agentes em suporte a simulação MASON, NETLOGO, SWARM... Avanço de Tempo em MABS 23/08/11 @LES/PUC-Rio 5 Tardiness em MABS + Java MASP Para experimentação Atualmente controle do avanço de tempo de simulação pelo controle dinâmico do LC Tarefa do semestre – implementar a capacidade de visualização entre atores 23/08/11 @LES/PUC-Rio 6 MASP 23/08/11 @LES/PUC-Rio 7 MASP class sim ulacrum SimpleBehaviour sim ulacrum ::Spatial2Dstate ~ ~ ~ ~ ~ coordinate: Coordinate course: double lastUpdateCoordinateTime: double simulationClock: SimulationClock = SimulationClock... speed: double + + + + + + + + + getCoordinate() : Coordinate getCourse() : double getSpeed() : double setCoordinate(Coordinate) : void setCoordinate() : void setCourse(double) : void setSpeed(double) : void Spatial2Dstate() Spatial2Dstate(Coordinate, double, double) + spatial2Dstate Agent sim ulacrum ::MaspAgent 23/08/11 + - fileRegister: File outRegister: PrintWriter serialVersionUI D: long = 1L { readOnly} spatial2Dstate: Spatial2Dstate writerRegister: FileWriter + + + # # executeLogAgent(Agent, String, long, long) : void getSpatial2Dstate() : Spatial2Dstate loadBehaviours(List< String> ) : void MaspAgent() setup() : void setupSimulation() : void @LES/PUC-Rio sim ulacrum ::MaspSim ulationBehaviour # ~ - finished: boolean logStep: int = 1 serialVersionUI D: long = 1L { readOnly} simulatedTimePeriod: double simulationClock: SimulationClock = SimulationClock... speed: double tickCount: int = 0 wakeupSimulationTime: double + + + + + # + + + action() : void done() : boolean getTickCount() : int getWakeupSimulationTime() : double MaspSimulationBehaviour(MaspAgent) onStart() : void onTick() : void reset(long) : void reset() : void setSimulatedTimePeriod(long) : void setSimulatedTimePeriod() : void setTickCount(int) : void setWakeupSimulationTime(long) : void stop() : void sim ulacrum :: Masp2DMovem entSim ulationBehaviour + - Masp2DMovementSimulationBehaviour(MaspAgent) setSimulatedTimePeriod() : void 8 class clock MASP clock::Statistics # # # # # # errorSum: double maxErrorI nformed: double maxPeriodI nformed: long numberOfErrorsGreatherThenTriggerPoint: long numberOfErrorsGreatherThenTriggerUpperLimit: long numberOfI nformations: long + + + + + + + + getErrorSum() : double getMaxErrorI nformed() : double getMaxPeriodI nformed() : long getNumberOfErrorsGreatherThenTriggerPoint() : double getNumberOfErrorsGreatherThenTriggerUpperLimit() : double getNumberOfI nformations() : long Statistics() Statistics(long, double, double, long, long, long) clock::Sim ulationClockControl - I NSTANCE: SimulationClockControl = new SimulationC... readLock: Lock = rwl.readLock() rwl: ReentrantReadWriteLock = new ReentrantRe... simulationClockRate: double = PropertiesLoade... writeLock: Lock = rwl.writeLock() + + + - getI nstance() : SimulationClockControl getSimulationClockRate() : double setSimulationClockRate(double) : void SimulationClockControl() -simulationClockControl clock::Sim ulationClock clock::StatisticCollector - fileRegister: File outRegister: PrintWriter statisticCollector: StatisticCollector triggerPoint: double triggerUpperLimit: double writerRegister: FileWriter + + + + - getI nstance() : StatisticCollector insertData(long, double) : void recoverData() : Statistics reset() : void StatisticCollector() + - I NSTANCE: SimulationClock = new SimulationC... isHeatingCycle: boolean lastRealTime: long lastSimulationTime: long readLock: Lock = rwl.readLock() rwl: ReentrantReadWriteLock = new ReentrantRe... simulationClockControl: SimulationClockControl simulationStarted: boolean startRealTime: long writeLock: Lock = rwl.writeLock() + + + - getCurrentSimulationTime() : long getI nstance() : SimulationClock setSimulationStarted(boolean) : void SimulationClock() Agent clock::ClockAgent ~ codec: Codec = new SLCodec() manager: ContentManager = (ContentManager... TimeRateControl: long = PropertiesLoade... # setup() : void clock::FactoryHandleTim eRateBehavior + 23/08/11 getTickerBehaviour(Agent, long) : TickerBehaviour @LES/PUC-Rio clock::FactorySim ulationClockControl + getSimulationClockControl() : SimulationClockControl 9 MASP class controlApproach TickerBehaviour controlApproach::HandleTim eRateBehaviour ~ + A: double B: double serialVersionUI D: long = 1L { readOnly} unstabilityLevel: int errorControl() : void HandleTimeRateBehaviorSqr02(Agent, long) 23/08/11 currentStatistics: Statistics lastGoodRate: long lastRate: long oldStatistics: Statistics = StatisticCollec... serialVersionUI D: long = 1L { readOnly} simulationClock: SimulationClock = SimulationClock... simulationClockControl: SimulationClockControl = FactorySimulati... stabilityCounter: int ~ + # errorControl() : void HandleTimeRateBehaviour(Agent, long) onTick() : void controlApproach:: HandleTimeRateBehaviorLinear2 controlApproach:: HandleTim eRateBehaviorSqr02 ~ ~ ~ # # # # # # # - counterStrongCorrection: int = 0 lastError: double = 0 serialVersionUI D: long = 1L { readOnly} usedStrongCorrection: boolean = false ~ + + errorControl() : void HandleTimeRateBehaviorLinear2(Agent, long) optimizeSimulationTimeRate(double) : double @LES/PUC-Rio controlApproach:: HandleTim eRateBehaviorSqr01 ~ ~ ~ A: double B: double serialVersionUI D: long = 1L { readOnly} unstabilityLevel: int ~ + errorControl() : void HandleTimeRateBehaviorSqr01(Agent, long) controlApproach:: HandleTim eRateBehaviorLinear - serialVersionUI D: long = 1L { readOnly} ~ + + errorControl() : void HandleTimeRateBehaviorLinear(Agent, long) optimizeSimulationTimeRate(double) : double 10 MASP class analiseLoggers analiseLoggers::ClockControlRegisterLogger analiseLoggers::BehaviorsLogger # # - fileRegister: File I NSTANCE: ClockControlRegisterLogger = new ClockContro... outRegister: PrintWriter readLock: Lock = rwl.readLock() rwl: ReentrantReadWriteLock = new ReentrantRe... simulationClock: SimulationClock = SimulationClock... simulationClockControl: SimulationClockControl = FactorySimulati... writeLock: Lock = rwl.writeLock() writerRegister: FileWriter # # - fileRegister: File I NSTANCE: BehaviorsLogger = new BehaviorsLo... outRegister: PrintWriter readLock: Lock = rwl.readLock() rwl: ReentrantReadWriteLock = new ReentrantRe... simulationClock: SimulationClock = SimulationClock... simulationClockControl: SimulationClockControl = FactorySimulati... writeLock: Lock = rwl.writeLock() writerRegister: FileWriter + + ClockControlRegisterLogger() executeLogClockControl(double) : void getI nstance() : ClockControlRegisterLogger + + BehaviorsLogger() executeLogBehaviour(Agent, Behaviour, String, long, double, double, double) : void getI nstance() : BehaviorsLogger analiseLoggers::StatisticsLogger # # - fileRegister: File I NSTANCE: StatisticsLogger = new StatisticsL... outRegister: PrintWriter readLock: Lock = rwl.readLock() rwl: ReentrantReadWriteLock = new ReentrantRe... simulationClock: SimulationClock = SimulationClock... simulationClockControl: SimulationClockControl = FactorySimulati... writeLock: Lock = rwl.writeLock() writerRegister: FileWriter + + - getI nstance() : StatisticsLogger logStatistics(long, double, double, long, long, long) : void StatisticsLogger() 23/08/11 @LES/PUC-Rio 11 MASP class virtalSpace virtalSpace::SpatialAvatar ~ ~ ~ ~ ~ course: double localName: String position: Coordinate simulationTimestamp: long speed: double # # # # # # # # # # + getCourse() : double getLocalName() : String getPosition() : Coordinate getSimulationTimestamp() : long getSpeed() : double setCourse(double) : void setLocalName(String) : void setPosition(Coordinate) : void setSimulationTimestamp(long) : void setSpeed(double) : void SpatialAvatar(String, double, double, Coordinate, long) virtalSpace::VirtualSpace ~ - readLock: Lock = rwl.readLock() rwl: ReentrantReadWriteLock = new ReentrantRe... singleton: VirtualSpace = null virtualSpaceAvatars: Hashtable< String, SpatialAvatar> = new Hashtable< S... writeLock: Lock = rwl.writeLock() + + + + clone() : VirtualSpace getI nstance() : VirtualSpace main(String[ ] ) : void updateEntity(String, double, double, Coordinate, long) : void virtalSpace::VirtualSpaceMirror ~ - readLock: Lock = rwl.readLock() rwl: ReentrantReadWriteLock = new ReentrantRe... singleton: VirtualSpaceMirror = null virtualSpaceAvatars: Hashtable< String, SpatialAvatar> = new Hashtable< S... writeLock: Lock = rwl.writeLock() + # # getI nstance() : VirtualSpaceMirror getVirtualSpaceAvatarsCopy() : Hashtable< String, SpatialAvatar> setVirtualSpaceAvatars(Hashtable< String, SpatialAvatar> ) : void 23/08/11 @LES/PUC-Rio 12 MASP class support support::PropertiesLoader - masp: String = "masp.properties" props: Properties # # getValor(String) : String PropertiesLoader() -loader support::OntoAddress + + + ontoAddressStatic: String ontologyNameOWL: String = PropertiesLoade... { readOnly} ontologyNS: String = ("http: / / www.ow... { readOnly} ontologyURI : String = ("http: / / www.ow... { readOnly} + + getOntoAddress() : String main(String[ ] ) : void support::OntoModels support::PropertiesLoaderI m pl + + + + + + + + + + + + + + + + + + + + + ALLOW_MULTI PLE_AGENTS: boolean = findAllowMultip... { readOnly} APPROACH: String = findApproach() { readOnly} AUTOMATI C_CONTROL: boolean = findAutomaticCo... { readOnly} AVOI D_OVERLOAD: boolean = findAvoidOverload() { readOnly} DEBUG: boolean = findDebug() { readOnly} DEFAULT_SLI CE_TI ME: long = findDefaultSlic... { readOnly} ERROR_TRI GGER: double = findErrorTrigger() { readOnly} EXPERI MENT_DURATI ON_MI N: int = findExpreriment... { readOnly} FI LE_LOG: boolean = findFileLog() { readOnly} I NI TI AL_SI MULATI ON_TI ME_RATE: double = findI nitialSimu... JADE_PORT: String = findJadePort() { readOnly} loader: PropertiesLoader = new PropertiesL... MAX_ERROR_TRI GGER: double = findMaxErrorTri... { readOnly} MAXI MUM_SPATI AL_ERROR: double = findMaximumSpat... { readOnly} ONTOLOGY_NAME_OWL: String = findOntologyName() { readOnly} OPTI MI ZATI ON_RATE: double = findOptimizatio... { readOnly} overallClassTest: boolean = true RMA: boolean = findRMA() { readOnly} STABLES_CYCLES_TO_OPTI MI ZE: int = findStableCycle... { readOnly} STOP_WHEN_OVERLOAD: boolean = findStopWhenOve... { readOnly} TI ME_FOR_HEATI NG: int = findTimeForHeating() { readOnly} TI ME_RATE_CONTROL: long = findTimeRateCon... USE_HEATI NG_CYCLE: boolean = findUseHeatingC... + + + findAllowMultipleAgents() : boolean findApproach() : String findAutomaticControl() : boolean findAvoidOverload() : boolean findDebug() : boolean findDefaultSliceTime() : long findErrorTrigger() : double findExprerimentDurationMin() : int findFileLog() : boolean findI nitialSimulationTimeRate() : double findJadePort() : String findMaxErrorTrigger() : double findMaximumSpatialError() : double findOntologyName() : String findOptimizationRate() : double findRMA() : boolean findStableCyclesToOptimize() : int findStopWhenOverload() : boolean findTimeForHeating() : int findTimeRateControl() : long findUseHeatingCycle() : boolean getValor(String) : String main(String[ ] ) : void overallClassTest() : void setUseHeatingCycle(boolean) : void - inferOntModel: OntModelI mpl rawOntModel: OntModelI mpl + + + + chargeModels() : void getI nferModel() : OntModelI mpl getOntoModel() : OntModelI mpl main(String[ ] ) : void support::GisDbSingleton - conn: java.sql.Connection pgConn: PGConnection singleton: GisDbSingleton = null + + + getConn() : java.sql.Connection getI nstance() : GisDbSingleton GisDbSingleton() main(String[ ] ) : void support::JenaFacade + + + + + + + getAgents() : List< String> getBehavioursForRole(String) : List< String> getDataTypePropertyValueDouble(String, String) : double getDataTypePropertyValueI nt(String, String) : int getDataTypePropertyValueString(String, String) : String getOntologyClassForI ndividual(String) : String getRoleForAgent(String) : String «property set» + setI NI TI AL_SI MULATI ON_TI ME_RATE(double) : void 23/08/11 @LES/PUC-Rio 13 MASP 23/08/11 @LES/PUC-Rio 14 Dificuldades Excesso de mensagens quando usando comunicação entre agentes do Jade; Decisão final – blackboard com tabela clonada, agentes gerenciando a clonagem periódica; Controle de acessos simultâneos por vários agentes (lock R/W); Ausência de literatura; 23/08/11 @LES/PUC-Rio 15 Resultados Pronto para iniciar implementação de exemplos mais consistentes; Artigo em avaliação no JSS (Journal of Software Systems) Artigo submetido ao Autosoft (apresentando inicialmente o algoritmo de controle): Simulações Centradas em Agentes e implementadas em Java: controlando atrasos em relação ao tempo de simulação 23/08/11 @LES/PUC-Rio 16 Trabalhos Futuros Defesa de Proposta; Limpar e documentar código e plataforma; Reimplementar código perdido. Caso de Uso com mobilidade espacial; Refinar algoritmo de controle. 23/08/11 @LES/PUC-Rio 17