在OpenMDAO中缩放功能

发布于 2025-01-18 05:11:36 字数 161 浏览 4 评论 0原文

有没有办法将对数缩放应用于 OpenMDAO 中的设计目标/约束?在我的优化问题中,我必须处理一个目标函数,该函数取很大的值,并且在设计空间上变化很大(阶数 10^6 和 10^7 之间),所以我理想地希望让驱动程序处理以下日志目标。我现在已经直接修改了我的目标函数,但在驱动程序级别进行会更方便。这可能吗?

Is there any way to apply a logarithmic scaling to the design objectives/constraints in OpenMDAO? In my optimization problem, I have to deal with an objective function that takes large values and varies significantly over the design space (between the orders 10^6 and 10^7), so I would ideally like to make the driver handle the log of the objective. I have modified my objective function directly for now, but it would be more convenient to do it at the driver level. Is that possible?

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

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

发布评论

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

评论(2

像你 2025-01-25 05:11:36

目前 openmdao 驱动程序不支持非线性缩放,通过组件来实现是正确的方法。过去,我有时会制作一个单独的“目标”组件,该组件的存在是为了对原始目标进行一些转换。这使您可以在必要时将其放入模型中,而无需更改原始计算。

Currently openmdao drivers don't support nonlinear scaling, and doing so through a component is the correct approach. In the past I've sometimes made a separate "objective" component that exists to apply some transformation to the raw objective. That allows you to drop it into your model when necessary without the need to change the original calculations.

紫竹語嫣☆ 2025-01-25 05:11:36

“修改组件”和“有OpenMDAO驱动程序API为您做到这一点”之间的中间立场是使用 execcomp

prob.model.add_subsystem('log_scale', om.ExecComp('log_f = log(f)')
prob.model.connect('some_comp.f', 'log_scale.f')
prob.driver.add_objective('log_scale.log_f')

执行人员将为您处理该转换的派生词。您要做的就是将目标连接到ExecComp实例上的正确输入中。

A middle ground between "modify the component" and "have OpenMDAO driver api do it for you" is to use an ExecComp.

prob.model.add_subsystem('log_scale', om.ExecComp('log_f = log(f)')
prob.model.connect('some_comp.f', 'log_scale.f')
prob.driver.add_objective('log_scale.log_f')

The exec-comp will handle the derivatives of that transformation for you. All you have to do is connect your objective into the right input on the ExecComp instance.

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