Mathematica 的“禁用动态”功能 对话框杀死了Java
我将 Mathematica 与 JLink 一起用于一个研究项目,该项目涉及大量计算。 Mathematica 用作输入参数并随后绘制结果的图形前端。 实际的算法位于 Java 类中,通过 JLink 调用。
“链接”是一个名为 evalFrontend 的实例。 按下按钮后,会执行类似以下的操作:
RunEvaluation[] := (
success = False;
results = evalFrontend@run[];
eval = evalFrontend@getEvaluation[];
success = eval@success[];
Return[results];
)
如果计算需要超过 10 秒,则会显示一个对话框:
动态中止:内核不响应动态评估。 您可以选择中止并重新启动内核或继续等待。 [..]
显示此信息时,Java 仍在运行。 然而,过了一段时间,会显示另一个对话框:
禁用动态:一个或多个动态对象需要很长时间才能完成评估。 您可以禁用进一步的动态评估或继续等待[...]
当出现此信息时,Java 进程将终止。
我怎样才能防止这种情况发生? 任何提示将不胜感激。
I use Mathematica with JLink for a research project, which involves a lot of computation. Mathematica is used as a graphical frontend for entering the parameters, and later plotting the results. The actual algorithms are located in Java Classes, which are called via JLink.
The "link" is an instance named evalFrontend. On the press of a button, something like this is executed:
RunEvaluation[] := (
success = False;
results = evalFrontend@run[];
eval = evalFrontend@getEvaluation[];
success = eval@success[];
Return[results];
)
If the computation needs more than 10 seconds, a dialog is displayed:
Abort Dynamic: The kernel is not responding to a dynamic evaluation. You can either choose to abort and restart the kernel or continue waiting. [..]
While this is displayed, Java is still running. However, after some more time, another dialog is displayed:
Disable Dynamic: On or more dynamic objects are taking excessively long to finish evaluating. You may eitehr disable further dynamic evaluations or continue waiting[...]
When this appears, the Java process is terminated.
How can I prevent this from happening? Any hints would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用 同步更新 -> 错误。
另请参阅此链接。
Try using Synchronous Updating -> False.
See also this link.
如果您的 UI 让您单击按钮开始计算,请使用 Method ->; 按钮的“排队”选项:“
禁用动态”对话框永远不会弹出,并且动态更新仍然会发生,因此您可以监视计算进度。
If your UI has you click a button to start the computation, use Method -> "Queued" option to Button:
The Disable Dynamic dialog will never pop up, and Dynamic updates will still occur, so you can monitor progress of the computation.