如何分析/优化模拟工具?

发布于 2024-07-08 21:52:05 字数 612 浏览 11 评论 0原文

过去,现在断断续续地,我使用过诸如 简单的 Java 模拟NetLogo

它们是对各种数学/计算机科学概念进行可视化建模的绝佳工具,因为“您所要做的就是编写模拟循环 - 图形等都会为您处理。”

然而,我注意到的一件事是,使用此类工具提高执行时间/建模速度非常困难,因为实现的核心隐藏在表面之下。

一般来说,有关于如何使用模拟器工具的很好的文档,但我还没有找到任何关于提高执行时间的内容。

例如,假设您正在实施牛顿法来求根。 这是一种简单的算法,但根据

  • 您使用的图形附件的类型或
  • 选择的各种其他杂项选项,

模拟将以不同的速度运行。

有没有办法确定模拟数据的“最佳”显示?

我在使用这样的工具来教授有关建模/科学编程的课程时想到了这一点。

In the past, and intermittently now, I've used simulation tools like Easy Java Simulations and NetLogo.

They are great tools for visually modeling various mathematical/comp-sci concepts because "all you have to do" is write the simulation loop - the graphics, etc are handled for you.

However, one thing I have noticed is that improving execution time / modeling speed is extremely difficult using such tools, because the guts of the implementation are hidden under the surface.

There is, generally-speaking, great documentation on how to use the simulator tools, but I haven't found anything on improving execution time.

For example, say you're implementing Newton's Method for root finding. It's a straight-forward algorithm, but depending on

  • the type of graphic attachment you use, or
  • various other miscellaneous options chosen

the simulation will run at different speeds.

Is there a way to determine an "optimal" display of the simulation's data?

I'm thinking of this in the case of using such a tool to teach classes about modeling/scientific programming.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

遗弃M 2024-07-15 21:52:05

您可以尝试使用Repast Symphony代理模拟工具包。
它是一个成熟、免费、开源的编程环境,具有许多有用的功能。
您可以将 Repast 与 Eclipse 集成,Eclipse 具有 分析器插件

You may try to use the Repast Symphony agent simulation toolkit.
It is a mature, free, open source programming environment with lots of useful features.
You can integrate Repast with Eclipse what has a profiler plugin.

眼波传意 2024-07-15 21:52:05

通过 Netlogo,您可以使用探查器扩展

    extensions [profiler]

请参阅netlogo 主页上的探查器文档

With Netlogo, you can use the Profiler extension

    extensions [profiler]

See profiler documentation on the netlogo home page

国粹 2024-07-15 21:52:05

如果所有其他方法都失败,您可以结合使用这两种方法:

  • 再次猜测环境:问问自己将如何实现其功能,然后推断出哪个功能可能需要最少的计算工作。
  • 试错:只需通过测试来比较不同的方法。 如果环境有一些对代码进行计时的工具,例如(准确地)告诉您现在时间的函数,那么这将是一个很大的帮助。

不要忘记内存缓存和优化等效果。 如果您尝试在特定环境中使用特定功能,它的运行可能会与您之前的体验有所不同。

If all else fails, you can use a combination of these two approaches:

  • Second-guess the environment: ask yourself how YOU would implement its features, and then deduce which feature is probably going to require the least computational work.
  • Trial-and-error: just compare different methods by testing them out. It's a big help if the environment has some facility for timing your code, such as a function that (accurately) tells you what the time is now.

Don't forget about effects such as memory caching and optimisations. If you try to use a particular feature in a certain context it may run differently to your previous experience.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文