You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To enable different trajectories (with controlled randomization), the user may want to branch simulations at a specific time.
Example
// current API val sim :Environment= createSimulation{
// define simulation entities here
}
// run it for 100 ticks
sim.run(100)
// inspect some metric (see https://www.kalasim.org/analysis/)
sim.gatherStatistic()
// Pseudocode/Desired API from here on val branches :List<Environment> = sim.branch(100)
val branchStats = branches.forEach { it.run(100) }.map{ it.gatherStatistic() }
To do so we must persist the entire graph including koin, monitors, the environment (including its queue) and process states (which are modelled as kotlin.sequences.Sequence iterators). Naturally - by design of kalasim - user-specific code will also leak into the graph to be persisted.
The feature would also provide means to have file-format for saving/loading simulations
Such a feature would also prepare for distributed simulation, where simulations are packed and shipped over the network to other compute nodes
Current state
✔️ Framework evaluation -> kryo it is, see evaluation branch https://github.com/holgerbrandl/kalasim/tree/kryoeval
✔️ Persist koin
✔️ Persist main entities and environment
✔️ Deserialize environment including sequence iterators of process definitions (graph looks good and runs up to
To enable different trajectories (with controlled randomization), the user may want to branch simulations at a specific time.
Example
To do so we must persist the entire graph including koin, monitors, the environment (including its queue) and process states (which are modelled as
kotlin.sequences.Sequence
iterators). Naturally - by design of kalasim - user-specific code will also leak into the graph to be persisted.Current state
✔️ Framework evaluation -> kryo it is, see evaluation branch https://github.com/holgerbrandl/kalasim/tree/kryoeval
✔️ Persist koin
✔️ Persist main entities and environment
✔️ Deserialize environment including sequence iterators of process definitions (graph looks good and runs up to
kalasim/modules/persistence/src/main/kotlin/Kryo.kt
Line 77 in 9d383e0
❌ Run deserialized environment--> Fails to run, which boils to sequence iterators being not serializable as of now in https://github.com/holgerbrandl/kryo-kotlin-sam/blob/master/src/main/kotlin/simpleproc/SimpleProc.kt (see Kotlin/kotlinx.coroutines#76 and EsotericSoftware/kryo#867)
The text was updated successfully, but these errors were encountered: