gekko 的 sign3 和 abs3 return 是什么意思?

What do gekko's sign3 and abs3 return?

我有一个变量,我希望根据中间值的符号为 1 或 0。我可以使用 sign2 which returns 1 or -1 based on the sign and do operations to turn it to 0 or 1. 但是,当我探索时,我注意到一个 sign3 和 abs3 其中包含一个二进制变量signum/absolute 值。这些函数 return 是否像 [signum/absolute value, 0/1] 这样的列表?

GEKKO 函数 sign2sign3 return 相同类型的输出,-11 取决于它们变量的符号应用于。它们之间的区别在于符号(sign)操作是如何完成的。两种实现都是连续可微的,因此适用于基于梯度的优化。

sign2 函数使用 MPCC formulation to generate the sign of an argument, and can be used with any of the solvers. The sign3 function uses a binary switching variable and the MINLP solver APOPT