Transforms¶
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.
Scalarize¶
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 Paretooptimal 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.

scalarize.
weighted_sum
(weights)¶ Combines objectives as a weighted sum.
 Parameters
objectives – A list of Minimize/Maximize objectives.
weights – A vector of weights.
 Returns
A Minimize/Maximize objective.

scalarize.
max
(weights)¶ Combines objectives as max of weighted terms.
 Parameters
objectives – A list of Minimize/Maximize objectives.
weights – A vector of weights.
 Returns
A Minimize objective.

scalarize.
log_sum_exp
(weights, gamma=1)¶ Combines objectives as log_sum_exp of weighted terms.
 The objective takes the form
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.
 Parameters
objectives – A list of Minimize/Maximize objectives.
weights – A vector of weights.
gamma – Parameter interpolating between weighted_sum and max.
 Returns
A Minimize objective.

scalarize.
targets_and_priorities
(priorities, targets, limits=None, off_target=1e05)¶ Combines objectives with penalties within a range between target and limit.
Each Minimize objective i has value
priorities[i]*objectives[i] when objectives[i] >= targets[i]
+infinity when objectives[i] > limits[i]
Each Maximize objective i has value
priorities[i]*objectives[i] when objectives[i] <= targets[i]
+infinity when objectives[i] < limits[i]
 Parameters
objectives – A list of Minimize/Maximize objectives.
priorities – The weight within the trange.
targets – The start (end) of penalty for Minimize (Maximize)
limits – The hard end (start) of penalty for Minimize (Maximize)
off_target – Penalty outside of target.
 Returns
A Minimize/Maximize objective.
Other¶
Here we list other available transforms.

class
cvxpy.transforms.
indicator
(constraints, err_tol=0.001)[source]¶  An expression representing the convex function I(constraints) = 0
if constraints hold, +infty otherwise.
 Parameters
constraints (
list
) – A list of constraint objects.err_tol – A numeric tolerance for determining whether the constraints hold.

transforms.
linearize
()¶ Returns an affine approximation to the expression computed at the variable/parameter values.
Gives an elementwise lower (upper) bound for convex (concave) expressions that is tight at the current variable/parameter values. No guarantees for nonDCP expressions.
If f and g are convex, the objective f  g can be (heuristically) minimized using the implementation below of the convexconcave method:
for iters in range(N): Problem(Minimize(f  linearize(g))).solve()
Returns None if cannot be linearized.
 Parameters
expr – An expression.
 Returns
An affine expression or None.

transforms.
partial_optimize
()¶ Copyright 2013 Steven Diamond
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.