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
(objectives, 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
(objectives, 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
(objectives, 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
(objectives, 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
(expr)¶ 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
This file is part of CVXPY.
CVXPY is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
CVXPY is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with CVXPY. If not, see <http://www.gnu.org/licenses/>.