Skip to main content
QUICK REVIEW

[论文解读] ModelingToolkit: A Composable Graph Transformation System For Equation-Based Modeling

Yingbo Ma, Shashi Gowda|arXiv (Cornell University)|Jan 1, 2021
Parallel Computing and Optimization Techniques参考文献 28被引用 105
一句话总结

ModelingToolkit (MTK) 是一个基于 Julia 的可组合符号建模系统,通过图变换(如指标约化、并行化以及基于机器学习的模型降阶)直接作用于用户的数值代码,自动提升稳定性、性能与效率。MTK 在 HVAC 模型上实现了 590 倍的加速,与 Dymola 相比误差仅为 3%,展示了在高层可扩展框架内端到端自动化模型优化的能力。

ABSTRACT

Getting good performance out of numerical equation solvers requires that the user has provided stable and efficient functions representing their model. However, users should not be trusted to write good code. In this manuscript we describe ModelingToolkit (MTK), a symbolic equation-based modeling system which allows for composable transformations to generate stable, efficient, and parallelized model implementations. MTK blurs the lines of traditional symbolic computing by acting directly on a user's numerical code. We show the ability to apply graph algorithms for automatically parallelizing and performing index reduction on code written for differential-algebraic equation (DAE) solvers, "fixing" the performance and stability of the model without requiring any changes to on the user's part. We demonstrate how composable model transformations can be combined with automated data-driven surrogate generation techniques, allowing machine learning methods to generate accelerated approximate models within an acausal modeling framework. These reduced models are shown to outperform the Dymola Modelica compiler on an HVAC model by 590x at 3\% error. Together, this demonstrates MTK as a system for bringing the latest research in graph transformations directly to modeling applications.

研究动机与目标

  • 解决由于用户编写的微分代数方程(DAE)求解器代码不够优化而导致的性能与稳定性问题。
  • 消除用户手动编写高效、稳定或并行代码的需求,通过自动化代码变换实现。
  • 将符号计算直接集成到高性能编程语言(Julia)中,实现无缝、可组合的模型变换。
  • 在无因果建模框架内实现自动化、数据驱动的代理建模,以加速仿真。
  • 构建一个开放、可扩展的系统,使研究人员能够插入新的符号与基于图的优化转换模块。

提出的方法

  • MTK 使用基于 Julia 的计算机代数系统(CAS)Symbolics.jl,将模型表示为保留 Julia 语义的符号表达式。
  • 应用图算法(如强连通分量(SCC)分析)检测可并行化的方程组,实现自动并行化。
  • 使用类似 Pantelides 的算法对 DAE 进行符号指标约化,将高指标 DAE 自动转换为指标-1 形式,无需用户干预。
  • 应用非线性撕裂与奇异性消除技术以解耦系统,提升求解器收敛性。
  • 通过 `surrogatize` 函数自动生成基于机器学习的代理模型,用快速近似等价物替换复杂子模型。
  • 变换操作具有可组合性:多个转换流程(如指标约化、并行化、代理生成)可顺序应用于同一模型。

实验结果

研究问题

  • RQ1是否可以将符号图变换直接应用于用户编写的数值代码,以在不修改代码的前提下提升求解器性能与稳定性?
  • RQ2基于图算法的自动指标约化在稳定与加速 DAE 求解器方面的效果如何?
  • RQ3在方程模型中,利用 SCC 分解实现方程自动并行化的程度如何?
  • RQ4是否可以自动生成并集成数据驱动的代理模型到无因果建模框架中以加速仿真?
  • RQ5MTK 中可组合的变换流水线与商业工具(如 Dymola)相比,在实际性能基准测试中的表现如何?

主要发现

  • MTK 将 HVAC 模型的仿真时间相比 Dymola 缩短了 590 倍,使用机器学习生成的代理模型实现 3% 的误差率。
  • 该系统实现了 5.8 秒的仿真时间,优于 Dymola 的 35.3 秒运行时间。
  • 指标约化被自动应用于用户编写的代码,将高指标 DAE 自动转换为指标-1 形式,无需手动重构。
  • 通过 SCC 检测实现了自动并行化,使独立的方程组可并行求解。
  • `surrogatize` 函数成功地将高保真度子模型替换为快速近似的代理模型,同时保持了模型结构,并支持在更大系统中复用。
  • MTK 实现了从符号分析、结构简化到代理生成的端到端模型优化自动化,所有操作均在一个统一、可组合的框架内完成。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。