简体   繁体   English

在 Python 中使用 Gekko,对于多目标优化问题,是否所有目标函数都必须具有相同的单位?

[英]Using Gekko in Python, for a multi-objective optimization problem, do all objective functions have to be of the same unit?

As per Gekko documentation, multiple objective functions are summed and an overall objective value is solved for.根据 Gekko 文档,对多个目标函数求和,并求解一个总体目标值。 Does this mean that all objective functions have to have the same dimension or unit (m3 or USD or kg)?这是否意味着所有目标函数都必须具有相同的尺寸或单位(m3 或 USD 或 kg)? If so, is there a way to have multiple objectives with differing units?如果是这样,有没有办法让不同单位的多个目标? Also, side question, is there an easy extract the optimal objective value for each objective function (aside from the overall objective value given by the solver)?另外,附带问题,是否可以轻松提取每个目标 function 的最佳目标值(除了求解器给出的总体目标值)?

Gekko adds the objective functions together into a single objective statement. Gekko 将目标函数一起添加到单个目标语句中。 Gekko doesn't track units so something like Maximize(flow1) in kg/hr and Maximize(flow2) in gm/hr are not scaled by Gekko. Gekko 不跟踪单位,因此像Maximize(flow1) in kg/hrMaximize(flow2) in gm/hr这样的单位不会被 Gekko 缩放。 Here is a simple example problem that shows how a multi-objective function statement can be solved:这是一个简单的示例问题,显示了如何解决多目标 function 语句:

from gekko import GEKKO
m = GEKKO(remote=False)
x = m.Var()
obj1 = m.Intermediate((x-3)**2)
obj2 = m.Intermediate((x-2)**2)
m.Minimize(obj1)
m.Minimize(obj2)
m.solve(disp=False)
print('Obj Total: ',m.options.OBJFCNVAL)
print('Obj1: ',obj1.value[0])
print('Obj2: ',obj2.value[0])
print('x: ',x.value[0])

The solution is x=2.5 , as expected:正如预期的那样,解决方案是x=2.5

Obj Total:  0.5
Obj1:  0.25
Obj2:  0.25
x:  2.5

The two objectives are added together to create the overall objective.将这两个目标加在一起以创建总体目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM