Skip to content

Implementation notes

kcjb edited this page Feb 2, 2013 · 3 revisions

Partitions

  • :model for statistical model entities
  • :test for tests, agent, and action entities
  • :sim for sim, process, clock, and result entities

Entities vs. Datoms

The code queries for entities for most data types. Entity types whose population is huge cannot fit in memory, so for those the datoms API is used to lazily walk. The only entity types presumed to have a huge population are actions and results.

Actions should be well-behaved

The runner presumes that actions are well-behaved: they do not throw exceptions or fail to return in a reasonable time. If an action does throw an exception, it is presumed to be a program bug and will kill the entire sim process.

Utility fns

It is worth reading the util namespace in its entirety before coding on the project, so you don't reinvent any wheels.

Dual Schema

Most sim entities have generic attributes from the sim schema, plus domain attributes specific to the sim. E.g. in the getting started example. The :model/tests attribute is generic to all sims, but the :model/meanTradeAmount attribute is specific to the domain.

It is idiomatic to namespace the attributes by the entity type, even though those attributes are coming from two different schemas, e.g. both the attributes above have the namespace model.