
it.unibo.jakta.agents.bdi.executionstrategies.impl.OneThreadPerMasImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jakta-bdi Show documentation
Show all versions of jakta-bdi Show documentation
A Kotlin internal DSL for the definition of BDI agents
package it.unibo.jakta.agents.bdi.executionstrategies.impl
import it.unibo.jakta.agents.bdi.Mas
import it.unibo.jakta.agents.fsm.Activity
import it.unibo.jakta.agents.fsm.Runner
internal class OneThreadPerMasImpl : AbstractSingleRunnerExecutionStrategy() {
override fun dispatch(mas: Mas, debugEnabled: Boolean) {
mas.agents.forEach { synchronizedAgents.addAgent(it) }
Runner.threadOf(
Activity.of {
synchronizedAgents.getAgents().forEach { (_, agentLC) ->
val sideEffects = agentLC.runOneCycle(mas.environment, it, debugEnabled)
mas.applyEnvironmentEffects(sideEffects)
}
synchronizedAgents.getAgents().ifEmpty { it.stop() }
},
).run()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy