cvxpy.reductions.dcp2cone package¶
Please see our disclaimer about the Reductions API before using these directly in your code.
Subpackages¶
Submodules¶
cvxpy.reductions.dcp2cone.cone_matrix_stuffing module¶
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.
- class cvxpy.reductions.dcp2cone.cone_matrix_stuffing.ConeDims(constr_map)[source]¶
Bases:
object
Summary of cone dimensions present in constraints.
Constraints must be formatted as dictionary that maps from constraint type to a list of constraints of that type.
- psd¶
A list of the positive semidefinite cone dimensions, where the dimension of the PSD cone of k by k matrices is k.
- Type:¶
list of int
-
EQ_DIM =
'f'
¶
-
EXP_DIM =
'ep'
¶
-
LEQ_DIM =
'l'
¶
-
P3D_DIM =
'p3'
¶
-
PSD_DIM =
's'
¶
-
SOC_DIM =
'q'
¶
-
class cvxpy.reductions.dcp2cone.cone_matrix_stuffing.ConeMatrixStuffing(quad_obj: bool =
False
, canon_backend: str | None =None
)[source]¶ Bases:
MatrixStuffing
Construct matrices for linear cone problems.
Linear cone problems are assumed to have a linear objective and cone constraints which may have zero or more arguments, all of which must be affine.
-
CONSTRAINTS =
'ordered_constraints'
¶
- apply(problem)[source]¶
Returns a stuffed problem.
The returned problem is a minimization problem in which every constraint in the problem has affine arguments that are expressed in the form A @ x + b.
- invert(solution, inverse_data)[source]¶
Retrieves a solution to the original problem
-
CONSTRAINTS =
-
class cvxpy.reductions.dcp2cone.cone_matrix_stuffing.ParamConeProg(c, x, A, variables, var_id_to_col, constraints, parameters, param_id_to_col, P=
None
, formatted: bool =False
, lower_bounds: ndarray | None =None
, upper_bounds: ndarray | None =None
)[source]¶ Bases:
ParamProb
Represents a parameterized cone program
minimize c’x + d + [(1/2)x’Px] subject to cone_constr1(A_1*x + b_1, …)
… cone_constrK(A_i*x + b_i, …)
The constant offsets d and b are the last column of c and A.
-
apply_param_jac(delc, delA, delb, active_params=
None
)[source]¶ Multiplies by Jacobian of parameter mapping.
Assumes delA is sparse.
- Returns:¶
A dictionary param.id -> dparam
-
apply_parameters(id_to_param_value=
None
, zero_offset: bool =False
, keep_zeros: bool =False
, quad_obj: bool =False
)[source]¶ Returns A, b after applying parameters (and reshaping).
- Parameters:¶
- id_to_param_value=
None
¶ (optional) dict mapping parameter ids to values.
- zero_offset: bool =
False
¶ (optional) if True, zero out the constant offset in the parameter vector.
- keep_zeros: bool =
False
¶ (optional) if True, store explicit zeros in A where parameters are affected.
- quad_obj: bool =
False
¶ (optional) if True, include quadratic objective term.
- id_to_param_value=
-
split_solution(sltn, active_vars=
None
)[source]¶ Splits the solution into individual variables.
-
apply_param_jac(delc, delA, delb, active_params=
cvxpy.reductions.dcp2cone.dcp2cone module¶
Copyright 2013 Steven Diamond, 2017 Akshay Agrawal, 2017 Robin Verschueren
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.
-
class cvxpy.reductions.dcp2cone.dcp2cone.Dcp2Cone(problem=
None
, quad_obj: bool =False
)[source]¶ Bases:
Canonicalization
Reduce DCP problems to a conic form.
This reduction takes as input (minimization) DCP problems and converts them into problems with affine or quadratic objectives and conic constraints whose arguments are affine.
- canonicalize_expr(expr, args, affine_above: bool) tuple[Expression, list] [source]¶
Canonicalize an expression, w.r.t. canonicalized arguments.
- canonicalize_tree(expr, affine_above: bool) tuple[Expression, list] [source]¶
Recursively canonicalize an Expression.
Module contents¶
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.