网页
综合
更新时间 2026-11-14 17:02:24
Transforms -
自动蜘蛛
www.cvxpy.org
正文约 4038 字
⏱️ Help us benchmark CVXPY solvers! Contribute problems and results to the Solver Benchmarks project. Read our new paper on the CVXPY internals!
Transforms provide additional ways of manipulating CVXPY objects beyond the atomic functions. While atomic functions operate only on expressions, transforms may also take Problem, Objective, or Constraint objects as input. Transforms do not need to conform to any specific API.
The SuppFunc transform accepts an implicit representation of a convex set in terms of some CVXPY Variable and returns a function handle representing the convex set’s support function. When the function handle is evaluated it returns a SuppFuncAtom object. Such objects can be used like any other CVXPY Expression for purposes of convex optimization modeling.
Given a list of CVXPY Constraint objects \(\texttt{constraints}\) involving a real CVXPY Variable \(\texttt{x}\), consider the convex set
This object represents the support function of \(S\). This is the convex function
The support function is a fundamental object in convex analysis. It’s extremely useful for expressing dual problems using Fenchel duality.
This variable cannot have any attributes, such as PSD=True, nonneg=True, symmetric=True, etc…
Usually, these are constraints over \(\texttt{x}\), and some number of auxiliary CVXPY Variables. It is valid to supply \(\texttt{constraints = []}\).
If \(\texttt{h = cp.SuppFunc(x, constraints)}\), then you can use \(\texttt{h}\) just like any other scalar-valued atom in CVXPY. For example, if \(\texttt{x}\) was a CVXPY Variable with \(\texttt{x.ndim == 1}\), you could do the following:
You are allowed to use CVXPY Variables other than \(\texttt{x}\) to define \(\texttt{constraints}\), but the set \(S\) only consists of objects (vectors or matrices) with the same shape as \(\texttt{x}\).
It’s possible for the support function to take the value \(+\infty\) for a fixed vector \(\texttt{y}\). This is an important point, and it’s one reason why support functions are actually formally defined with the supremum “\(\sup\)” rather than the maximum “\(\max\)”. For more information on support functions, check out this Wikipedia page.
Return an atom representing
max{ cvxpy.vec(y) @ cvxpy.vec(x) : x in S }
where S is the convex set associated with this SuppFunc object.
The scalarize transforms convert a list of objectives into a single objective, for example a weighted sum. All scalarizations are monotone in each objective, which means that optimizing over the scalarized objective always returns a Pareto-optimal point with respect to the original list of objectives. Moreover, all points on the Pareto curve except for boundary points can be attained given some weighting of the objectives.
Combines objectives as a weighted sum.
A list of Minimize/Maximize objectives.
A vector of weights.
A Minimize/Maximize objective.
Combines objectives as max of weighted terms.
A list of Minimize/Maximize objectives.
A vector of weights.
A Minimize objective.
Combines objectives as log_sum_exp of weighted terms.
log(sum_{i=1}^n exp(gamma*weights[i]*objectives[i]))/gamma
As gamma goes to 0, log_sum_exp approaches weighted_sum. As gamma goes to infinity, log_sum_exp approaches max.
A list of Minimize/Maximize objectives.
A vector of weights.
Parameter interpolating between weighted_sum and max.
A Minimize objective.
Combines objectives with penalties within a range between target and limit.
For nonnegative priorities, each Minimize objective i has value
off_target*objectives[i] when objectives[i] < targets[i]
(priorities[i]-off_target)*objectives[i] when targets[i] <= objectives[i] <= limits[i]
+infinity when objectives[i] > limits[i]
and each Maximize objective i has value
off_target*objectives[i] when objectives[i] > targets[i]
(priorities[i]-off_target)*objectives[i] when targets[i] >= objectives[i] >= limits[i]
-infinity when objectives[i] < limits[i]
A negative priority flips the objective sense, i.e., we use -objectives[i], -targets[i], and -limits[i] with abs(priorities[i]).
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。