Stock and flow diagrams are widely used in epidemiology to model the dynamics of populations. Although tools already exist for building these diagrams and simulating the systems they describe, we have created a new package called StockFlow, part of the AlgebraicJulia ecosystem, which uses ideas from category theory to overcome notable limitations of existing software. Compositionality is provided by the theory of decorated cospans: stock and flow diagrams can composed to form larger ones in an intuitive way formalized by the operad of undirected wiring diagrams. Our approach also cleanly separates the syntax of stock and flow diagrams from the semantics they can be assigned. We consider semantics in ordinary differential equations, although others are possible. As an example, we explain code in StockFlow that implements a simplified version of a COVID-19 model used in Canada.
翻译:种群和流程图在流行病学中被广泛用来模拟人口动态。虽然已经存在用于建立这些图表和模拟它们所描述的系统的工具,但我们已经创建了一个名为StockFlow的新软件包,这是代数朱利亚生态系统的一部分,它利用类别理论中的想法来克服现有软件的显著局限性。组成性由经装饰的圆锥形理论提供:存量和流程图可以组成较大的结构,由未经定向的电线图的操作正式化的直观方式形成。我们的方法也将库存和流程图的语法与它们可以分配的语义学区分开来。我们考虑普通差异方程式中的语法,尽管其他方程式是可能的。举例来说,我们在SockFlow中解释代码,该代码可以实施加拿大使用的COVID-19模型的简化版本。