pydrake.solvers.mathematicalprogram¶
Bindings for MathematicalProgram
If you are formulating constraints using symbolic formulas, please review the
top-level documentation for pydrake.math
.
-
class
pydrake.solvers.mathematicalprogram.
Binding_BoundingBoxConstraint
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_BoundingBoxConstraint) → pydrake.solvers.mathematicalprogram.BoundingBoxConstraint¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_BoundingBoxConstraint) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Binding_Constraint
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_Constraint) → pydrake.solvers.mathematicalprogram.Constraint¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_Constraint) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Binding_Cost
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_Cost) → pydrake.solvers.mathematicalprogram.Cost¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_Cost) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Binding_EvaluatorBase
¶ -
__init__
(self: pydrake.solvers.mathematicalprogram.Binding_EvaluatorBase, arg0: object) → None¶
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_EvaluatorBase) → pydrake.solvers.mathematicalprogram.EvaluatorBase¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_EvaluatorBase) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Binding_ExponentialConeConstraint
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_ExponentialConeConstraint) → pydrake.solvers.mathematicalprogram.ExponentialConeConstraint¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_ExponentialConeConstraint) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Binding_LinearComplementarityConstraint
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_LinearComplementarityConstraint) → pydrake.solvers.mathematicalprogram.LinearComplementarityConstraint¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_LinearComplementarityConstraint) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Binding_LinearConstraint
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_LinearConstraint) → pydrake.solvers.mathematicalprogram.LinearConstraint¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_LinearConstraint) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Binding_LinearCost
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_LinearCost) → pydrake.solvers.mathematicalprogram.LinearCost¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_LinearCost) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Binding_LinearEqualityConstraint
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_LinearEqualityConstraint) → pydrake.solvers.mathematicalprogram.LinearEqualityConstraint¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_LinearEqualityConstraint) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Binding_LorentzConeConstraint
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_LorentzConeConstraint) → pydrake.solvers.mathematicalprogram.LorentzConeConstraint¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_LorentzConeConstraint) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Binding_PositiveSemidefiniteConstraint
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_PositiveSemidefiniteConstraint) → pydrake.solvers.mathematicalprogram.PositiveSemidefiniteConstraint¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_PositiveSemidefiniteConstraint) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Binding_QuadraticCost
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_QuadraticCost) → pydrake.solvers.mathematicalprogram.QuadraticCost¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_QuadraticCost) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Binding_VisualizationCallback
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
evaluator
(self: pydrake.solvers.mathematicalprogram.Binding_VisualizationCallback) → pydrake.solvers.mathematicalprogram.VisualizationCallback¶
-
variables
(self: pydrake.solvers.mathematicalprogram.Binding_VisualizationCallback) → numpy.ndarray[object[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
BoundingBoxConstraint
¶ Bases:
pydrake.solvers.mathematicalprogram.LinearConstraint
Implements a constraint of the form \(lb <= x <= ub\)
Note: the base Constraint class (as implemented at the moment) could play this role. But this class enforces that it is ONLY a bounding box constraint, and not something more general. Some solvers use this information to handle bounding box constraints differently than general constraints, so use of this form is encouraged.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
-
pydrake.solvers.mathematicalprogram.
ChooseBestSolver
(prog: pydrake.solvers.mathematicalprogram.MathematicalProgram) → pydrake.solvers.mathematicalprogram.SolverId¶ Choose the best solver given the formulation in the optimization program and the availability of the solvers.
Raises: invalid_argument if there is no available solver for prog
.
-
class
pydrake.solvers.mathematicalprogram.
Constraint
¶ Bases:
pydrake.solvers.mathematicalprogram.EvaluatorBase
A constraint is a function + lower and upper bounds.
Solver interfaces must acknowledge that these constraints are mutable. Parameters can change after the constraint is constructed and before the call to Solve().
It should support evaluating the constraint, and adding it to an optimization problem.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
CheckSatisfied
(*args, **kwargs)¶ Overloaded function.
- CheckSatisfied(self: pydrake.solvers.mathematicalprogram.Constraint, x: numpy.ndarray[numpy.float64[m, 1]], tol: float = 1e-06) -> bool
Return whether this constraint is satisfied by the given value,
x
.- Parameter
x
: - A
num_vars
x 1 vector. - Parameter
tol
: - A tolerance for bound checking.
- CheckSatisfied(self: pydrake.solvers.mathematicalprogram.Constraint, x: numpy.ndarray[object[m, 1]], tol: float = 1e-06) -> bool
Return whether this constraint is satisfied by the given value,
x
.- Parameter
x
: - A
num_vars
x 1 vector. - Parameter
tol
: - A tolerance for bound checking.
- CheckSatisfied(self: pydrake.solvers.mathematicalprogram.Constraint, x: numpy.ndarray[object[m, 1]]) -> pydrake.symbolic.Formula
Return whether this constraint is satisfied by the given value,
x
.- Parameter
x
: - A
num_vars
x 1 vector. - Parameter
tol
: - A tolerance for bound checking.
-
lower_bound
(self: pydrake.solvers.mathematicalprogram.Constraint) → numpy.ndarray[numpy.float64[m, 1]]¶
-
num_constraints
(self: pydrake.solvers.mathematicalprogram.Constraint) → int¶ Number of rows in the output constraint.
-
upper_bound
(self: pydrake.solvers.mathematicalprogram.Constraint) → numpy.ndarray[numpy.float64[m, 1]]¶
-
-
class
pydrake.solvers.mathematicalprogram.
Cost
¶ Bases:
pydrake.solvers.mathematicalprogram.EvaluatorBase
Provides an abstract base for all costs.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
pydrake.solvers.mathematicalprogram.
EvaluatorBase
¶ -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
Eval
(*args, **kwargs)¶ Overloaded function.
- Eval(self: pydrake.solvers.mathematicalprogram.EvaluatorBase, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]
Evaluates the expression.
- Parameter
x
: - A
num_vars
x 1 input vector. - Parameter
y
: - A
num_outputs
x 1 output vector.
- Eval(self: pydrake.solvers.mathematicalprogram.EvaluatorBase, x: numpy.ndarray[object[m, 1]]) -> numpy.ndarray[object[m, 1]]
Evaluates the expression.
- Parameter
x
: - A
num_vars
x 1 input vector. - Parameter
y
: - A
num_outputs
x 1 output vector.
- Eval(self: pydrake.solvers.mathematicalprogram.EvaluatorBase, x: numpy.ndarray[object[m, 1]]) -> numpy.ndarray[object[m, 1]]
Evaluates the expression.
- Parameter
x
: - A
num_vars
x 1 input vector. - Parameter
y
: - A
num_outputs
x 1 output vector.
-
get_description
(self: pydrake.solvers.mathematicalprogram.EvaluatorBase) → str¶ Getter for a human-friendly description for the evaluator.
-
gradient_sparsity_pattern
(self: pydrake.solvers.mathematicalprogram.EvaluatorBase) → Optional[List[Tuple[int, int]]]¶ Returns the vector of (row_index, col_index) that contains all the entries in the gradient of Eval function (∂y/∂x) whose value could be non-zero, namely if ∂yᵢ/∂xⱼ could be non-zero, then the pair (i, j) is in gradient_sparsity_pattern.
- Returns
gradient_sparsity_pattern
: - If nullopt, then we regard all entries of the gradient as potentially non-zero.
- Returns
-
num_outputs
(self: pydrake.solvers.mathematicalprogram.EvaluatorBase) → int¶ Getter for the number of outputs, namely the number of rows in y, as used in Eval(x, y).
-
num_vars
(self: pydrake.solvers.mathematicalprogram.EvaluatorBase) → int¶ Getter for the number of variables, namely the number of rows in x, as used in Eval(x, y).
-
set_description
(self: pydrake.solvers.mathematicalprogram.EvaluatorBase, arg0: str) → None¶ Set a human-friendly description for the evaluator.
-
SetGradientSparsityPattern
(self: pydrake.solvers.mathematicalprogram.EvaluatorBase, gradient_sparsity_pattern: List[Tuple[int, int]]) → None¶ Set the sparsity pattern of the gradient matrix ∂y/∂x (the gradient of y value in Eval, w.r.t x in Eval) . gradient_sparsity_pattern contains all the pairs of (row_index, col_index) for which the corresponding entries could have non-zero value in the gradient matrix ∂y/∂x.
-
-
class
pydrake.solvers.mathematicalprogram.
ExponentialConeConstraint
¶ Bases:
pydrake.solvers.mathematicalprogram.Constraint
An exponential cone constraint is a special type of convex cone constraint. We constrain A * x + b to be in the exponential cone, where A has 3 rows, and b is in ℝ³, x is the decision variable. A vector z in ℝ³ is in the exponential cone, if {z₀, z₁, z₂ | z₀ ≥ z₁ * exp(z₂ / z₁), z₁ > 0}. Equivalently, this constraint can be refomulated with logarithm function {z₀, z₁, z₂ | z₂ ≤ z₁ * log(z₀ / z₁), z₀ > 0, z₁ > 0}
The Eval function implemented in this class is z₀ - z₁ * exp(z₂ / z₁) >= 0, z₁ > 0 where z = A * x + b. It is not recommended to solve an exponential cone constraint through generic nonlinear optimization. It is possible that the nonlinear solver can accidentally set z₁ = 0, where the constraint is not well defined. Instead, the user should consider to solve the program through conic solvers that can exploit exponential cone, such as Mosek and SCS.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
-
pydrake.solvers.mathematicalprogram.
GetInfeasibleConstraints
(prog: pydrake.solvers.mathematicalprogram.MathematicalProgram, result: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, tol: Optional[float] = None) → List[str]¶ (Deprecated.)
- Deprecated:
- This function is replaced by MathematicalProgramResult::GetInfeasibleConstraintNames(prog, tolerance); This will be removed from Drake on or after 2020-09-01.
-
class
pydrake.solvers.mathematicalprogram.
LinearComplementarityConstraint
¶ Bases:
pydrake.solvers.mathematicalprogram.Constraint
Implements a constraint of the form:
Mx + q >= 0 x >= 0 x'(Mx + q) == 0
An implied slack variable complements any 0 component of x. To get the slack values at a given solution x, use Eval(x).
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
pydrake.solvers.mathematicalprogram.
LinearConstraint
¶ Bases:
pydrake.solvers.mathematicalprogram.Constraint
Implements a constraint of the form \(lb <= Ax <= ub\)
-
__init__
(self: pydrake.solvers.mathematicalprogram.LinearConstraint, A: numpy.ndarray[numpy.float64[m, n]], lb: numpy.ndarray[numpy.float64[m, 1]], ub: numpy.ndarray[numpy.float64[m, 1]]) → None¶
-
A
(self: pydrake.solvers.mathematicalprogram.LinearConstraint) → numpy.ndarray[numpy.float64[m, n]]¶
-
set_bounds
(self: pydrake.solvers.mathematicalprogram.LinearConstraint, new_lb: numpy.ndarray[numpy.float64[m, 1]], new_ub: numpy.ndarray[numpy.float64[m, 1]]) → None¶ Set the upper and lower bounds of the constraint.
- Parameter
lower_bound
: - . A
num_constraints
x 1 vector. - Parameter
upper_bound
: - . A
num_constraints
x 1 vector.
Note
If the users want to expose this method in a sub-class, do using Constraint::set_bounds, as in LinearConstraint.
- Parameter
-
UpdateCoefficients
(self: pydrake.solvers.mathematicalprogram.LinearConstraint, new_A: numpy.ndarray[numpy.float64[m, n]], new_lb: numpy.ndarray[numpy.float64[m, 1]], new_ub: numpy.ndarray[numpy.float64[m, 1]]) → None¶ Updates the linear term, upper and lower bounds in the linear constraint. The updated constraint is: new_lb <= new_A * x <= new_ub Note that the size of constraints (number of rows) can change, but the number of variables (number of cols) cannot.
- Parameter
new_A
: - new linear term
- Parameter
new_lb
: - new lower bound
- Parameter
new_up
: - new upper bound
- Parameter
-
UpdateLowerBound
(self: pydrake.solvers.mathematicalprogram.LinearConstraint, new_lb: numpy.ndarray[numpy.float64[m, 1]]) → None¶ Updates the lower bound.
Note
if the users want to expose this method in a sub-class, do using Constraint::UpdateLowerBound, as in LinearConstraint.
-
UpdateUpperBound
(self: pydrake.solvers.mathematicalprogram.LinearConstraint, new_ub: numpy.ndarray[numpy.float64[m, 1]]) → None¶ Updates the upper bound.
Note
if the users want to expose this method in a sub-class, do using Constraint::UpdateUpperBound, as in LinearConstraint.
-
-
class
pydrake.solvers.mathematicalprogram.
LinearCost
¶ Bases:
pydrake.solvers.mathematicalprogram.Cost
Implements a cost of the form
\[a'x + b\].
-
__init__
(self: pydrake.solvers.mathematicalprogram.LinearCost, a: numpy.ndarray[numpy.float64[m, 1]], b: float) → None¶ Construct a linear cost of the form
\[a'x + b\].
- Parameter
a
: - Linear term.
- Parameter
b
: - (optional) Constant term.
- Parameter
-
a
(self: pydrake.solvers.mathematicalprogram.LinearCost) → numpy.ndarray[numpy.float64[m, 1]]¶
-
b
(self: pydrake.solvers.mathematicalprogram.LinearCost) → float¶
-
UpdateCoefficients
(self: pydrake.solvers.mathematicalprogram.LinearCost, new_a: numpy.ndarray[numpy.float64[m, 1]], new_b: float = 0) → None¶ Updates the linear term, upper and lower bounds in the linear constraint. The updated constraint is
\[a_new' x + b_new\]. Note that the number of variables (number of cols) cannot change.
- Parameter
new_a
: - New linear term.
- Parameter
new_b
: - (optional) New constant term.
- Parameter
-
-
class
pydrake.solvers.mathematicalprogram.
LinearEqualityConstraint
¶ Bases:
pydrake.solvers.mathematicalprogram.LinearConstraint
Implements a constraint of the form \(Ax = b\)
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
UpdateCoefficients
(self: pydrake.solvers.mathematicalprogram.LinearEqualityConstraint, Aeq: numpy.ndarray[numpy.float64[m, n]], beq: numpy.ndarray[numpy.float64[m, 1]]) → None¶
-
-
class
pydrake.solvers.mathematicalprogram.
LorentzConeConstraint
¶ Bases:
pydrake.solvers.mathematicalprogram.Constraint
Constraining the linear expression \(z=Ax+b\) lies within the Lorentz cone.  Ideally this constraint should be handled by a second-order cone solver. In case the user wants to enforce this constraint through general nonlinear optimization, we provide three different formulations on the Lorentz cone constraint 1. g(z) = z₀ - sqrt(z₁² + … + zₙ₋₁²) ≥ 0 This formulation is not differentiable at z₁=…=zₙ₋₁=0 2. g(z) = z₀ - sqrt(z₁² + … + zₙ₋₁²) ≥ 0 but the gradient of g(z) is approximated as ∂g(z)/∂z = [1, -z₁/sqrt(z₁² + … zₙ₋₁² + ε), …, -zₙ₋₁/sqrt(z₁²+…+zₙ₋₁²+ε)] where ε is a small positive number. 3. z₀²-(z₁²+…+zₙ₋₁²) ≥ 0 z₀ ≥ 0 This constraint is differentiable everywhere, but z₀²-(z₁²+…+zₙ₋₁²) ≥ 0 is non-convex. The default is to use the first formulation. For more information and visualization, please refer to https://inst.eecs.berkeley.edu/~ee127a/book/login/l_socp_soc.html
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
A
(self: pydrake.solvers.mathematicalprogram.LorentzConeConstraint) → scipy.sparse.csc_matrix[numpy.float64]¶ Getter for A.
-
-
pydrake.solvers.mathematicalprogram.
MakeSolver
(id: pydrake.solvers.mathematicalprogram.SolverId) → pydrake.solvers.mathematicalprogram.SolverInterface¶ Given the solver ID, create the solver with the matching ID.
Raises: invalid_argument if there is no matching solver.
-
class
pydrake.solvers.mathematicalprogram.
MathematicalProgram
¶ MathematicalProgram stores the decision variables, the constraints and costs of an optimization problem. The user can solve the problem by calling solvers::Solve() function, and obtain the results of the optimization.
-
__init__
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → None¶
-
AddBoundingBoxConstraint
(*args, **kwargs)¶ Overloaded function.
- AddBoundingBoxConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: numpy.ndarray[numpy.float64[m, 1]], arg1: numpy.ndarray[numpy.float64[m, 1]], arg2: numpy.ndarray[object[m, 1]]) -> drake::solvers::Binding<drake::solvers::BoundingBoxConstraint>
Adds bounding box constraints referencing potentially a subset of the decision variables.
- Parameter
lb
: - The lower bound.
- Parameter
ub
: - The upper bound.
- Parameter
vars
: - Will imposes constraint lb(i) <= vars(i) <= ub(i).
Returns: The newly constructed BoundingBoxConstraint. - AddBoundingBoxConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: float, arg1: float, arg2: pydrake.symbolic.Variable) -> drake::solvers::Binding<drake::solvers::BoundingBoxConstraint>
Adds bounds for a single variable.
- Parameter
lb
: - Lower bound.
- Parameter
ub
: - Upper bound.
- Parameter
var
: - The decision variable.
- AddBoundingBoxConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: float, arg1: float, arg2: numpy.ndarray[object[m, n], flags.f_contiguous]) -> drake::solvers::Binding<drake::solvers::BoundingBoxConstraint>
Adds the same scalar lower and upper bound to every variable in
vars
.- Template parameter
Derived
: - An Eigen::Matrix with Variable as the scalar type. The matrix has unknown number of columns at compile time, or has more than one column.
- Parameter
lb
: - Lower bound.
- Parameter
ub
: - Upper bound.
- Parameter
vars
: - The decision variables.
-
AddConstraint
(*args, **kwargs)¶ Overloaded function.
- AddConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, func: function, lb: numpy.ndarray[numpy.float64[m, 1]], ub: numpy.ndarray[numpy.float64[m, 1]], vars: numpy.ndarray[object[m, 1]], description: str = ‘’) -> drake::solvers::Binding<drake::solvers::Constraint>
Adds a constraint using a Python function.
- AddConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.symbolic.Expression, arg1: float, arg2: float) -> drake::solvers::Binding<drake::solvers::Constraint>
Adds one row of constraint lb <= e <= ub where
e
is a symbolic expression.Raises: - RuntimeError if 1.
lb <= e <= ub
is a trivial constraint such - as 1 <= 2 <= 3. 2.
lb <= e <= ub
is unsatisfiable such as 1 <= - -5 <= 3
- Parameter
e
: - A symbolic expression of the the decision variables.
- Parameter
lb
: - A scalar, the lower bound.
- Parameter
ub
: - A scalar, the upper bound.
The resulting constraint may be a BoundingBoxConstraint, LinearConstraint, LinearEqualityConstraint, or ExpressionConstraint, depending on the arguments. Constraints of the form x == 1 (which could be created as a BoundingBoxConstraint or LinearEqualityConstraint) will be constructed as a LinearEqualityConstraint.
- AddConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.symbolic.Formula) -> drake::solvers::Binding<drake::solvers::Constraint>
Add a constraint represented by a symbolic formula to the program. The input formula
f
can be of the following forms:- e1 <= e2
- e1 >= e2
- e1 == e2
- A conjunction of relational formulas where each conjunct is a relational formula matched by 1, 2, or 3.
Note that first two cases might return an object of Binding<BoundingBoxConstraint>, Binding<LinearConstraint>, or Binding<ExpressionConstraint>, depending on
f
. Also the third case might return an object of Binding<LinearEqualityConstraint> or Binding<ExpressionConstraint>.It throws an exception if 1.
f
is not matched with one of the above patterns. Especially, strict inequalities (<, >) are not allowed. 2.f
is either a trivial constraint such as “1 <= 2” or an unsatisfiable constraint such as “2 <= 1”. 3. It is not possible to find numerical bounds ofe1
ande2
wheref
= e1 ≃ e2. We allowe1
ande2
to be infinite but only if there are no other terms. For example,x <= ∞
is allowed. However,x - ∞ <= 0
is not allowed becausex ↦ ∞
introducesnan
in the evaluation.- AddConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, constraint: drake::solvers::Constraint, vars: numpy.ndarray[object[m, 1]]) -> drake::solvers::Binding<drake::solvers::Constraint>
Adds a generic constraint to the program. This should only be used if a more specific type of constraint is not available, as it may require the use of a significantly more expensive solver.
- AddConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, formulas: numpy.ndarray[object[m, n], flags.f_contiguous]) -> drake::solvers::Binding<drake::solvers::Constraint>
Add a constraint represented by an Eigen::Matrix<symbolic::Formula> to the program.
A formula in
formulas
can be of the following forms:- e1 <= e2
- e1 >= e2
- e1 == e2
It throws an exception if AddConstraint(const symbolic::Formula& f) throws an exception for any f ∈ formulas.
- Template parameter
Derived
: - An Eigen Matrix type of Formula.
-
AddCost
(*args, **kwargs)¶ Overloaded function.
- AddCost(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, func: function, vars: numpy.ndarray[object[m, 1]], description: str = ‘’) -> drake::solvers::Binding<drake::solvers::Cost>
Adds a cost function
- AddCost(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.symbolic.Expression) -> drake::solvers::Binding<drake::solvers::Cost>
Adds a cost expression
-
AddDecisionVariables
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, decision_variables: numpy.ndarray[object[m, 1]]) → None¶ Appends new variables to the end of the existing variables.
- Parameter
decision_variables
: - The newly added decision_variables.
- Precondition:
decision_variables
should not intersect with the existing variables or indeterminates in the optimization program.- Precondition:
- Each entry in
decision_variables
should not be a dummy variable.
Raises: RuntimeError if the preconditions are not satisfied. - Parameter
-
AddEqualityConstraintBetweenPolynomials
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, p1: pydrake.symbolic.Polynomial, p2: pydrake.symbolic.Polynomial) → None¶ Constraining that two polynomials are the same (i.e., they have the same coefficients for each monomial). This function is often used in sum-of-squares optimization. We will impose the linear equality constraint that the coefficient of a monomial in
p1
is the same as the coefficient of the same monomial inp2
.- Parameter
p1
: - Note that p1’s indeterminates should have been registered as indeterminates in this MathematicalProgram object, and p1’s coefficients are affine functions of decision variables in this MathematicalProgram object.
- Parameter
p2
: - Note that p2’s indeterminates should have been registered as indeterminates in this MathematicalProgram object, and p2’s coefficients are affine functions of decision variables in this MathematicalProgram object.
Note
It calls
Reparse
to enforcep1
andp2
to have this MathematicalProgram’s indeterminates.- Parameter
-
AddExponentialConeConstraint
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: numpy.ndarray[object[3, 1]]) → drake::solvers::Binding<drake::solvers::ExponentialConeConstraint>¶ Add the constraint that z is in the exponential cone.
- Parameter
z
: - The expression in the exponential cone.
- Precondition:
- each entry in
z
is a linear expression of the decision variables.
- Parameter
-
AddIndeterminates
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, new_indeterminates: numpy.ndarray[object[m, 1]]) → None¶ Adds indeterminates. This method appends some indeterminates to the end of the program’s old indeterminates.
- Parameter
new_indeterminates
: - The indeterminates to be appended to the program’s old indeterminates.
- Precondition:
new_indeterminates
should not intersect with the program’s old indeterminates or decision variables.- Precondition:
- Each entry in new_indeterminates should not be dummy.
- Precondition:
- Each entry in new_indeterminates should be of CONTINUOUS type.
- Parameter
-
AddL2NormCost
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, A: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], b: numpy.ndarray[numpy.float64[m, 1]], vars: numpy.ndarray[object[m, 1]]) → drake::solvers::Binding<drake::solvers::QuadraticCost>¶ Adds a cost term of the form | Ax - b |^2.
-
AddLinearComplementarityConstraint
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], arg1: numpy.ndarray[numpy.float64[m, 1]], arg2: numpy.ndarray[object[m, 1]]) → drake::solvers::Binding<drake::solvers::LinearComplementarityConstraint>¶ Adds a linear complementarity constraints referencing a subset of the decision variables.
-
AddLinearConstraint
(*args, **kwargs)¶ Overloaded function.
- AddLinearConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, A: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], lb: numpy.ndarray[numpy.float64[m, 1]], ub: numpy.ndarray[numpy.float64[m, 1]], vars: numpy.ndarray[object[m, 1]]) -> drake::solvers::Binding<drake::solvers::LinearConstraint>
Adds linear constraints referencing potentially a subset of the decision variables (defined in the vars parameter).
- AddLinearConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, e: pydrake.symbolic.Expression, lb: float, ub: float) -> drake::solvers::Binding<drake::solvers::LinearConstraint>
Adds one row of linear constraint lb <= e <= ub where
e
is a symbolic expression.Raises: - Parameter
e
: - A linear symbolic expression in the form of
c0 + c1 * v1 + ... + cn * vn
wherec_i
is a constant and @v_i is a variable. - Parameter
lb
: - A scalar, the lower bound.
- Parameter
ub
: - A scalar, the upper bound.
- AddLinearConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, v: numpy.ndarray[object[m, 1]], lb: numpy.ndarray[numpy.float64[m, 1]], ub: numpy.ndarray[numpy.float64[m, 1]]) -> drake::solvers::Binding<drake::solvers::LinearConstraint>
Adds linear constraints represented by symbolic expressions to the program. It throws if @v includes a non-linear expression or
lb <= v <= ub
includes trivial/unsatisfiable constraints.- AddLinearConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, f: pydrake.symbolic.Formula) -> drake::solvers::Binding<drake::solvers::LinearConstraint>
Add a linear constraint represented by a symbolic formula to the program. The input formula
f
can be of the following forms:- e1 <= e2
- e1 >= e2
- e1 == e2
- A conjunction of relational formulas where each conjunct is a relational formula matched by 1, 2, or 3.
Note that first two cases might return an object of Binding<BoundingBoxConstraint> depending on
f
. Also the third case returns an object of Binding<LinearEqualityConstraint>.It throws an exception if 1.
f
is not matched with one of the above patterns. Especially, strict inequalities (<, >) are not allowed. 2.f
includes a non-linear expression. 3.f
is either a trivial constraint such as “1 <= 2” or an unsatisfiable constraint such as “2 <= 1”. 4. It is not possible to find numerical bounds ofe1
ande2
wheref
= e1 ≃ e2. We allowe1
ande2
to be infinite but only if there are no other terms. For example,x <= ∞
is allowed. However,x - ∞ <= 0
is not allowed becausex ↦ ∞
introducesnan
in the evaluation.- AddLinearConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, formulas: numpy.ndarray[object[m, 1]]) -> drake::solvers::Binding<drake::solvers::LinearConstraint>
Add a linear constraint represented by an Eigen::Array<symbolic::Formula> to the program. A common use-case of this function is to add a linear constraint with the element-wise comparison between two Eigen matrices, using
A.array() <= B.array()
. See the following example.MathematicalProgram prog; Eigen::Matrix<double, 2, 2> A; auto x = prog.NewContinuousVariables(2, "x"); Eigen::Vector2d b; ... // set up A and b prog.AddLinearConstraint((A * x).array() <= b.array());
A formula in
formulas
can be of the following forms:- e1 <= e2 2. e1 >= e2 3. e1 == e2
It throws an exception if AddLinearConstraint(const symbolic::Formula& f) throws an exception for f ∈
formulas
.- Template parameter
Derived
: - An Eigen Array type of Formula.
-
AddLinearCost
(*args, **kwargs)¶ Overloaded function.
- AddLinearCost(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.symbolic.Expression) -> drake::solvers::Binding<drake::solvers::LinearCost>
Adds a linear cost term of the form a’*x + b.
- Parameter
e
: - A linear symbolic expression.
- Precondition:
- e is a linear expression a’*x + b, where each entry of x is a decision variable in the mathematical program.
Returns: The newly added linear constraint, together with the bound variables. - AddLinearCost(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, a: numpy.ndarray[numpy.float64[m, 1]], b: float, vars: numpy.ndarray[object[m, 1]]) -> drake::solvers::Binding<drake::solvers::LinearCost>
Adds a linear cost term of the form a’*x + b. Applied to a subset of the variables and pushes onto the linear cost data structure.
-
AddLinearEqualityConstraint
(*args, **kwargs)¶ Overloaded function.
- AddLinearEqualityConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, Aeq: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], beq: numpy.ndarray[numpy.float64[m, 1]], vars: numpy.ndarray[object[m, 1]]) -> drake::solvers::Binding<drake::solvers::LinearEqualityConstraint>
AddLinearEqualityConstraint
Adds linear equality constraints referencing potentially a subset of the decision variables.
Example: to add two equality constraints which only depend on two of the elements of x, you could use
auto x = prog.NewContinuousVariables(6,"myvar"); Eigen::Matrix2d Aeq; Aeq << -1, 2, 1, 1; Eigen::Vector2d beq(1, 3); // Imposes constraint // -x(0) + 2x(1) = 1 // x(0) + x(1) = 3 prog.AddLinearEqualityConstraint(Aeq, beq, x.head<2>());
- AddLinearEqualityConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, e: pydrake.symbolic.Expression, b: float) -> drake::solvers::Binding<drake::solvers::LinearEqualityConstraint>
Adds one row of linear constraint e = b where
e
is a symbolic expression.Raises: - RuntimeError if 1.
e
is a non-linear expression. 2.e
is a constant.
- Parameter
e
: - A linear symbolic expression in the form of
c0 + c1 * x1 + ... + cn * xn
wherec_i
is a constant and @x_i is a variable. - Parameter
b
: - A scalar.
Returns: The newly added linear equality constraint, together with the bound variable. - AddLinearEqualityConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, f: pydrake.symbolic.Formula) -> drake::solvers::Binding<drake::solvers::LinearEqualityConstraint>
Adds a linear equality constraint represented by a symbolic formula to the program. The input formula
f
is either an equality formula (e1 == e2
) or a conjunction of equality formulas.It throws an exception if
f
is neither an equality formula nor a conjunction of equalities.f
includes a non-linear expression.
- AddLinearEqualityConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, v: numpy.ndarray[object[m, 1]], b: numpy.ndarray[numpy.float64[m, 1]]) -> drake::solvers::Binding<drake::solvers::LinearEqualityConstraint>
Adds linear equality constraints \(v = b\), where
v(i)
is a symbolic linear expression.Raises: - RuntimeError if 1.
v(i)
is a non-linear expression. 2. v(i)
is a constant.
- Template parameter
DerivedV
: - An Eigen Matrix type of Expression. A column vector.
- Template parameter
DerivedB
: - An Eigen Matrix type of double. A column vector.
- Parameter
v
: - v(i) is a linear symbolic expression in the form of `` c0 + c1 * x1 + … + cn * xn `` where ci is a constant and @xi is a variable.
- Parameter
b
: - A vector of doubles.
Returns: The newly added linear equality constraint, together with the bound variables.
-
AddLorentzConeConstraint
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: numpy.ndarray[object[m, 1]]) → drake::solvers::Binding<drake::solvers::LorentzConeConstraint>¶ Adds Lorentz cone constraint referencing potentially a subset of the decision variables.
- Parameter
v
: - An Eigen::Vector of symbolic::Expression. Constraining that
\[v_0 \ge \sqrt{v_1^2 + ... + v_{n-1}^2}\]Returns: The newly constructed Lorentz cone constraint with the bounded variables. - Parameter
-
AddMaximizeGeometricMeanCost
(*args, **kwargs)¶ Overloaded function.
- AddMaximizeGeometricMeanCost(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, A: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], b: numpy.ndarray[numpy.float64[m, 1]], x: numpy.ndarray[object[m, 1]]) -> None
An overloaded version of maximize_geometric_mean.
- Precondition:
- A.rows() == b.rows(), A.rows() >= 2.
- AddMaximizeGeometricMeanCost(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, x: numpy.ndarray[object[m, 1]], c: float) -> None
An overloaded version of maximize_geometric_mean. We add the cost to maximize the geometric mean of x, i.e., c*power(∏ᵢx(i), 1/n).
- Parameter
c
: - The positive coefficient of the geometric mean cost, $*Default:* is 1.
- Precondition:
- x.rows() >= 2.
- Precondition:
- c > 0.
-
AddMaximizeLogDeterminantSymmetricMatrixCost
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, X: numpy.ndarray[object[m, n], flags.f_contiguous]) → None¶ Adds the cost to maximize the log determinant of symmetric matrix X. log(det(X)) is a concave function of X, so we can maximize it through convex optimization. In order to do that, we introduce slack variables t, and a lower triangular matrix Z, with the constraints ⌈X Z⌉ is positive semidifinite. ⌊Zᵀ diag(Z)⌋ log(Z(i, i)) >= t(i) and we will minimize -∑ᵢt(i).
- Parameter
X
: - A symmetric positive semidefinite matrix X, whose log(det(X)) will be maximized.
- Precondition:
- X is a symmetric matrix.
Note
The constraint log(Z(i, i)) >= t(i) is imposed as an exponential cone constraint. Please make sure your have a solver that supports exponential cone constraint (currently SCS does).
- Parameter
-
AddPositiveSemidefiniteConstraint
(*args, **kwargs)¶ Overloaded function.
- AddPositiveSemidefiniteConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: numpy.ndarray[object[m, n], flags.f_contiguous]) -> drake::solvers::Binding<drake::solvers::PositiveSemidefiniteConstraint>
Adds a positive semidefinite constraint on a symmetric matrix.
Raises: - RuntimeError in Debug mode if
symmetric_matrix_var
is not symmetric.
- Parameter
symmetric_matrix_var
: - A symmetric MatrixDecisionVariable object.
- AddPositiveSemidefiniteConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: numpy.ndarray[object[m, n], flags.f_contiguous]) -> drake::solvers::Binding<drake::solvers::PositiveSemidefiniteConstraint>
Adds a positive semidefinite constraint on a symmetric matrix of symbolic expressions
e
. We create a new symmetric matrix of variables M being positive semidefinite, with the linear equality constraint e == M.- Template parameter
Derived
: - An Eigen Matrix of symbolic expressions.
- Parameter
e
: - Imposes constraint “e is positive semidefinite”.
- Precondition:
- {1. e is symmetric. 2. e(i, j) is linear for all i, j }
Returns: The newly added positive semidefinite constraint, with the bound variable M that are also newly added.
-
AddQuadraticCost
(*args, **kwargs)¶ Overloaded function.
- AddQuadraticCost(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, Q: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], b: numpy.ndarray[numpy.float64[m, 1]], vars: numpy.ndarray[object[m, 1]]) -> drake::solvers::Binding<drake::solvers::QuadraticCost>
Adds a cost term of the form 0.5*x’*Q*x + b’x Applied to subset of the variables.
- AddQuadraticCost(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, Q: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], b: numpy.ndarray[numpy.float64[m, 1]], c: float, vars: numpy.ndarray[object[m, 1]]) -> drake::solvers::Binding<drake::solvers::QuadraticCost>
Adds a cost term of the form 0.5*x’*Q*x + b’x + c Applied to subset of the variables.
- AddQuadraticCost(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, e: pydrake.symbolic.Expression) -> drake::solvers::Binding<drake::solvers::QuadraticCost>
Add a quadratic cost term of the form 0.5*x’*Q*x + b’*x + c. Notice that in the optimization program, the constant term
c
in the cost is ignored.- Parameter
e
: - A quadratic symbolic expression.
Raises: std::runtime error if the expression is not quadratic. Returns: The newly added cost together with the bound variables.
-
AddQuadraticErrorCost
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, Q: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], x_desired: numpy.ndarray[numpy.float64[m, 1]], vars: numpy.ndarray[object[m, 1]]) → drake::solvers::Binding<drake::solvers::QuadraticCost>¶ Adds a cost term of the form (x-x_desired)’*Q*(x-x_desired).
-
AddSosConstraint
(*args, **kwargs)¶ Overloaded function.
- AddSosConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.symbolic.Polynomial, arg1: numpy.ndarray[object[m, 1]]) -> numpy.ndarray[object[m, n]]
Adds constraints that a given polynomial
p
is a sums-of-squares (SOS), that is,p
can be decomposed intomᵀQm
, where m is themonomial_basis
. It returns the coefficients matrix Q, which is positive semidefinite.Note
It calls
Reparse
to enforcep
to have this MathematicalProgram’s indeterminates if necessary.- AddSosConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.symbolic.Polynomial) -> Tuple[numpy.ndarray[object[m, n]], numpy.ndarray[object[m, 1]]]
Adds constraints that a given polynomial
p
is a sums-of-squares (SOS), that is,p
can be decomposed intomᵀQm
, where m is a monomial basis selected from the sparsity ofp
. It returns a pair of constraint bindings expressing:Note
It calls
Reparse
to enforcep
to have this MathematicalProgram’s indeterminates if necessary.- The coefficients matrix Q, which is positive semidefinite. - The
monomial basis m.
- AddSosConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.symbolic.Expression, arg1: numpy.ndarray[object[m, 1]]) -> numpy.ndarray[object[m, n]]
Adds constraints that a given symbolic expression
e
is a sums-of-squares (SOS), that is,p
can be decomposed intomᵀQm
, where m is themonomial_basis
. Note that it decomposese
into a polynomial with respect toindeterminates()
in this mathematical program. It returns the coefficients matrix Q, which is positive semidefinite.- AddSosConstraint(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.symbolic.Expression) -> Tuple[numpy.ndarray[object[m, n]], numpy.ndarray[object[m, 1]]]
Adds constraints that a given symbolic expression
e
is a sums-of-squares (SOS), that is,e
can be decomposed intomᵀQm
. Note that it decomposese
into a polynomial with respect toindeterminates()
in this mathematical program. It returns a pair expressing:- The coefficients matrix Q, which is positive semidefinite. - The
monomial basis m.
-
AddVisualizationCallback
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: Callable[[numpy.ndarray[numpy.float64[m, 1]]], None], arg1: numpy.ndarray[object[m, 1]]) → drake::solvers::Binding<drake::solvers::VisualizationCallback>¶ Adds a callback method to visualize intermediate results of the optimization.
Note
Just like other costs/constraints, not all solvers support callbacks. Adding a callback here will force MathematicalProgram::Solve to select a solver that support callbacks. For instance, adding a visualization callback to a quadratic programming problem may result in using a nonlinear programming solver as the default solver.
- Parameter
callback
: - a std::function that accepts an Eigen::Vector of doubles representing the bound decision variables.
- Parameter
vars
: - the decision variables that should be passed to the callback.
- Parameter
-
bounding_box_constraints
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → List[drake::solvers::Binding<drake::solvers::BoundingBoxConstraint>]¶ Getter for all bounding box constraints
-
decision_variable_index
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → Dict[int, int]¶ Returns the mapping from a decision variable ID to its index in the vector containing all the decision variables in the mathematical program.
-
decision_variables
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → numpy.ndarray[object[m, 1]]¶ Getter for all decision variables in the program.
-
EvalBinding
(*args, **kwargs)¶ Overloaded function.
- EvalBinding(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, binding: drake::solvers::Binding<drake::solvers::EvaluatorBase>, prog_var_vals: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]
Evaluates the value of some binding, for some input value for all decision variables.
- Parameter
binding
: - A Binding whose variables are decision variables in this program.
- Parameter
prog_var_vals
: - The value of all the decision variables in this program.
Raises: RuntimeError if the size of prog_var_vals
is invalid.- EvalBinding(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, binding: drake::solvers::Binding<drake::solvers::EvaluatorBase>, prog_var_vals: numpy.ndarray[object[m, 1]]) -> numpy.ndarray[object[m, 1]]
Evaluates the value of some binding, for some input value for all decision variables.
- Parameter
binding
: - A Binding whose variables are decision variables in this program.
- Parameter
prog_var_vals
: - The value of all the decision variables in this program.
Raises: RuntimeError if the size of prog_var_vals
is invalid.
-
EvalBindings
(*args, **kwargs)¶ Overloaded function.
- EvalBindings(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, bindings: List[drake::solvers::Binding<drake::solvers::EvaluatorBase>], prog_var_vals: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]
Evaluates a set of bindings (plural version of
EvalBinding
).- Parameter
bindings
: - List of bindings.
- Parameter
prog
: - $Parameter
prog_var_vals
:
The value of all the decision variables in this program.
Returns: All binding values, concatenated into a single vector. Raises: RuntimeError if the size of prog_var_vals
is invalid.- EvalBindings(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, bindings: List[drake::solvers::Binding<drake::solvers::EvaluatorBase>], prog_var_vals: numpy.ndarray[object[m, 1]]) -> numpy.ndarray[object[m, 1]]
Evaluates a set of bindings (plural version of
EvalBinding
).- Parameter
bindings
: - List of bindings.
- Parameter
prog
: - $Parameter
prog_var_vals
:
The value of all the decision variables in this program.
Returns: All binding values, concatenated into a single vector. Raises: RuntimeError if the size of prog_var_vals
is invalid.
-
FindDecisionVariableIndex
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, var: pydrake.symbolic.Variable) → int¶ Returns the index of the decision variable. Internally the solvers thinks all variables are stored in an array, and it accesses each individual variable using its index. This index is used when adding constraints and costs for each solver.
- Precondition:
- {
var
is a decision variable in the mathematical program, otherwise this function throws a runtime error.}
-
FindDecisionVariableIndices
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, vars: numpy.ndarray[object[m, 1]]) → List[int]¶ Returns the indices of the decision variables. Internally the solvers thinks all variables are stored in an array, and it accesses each individual variable using its index. This index is used when adding constraints and costs for each solver.
- Precondition:
- {
vars
are decision variables in the mathematical program, otherwise this function throws a runtime error.}
-
generic_constraints
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → List[drake::solvers::Binding<drake::solvers::Constraint>]¶ Getter for all generic constraints
-
generic_costs
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → List[drake::solvers::Binding<drake::solvers::Cost>]¶ Getter for all generic costs.
-
GetAllConstraints
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → List[drake::solvers::Binding<drake::solvers::Constraint>]¶ Getter for returning all constraints.
Returns: Vector of all constraint bindings. Note
The group ordering may change as more constraint types are added.
-
GetAllCosts
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → List[drake::solvers::Binding<drake::solvers::Cost>]¶ Getter returning all costs.
Returns: Vector of all cost bindings. Note
The group ordering may change as more cost types are added.
-
GetBindingVariableValues
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, binding: drake::solvers::Binding<drake::solvers::EvaluatorBase>, prog_var_vals: numpy.ndarray[numpy.float64[m, 1]]) → numpy.ndarray[numpy.float64[m, 1]]¶ Given the value of all decision variables, namely this.decision_variable(i) takes the value prog_var_vals(i), returns the vector that contains the value of the variables in binding.variables().
- Parameter
binding
: - binding.variables() must be decision variables in this MathematicalProgram.
- Parameter
prog_var_vals
: - The value of ALL the decision variables in this program.
Returns: binding_variable_vals binding_variable_vals(i) is the value of binding.variables()(i) in prog_var_vals. - Parameter
-
GetInitialGuess
(*args, **kwargs)¶ Overloaded function.
- GetInitialGuess(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.symbolic.Variable) -> float
Gets the initial guess for a single variable.
- Precondition:
decision_variable
has been registered in the optimization program.
Raises: RuntimeError if the pre condition is not satisfied. - GetInitialGuess(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: numpy.ndarray[object[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]
Gets the initial guess for some variables.
- Precondition:
- Each variable in
decision_variable_mat
has been registered in the optimization program.
Raises: RuntimeError if the pre condition is not satisfied. - GetInitialGuess(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: numpy.ndarray[object[m, n]]) -> numpy.ndarray[numpy.float64[m, n]]
Gets the initial guess for some variables.
- Precondition:
- Each variable in
decision_variable_mat
has been registered in the optimization program.
Raises: RuntimeError if the pre condition is not satisfied.
-
GetLinearConstraints
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → List[drake::solvers::Binding<drake::solvers::LinearConstraint>]¶ Getter returning all linear constraints (both linear equality and inequality constraints).
Returns: Vector of all linear constraint bindings.
-
GetSolverOptions
(*args, **kwargs)¶ Overloaded function.
- GetSolverOptions(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.solvers.mathematicalprogram.SolverId) -> dict
- GetSolverOptions(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.solvers.mathematicalprogram.SolverType) -> dict
-
indeterminate
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, i: int) → pydrake.symbolic.Variable¶ Getter for the indeterminate with index
i
in the program.
-
indeterminates
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → numpy.ndarray[object[m, 1]]¶ Getter for all indeterminates in the program.
-
indeterminates_index
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → Dict[int, int]¶ Returns the mapping from an indeterminate ID to its index in the vector containing all the indeterminates in the mathematical program.
-
linear_constraints
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → List[drake::solvers::Binding<drake::solvers::LinearConstraint>]¶ Getter for linear constraints.
-
linear_costs
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → List[drake::solvers::Binding<drake::solvers::LinearCost>]¶ Getter for linear costs.
-
linear_equality_constraints
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → List[drake::solvers::Binding<drake::solvers::LinearEqualityConstraint>]¶ Getter for linear equality constraints.
-
MakePolynomial
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, e: pydrake.symbolic.Expression) → pydrake.symbolic.Polynomial¶ Creates a symbolic polynomial from the given expression
e
. It uses this MathematicalProgram’sindeterminates()
in constructing the polynomial.This method helps a user create a polynomial with the right set of indeterminates which are declared in this MathematicalProgram. We recommend users to use this method over an explicit call to Polynomial constructors to avoid a possible mismatch between this MathematicalProgram’s indeterminates and the user-specified indeterminates (or unspecified, which then includes all symbolic variables in the expression
e
). Consider the following example.e = ax + bx + c
MP.indeterminates() = {x} MP.decision_variables() = {a, b}
MP.MakePolynomial(e)
create a polynomial,(a + b)x + c
. Here onlyx
is an indeterminate of this polynomial.- In contrast,
symbolic::Polynomial(e)
returnsax + bx + c
where all variables{a, b, x}
are indeterminates. Note that this is problematic as its indeterminates,{a, b, x}
and the MathematicalProgram’s decision variables,{a, b}
overlap.
Note
This function does not require that the decision variables in
e
is a subset of the decision variables in MathematicalProgram.
-
NewBinaryVariables
(*args, **kwargs)¶ Overloaded function.
- NewBinaryVariables(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, rows: int, name: str = ‘b’) -> numpy.ndarray[object[m, 1]]
Adds binary variables to this MathematicalProgram. The new variables are viewed as a column vector, with size
rows
x 1.See also
NewBinaryVariables(int rows, int cols, const std::vector<std::string>& names);
- NewBinaryVariables(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, rows: int, cols: int, name: str = ‘b’) -> numpy.ndarray[object[m, n]]
Adds binary variables, appending them to an internal vector of any existing vars. The initial guess values for the new variables are set to NaN, to indicate that an initial guess has not been assigned. Callers are expected to add costs and/or constraints to have any effect during optimization. Callers can also set the initial guess of the decision variables through SetInitialGuess() or SetInitialGuessForAllVariables().
- Template parameter
Rows
: - The number of rows in the new variables.
- Template parameter
Cols
: - The number of columns in the new variables.
- Parameter
rows
: - The number of rows in the new variables.
- Parameter
cols
: - The number of columns in the new variables.
- Parameter
name
: - The commonly shared name of the new variables.
Returns: The MatrixDecisionVariable of size rows x cols, containing the new vars (not all the vars stored). Example:
MathematicalProgram prog; auto b = prog.NewBinaryVariables(2, 3, "b");
This adds a 2 x 3 matrix decision variables into the program.
The name of the variable is only used for the user in order to ease readability.
-
NewContinuousVariables
(*args, **kwargs)¶ Overloaded function.
- NewContinuousVariables(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, rows: int, name: str = ‘x’) -> numpy.ndarray[object[m, 1]]
Adds continuous variables, appending them to an internal vector of any existing vars. The initial guess values for the new variables are set to NaN, to indicate that an initial guess has not been assigned. Callers are expected to add costs and/or constraints to have any effect during optimization. Callers can also set the initial guess of the decision variables through SetInitialGuess() or SetInitialGuessForAllVariables().
- Parameter
rows
: - The number of rows in the new variables.
- Parameter
name
: - The name of the newly added variables
Returns: The VectorDecisionVariable of size rows x 1, containing the new vars (not all the vars stored). Example:
MathematicalProgram prog; auto x = prog.NewContinuousVariables(2, "x");
This adds a 2 x 1 vector containing decision variables into the program. The names of the variables are “x(0)” and “x(1)”.
The name of the variable is only used for the user in order to ease readability.
- NewContinuousVariables(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, rows: int, cols: int, name: str = ‘x’) -> numpy.ndarray[object[m, n]]
Adds continuous variables, appending them to an internal vector of any existing vars. The initial guess values for the new variables are set to NaN, to indicate that an initial guess has not been assigned. Callers are expected to add costs and/or constraints to have any effect during optimization. Callers can also set the initial guess of the decision variables through SetInitialGuess() or SetInitialGuessForAllVariables().
- Template parameter
Rows
: - The number of rows of the new variables, in the compile time.
- Template parameter
Cols
: - The number of columns of the new variables, in the compile time.
- Parameter
rows
: - The number of rows in the new variables. When Rows is not Eigen::Dynamic, rows is ignored.
- Parameter
cols
: - The number of columns in the new variables. When Cols is not Eigen::Dynamic, cols is ignored.
- Parameter
name
: - All variables will share the same name, but different index.
Returns: The MatrixDecisionVariable of size Rows x Cols, containing the new vars (not all the vars stored). Example:
MathematicalProgram prog; auto x = prog.NewContinuousVariables(2, 3, "X"); auto y = prog.NewContinuousVariables<2, 3>(2, 3, "X");
This adds a 2 x 3 matrix decision variables into the program.
The name of the variable is only used for the user in order to ease readability.
-
NewEvenDegreeDsosPolynomial
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, indeterminates: pydrake.symbolic.Variables, degree: int) → Tuple[pydrake.symbolic.Polynomial, numpy.ndarray[object[m, n]], numpy.ndarray[object[m, n]]]¶ see even_degree_nonnegative_polynomial for details. Variant that produces a DSOS polynomial. Same as NewEvenDegreeSosPolynomial, except the returned polynomial is diagonally dominant sum of squares (dsos).
-
NewEvenDegreeFreePolynomial
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, indeterminates: pydrake.symbolic.Variables, degree: int, coeff_name: str = 'a') → pydrake.symbolic.Polynomial¶ Returns a free polynomial that only contains even degree monomials. A monomial is even degree if its total degree (sum of all variables’ degree) is even. For example, xy is an even degree monomial (degree 2) while x²y is not (degree 3).
- Parameter
indeterminates
: - The monomial basis is over these indeterminates.
- Parameter
degree
: - The highest degree of the polynomial.
- Parameter
coeff_name
: - The coefficients of the polynomial are decision variables with this name as a base. The variable name would be “a1”, “a2”, etc.
- Parameter
-
NewEvenDegreeSdsosPolynomial
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, indeterminates: pydrake.symbolic.Variables, degree: int) → Tuple[pydrake.symbolic.Polynomial, numpy.ndarray[object[m, n]], numpy.ndarray[object[m, n]]]¶ see even_degree_nonnegative_polynomial for details. Variant that produces an SDSOS polynomial.
-
NewEvenDegreeSosPolynomial
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, indeterminates: pydrake.symbolic.Variables, degree: int) → Tuple[pydrake.symbolic.Polynomial, numpy.ndarray[object[m, n]], numpy.ndarray[object[m, n]]]¶ See even_degree_nonnegative_polynomial for more details. Variant that produces a SOS polynomial.
-
NewFreePolynomial
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, indeterminates: pydrake.symbolic.Variables, deg: int, coeff_name: str = 'a') → pydrake.symbolic.Polynomial¶ Returns a free polynomial in a monomial basis over
indeterminates
of a givendegree
. It usescoeff_name
to make new decision variables and use them as coefficients. For example,NewFreePolynomial({x₀, x₁}, 2)
returns a₀x₁² + a₁x₀x₁ + a₂x₀² + a₃x₁ + a₄x₀ + a₅.
-
NewIndeterminates
(*args, **kwargs)¶ Overloaded function.
- NewIndeterminates(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, rows: int, name: str = ‘x’) -> numpy.ndarray[object[m, 1]]
Adds indeterminates to this MathematicalProgram, with default name “x”.
See also
NewIndeterminates(int rows, int cols, const std::vector<std::string>& names);
- NewIndeterminates(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, rows: int, cols: int, name: str = ‘X’) -> numpy.ndarray[object[m, n]]
Adds indeterminates to this MathematicalProgram, with default name “X”. The new variables are returned and viewed as a matrix, with size
rows
xcols
.See also
NewIndeterminates(int rows, int cols, const std::vector<std::string>& names);
-
NewOddDegreeFreePolynomial
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, indeterminates: pydrake.symbolic.Variables, degree: int, coeff_name: str = 'a') → pydrake.symbolic.Polynomial¶ Returns a free polynomial that only contains odd degree monomials. A monomial is odd degree if its total degree (sum of all variables’ degree) is even. For example, xy is not an odd degree monomial (degree 2) while x²y is (degree 3).
- Parameter
indeterminates
: - The monomial basis is over these indeterminates.
- Parameter
degree
: - The highest degree of the polynomial.
- Parameter
coeff_name
: - The coefficients of the polynomial are decision variables with this name as a base. The variable name would be “a1”, “a2”, etc.
- Parameter
-
NewSosPolynomial
(*args, **kwargs)¶ Overloaded function.
- NewSosPolynomial(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, monomial_basis: numpy.ndarray[object[m, 1]]) -> Tuple[pydrake.symbolic.Polynomial, numpy.ndarray[object[m, n]]]
Returns a pair of a SOS polynomial p = mᵀQm and the Grammian matrix Q, where m is the
monomial
basis. For example,NewSosPolynomial(Vector2<Monomial>{x,y})
returns a polynomial p = Q₍₀,₀₎x² + 2Q₍₁,₀₎xy + Q₍₁,₁₎y² and Q.Note
Q is a symmetric monomial_basis.rows() x monomial_basis.rows() matrix.
- NewSosPolynomial(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, indeterminates: pydrake.symbolic.Variables, degree: int) -> Tuple[pydrake.symbolic.Polynomial, numpy.ndarray[object[m, n]]]
Returns a pair of a SOS polynomial p = m(x)ᵀQm(x) of degree
degree
and the Grammian matrix Q that should be PSD, where m(x) is the result of callingMonomialBasis(indeterminates, degree/2)
. For example,NewSosPolynomial({x}, 4)
returns a pair of a polynomial p = Q₍₀,₀₎x⁴ + 2Q₍₁,₀₎ x³ + (2Q₍₂,₀₎ + Q₍₁,₁₎)x² + 2Q₍₂,₁₎x + Q₍₂,₂₎ and Q.Raises: RuntimeError if degree
is not a positive even integer.See also
MonomialBasis.
-
NewSymmetricContinuousVariables
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, rows: int, name: str = 'Symmetric') → numpy.ndarray[object[m, n]]¶ Adds a runtime sized symmetric matrix as decision variables to this MathematicalProgram. The optimization will only use the stacked columns of the lower triangular part of the symmetric matrix as decision variables.
- Parameter
rows
: - The number of rows in the symmetric matrix.
- Parameter
name
: - The name of the matrix. It is only used the for user to understand the optimization program. The default name is “Symmetric”, and each variable will be named as
Symmetric(0, 0) Symmetric(1, 0) ... Symmetric(rows-1, 0) Symmetric(1, 0) Symmetric(1, 1) ... Symmetric(rows-1, 1) ... Symmetric(rows-1,0) Symmetric(rows-1,1) ... Symmetric(rows-1, rows-1)
Notice that the (i,j)’th entry and (j,i)’th entry has the same name.
Returns: The newly added decision variables. - Parameter
-
num_vars
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → int¶ Getter for number of variables in the optimization program
-
quadratic_costs
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram) → List[drake::solvers::Binding<drake::solvers::QuadraticCost>]¶ Getter for quadratic costs.
-
Reparse
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, p: pydrake.symbolic.Polynomial) → None¶ Reparses the polynomial
p
using this MathematicalProgram’s indeterminates.
-
SetDecisionVariableValueInVector
(*args, **kwargs)¶ Overloaded function.
- SetDecisionVariableValueInVector(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, decision_variable: pydrake.symbolic.Variable, decision_variable_new_value: float, values: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None
Updates the value of a single
decision_variable
inside thevalues
vector to bedecision_variable_new_value
. The other decision variables’ values invalues
are unchanged.- Parameter
decision_variable
: - a registered decision variable in this program.
- Parameter
decision_variable_new_value
: - the variable’s new values.
- Parameter
values
: - The vector to be tweaked; must be of size num_vars().
- SetDecisionVariableValueInVector(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, decision_variables: numpy.ndarray[object[m, n], flags.f_contiguous], decision_variables_new_values: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], values: numpy.ndarray[numpy.float64[m, 1], flags.writeable]) -> None
Updates the values of some
decision_variables
inside thevalues
vector to bedecision_variables_new_values
. The other decision variables’ values invalues
are unchanged.- Parameter
decision_variables
: - registered decision variables in this program.
- Parameter
decision_variables_new_values
: - the variables’ respective new values; must have the same rows()
and cols() sizes and
decision_variables
. - Parameter
values
: - The vector to be tweaked; must be of size num_vars().
-
SetInitialGuess
(*args, **kwargs)¶ Overloaded function.
- SetInitialGuess(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.symbolic.Variable, arg1: float) -> None
Sets the initial guess for a single variable
decision_variable
. The guess is stored as part of this program.- Precondition:
- decision_variable is a registered decision variable in the program.
Raises: RuntimeError if precondition is not satisfied. - SetInitialGuess(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: numpy.ndarray[object[m, n]], arg1: numpy.ndarray[numpy.float64[m, n]]) -> None
Sets the initial guess for the decision variables stored in
decision_variable_mat
to bex0
. The guess is stored as part of this program.
-
SetInitialGuessForAllVariables
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: numpy.ndarray[numpy.float64[m, 1]]) → None¶ Set the initial guess for ALL decision variables. Note that variables begin with a default initial guess of NaN to indicate that no guess is available.
- Parameter
x0
: - A vector of appropriate size (num_vars() x 1).
- Parameter
-
SetSolverOption
(*args, **kwargs)¶ Overloaded function.
- SetSolverOption(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, solver_id: pydrake.solvers.mathematicalprogram.SolverId, solver_option: str, option_value: float) -> None
- SetSolverOption(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, solver_id: pydrake.solvers.mathematicalprogram.SolverId, solver_option: str, option_value: int) -> None
- SetSolverOption(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, solver_id: pydrake.solvers.mathematicalprogram.SolverId, solver_option: str, option_value: str) -> None
- SetSolverOption(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.solvers.mathematicalprogram.SolverType, arg1: str, arg2: float) -> None
- SetSolverOption(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.solvers.mathematicalprogram.SolverType, arg1: str, arg2: int) -> None
- SetSolverOption(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.solvers.mathematicalprogram.SolverType, arg1: str, arg2: str) -> None
-
SetSolverOptions
(self: pydrake.solvers.mathematicalprogram.MathematicalProgram, arg0: pydrake.solvers.mathematicalprogram.SolverOptions) → None¶ Overwrite the stored solver options inside MathematicalProgram with the provided solver options.
-
-
class
pydrake.solvers.mathematicalprogram.
MathematicalProgramResult
¶ The result returned by MathematicalProgram::Solve(). It stores the solvers::SolutionResult (whether the program is solved to optimality, detected infeasibility, etc), the optimal value for the decision variables, the optimal cost, and solver specific details.
-
__init__
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult) → None¶ Constructs the result.
Note
The solver_details is set to nullptr.
-
EvalBinding
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, arg0: drake::solvers::Binding<drake::solvers::EvaluatorBase>) → numpy.ndarray[numpy.float64[m, 1]]¶ Evaluate a Binding at the solution.
- Parameter
binding
: - A binding between a constraint/cost and the variables.
- Precondition:
- The binding.variables() must be the within the decision variables in the MathematicalProgram that generated this MathematicalProgramResult.
- Precondition:
- The user must have called set_decision_variable_index() function.
- Parameter
-
get_optimal_cost
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult) → float¶ Gets the optimal cost.
-
get_solution_result
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult) → drake::solvers::SolutionResult¶ Gets SolutionResult.
-
get_solver_details
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult) → object¶ Gets the solver details for the
Solver
that solved the program. Throws an error if the solver_details has not been set.
-
get_solver_id
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult) → pydrake.solvers.mathematicalprogram.SolverId¶ Gets the solver ID.
-
get_suboptimal_objective
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, solution_number: int) → float¶ Gets the suboptimal objective value. See solution_pools “solution pools”.
- Parameter
solution_number
: - The index of the sub-optimal solution.
- Precondition:
solution_number
should be in the range [0, num_suboptimal_solution()).
- Parameter
-
get_x_val
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult) → numpy.ndarray[numpy.float64[m, 1]]¶ Gets the decision variable values.
-
GetDualSolution
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, arg0: drake::solvers::Binding<drake::solvers::EvaluatorBase>) → numpy.ndarray[numpy.float64[m, 1]]¶ Gets the dual solution associated with a constraint.
We interpret the dual variable value as the “shadow price” of the original problem. Namely if we change the constraint bound by one unit (each unit is infinitesimally small), the change of the optimal cost is the value of the dual solution times the unit. Mathematically dual_solution = ∂optimal_cost / ∂bound.
For a linear equality constraint Ax = b where b ∈ ℝⁿ, the vector of dual variables has n rows, and dual_solution(i) is the value of the dual variable for the constraint A(i,:)*x = b(i).
For a linear inequality constraint lower <= A*x <= upper where lower and upper ∈ ℝⁿ, dual_solution also has n rows. dual_solution(i) is the value of the dual variable for constraint lower(i) <= A(i,:)*x <= upper(i). If neither side of the constraint is active, then dual_solution(i) is 0. If the left hand-side lower(i) <= A(i, :)*x is active (meaning lower(i) = A(i, :)*x at the solution), then dual_solution(i) is non-negative (because the objective is to minimize a cost, increasing the lower bound means the constraint set is tighter, hence the optimal solution cannot decrease. Thus the shadow price is non-negative). If the right hand-side A(i, :)*x<=upper(i) is active (meaning A(i,:)*x=upper(i) at the solution), then dual_solution(i) is non-positive.
For a bounding box constraint lower <= x <= upper, the interpretation of the dual solution is the same as the linear inequality constraint.
For a Lorentz cone or rotated Lorentz cone constraint that Ax + b is in the cone, depending on the solver, the dual solution has different meanings: 1. If the solver is Gurobi, then the user can only obtain the dual solution by explicitly setting the options for computing dual solution.
auto constraint = prog.AddLorentzConeConstraint(...); GurobiSolver solver; // Explicitly tell the solver to compute the dual solution for Lorentz // cone or rotated Lorentz cone constraint, check // https://www.gurobi.com/documentation/9.0/refman/qcpdual.html for // more information. SolverOptions options; options.SetOption(GurobiSolver::id(), "QCPDual", 1); MathematicalProgramResult result = solver.Solve(prog, {}, options); Eigen::VectorXd dual_solution = result.GetDualSolution(constraint);
The dual solution has size 1, dual_solution(0) is the shadow price for the constraint z₁² + … +zₙ² ≤ z₀² for Lorentz cone constraint, and the shadow price for the constraint z₂² + … +zₙ² ≤ z₀z₁ for rotated Lorentz cone constraint, where z is the slack variable representing z = A*x+b and z in the Lorentz cone/rotated Lorentz cone. 2. For nonlinear solvers like IPOPT, the dual solution for Lorentz cone constraint (with EvalType::kConvex) is the shadow price for z₀ - sqrt(z₁² + … +zₙ²) ≥ 0, where z = Ax+b.
-
GetInfeasibleConstraintNames
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, prog: drake::solvers::MathematicalProgram, tol: Optional[float] = None) → List[str]¶ See get_infeasible_constraints for more information.
- Parameter
prog
: - The MathematicalProgram that was solved to obtain
this
MathematicalProgramResult. - Parameter
tolerance
: - A positive tolerance to check the constraint violation. If no tolerance is provided, this method will attempt to obtain the constraint tolerance from the solver, or insert a conservative default tolerance.
Note: Currently most constraints have the empty string as the description, so the NiceTypeName of the Constraint is used instead. Use e.g.
prog.AddConstraint(x == 1).evaluator().set_description(str)
to make this method more specific/useful.- Parameter
-
GetInfeasibleConstraints
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, prog: drake::solvers::MathematicalProgram, tol: Optional[float] = None) → List[drake::solvers::Binding<drake::solvers::Constraint>]¶ See get_infeasible_constraints for more information.
- Parameter
prog
: - The MathematicalProgram that was solved to obtain
this
MathematicalProgramResult. - Parameter
tolerance
: - A positive tolerance to check the constraint violation. If no tolerance is provided, this method will attempt to obtain the constraint tolerance from the solver, or insert a conservative default tolerance.
Returns: infeasible_bindings A vector of all infeasible bindings (constraints together with the associated variables) at the best-effort solution. - Parameter
-
GetSolution
(*args, **kwargs)¶ Overloaded function.
- GetSolution(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult) -> numpy.ndarray[numpy.float64[m, 1]]
Gets the solution of all decision variables.
- GetSolution(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, arg0: pydrake.symbolic.Variable) -> float
Gets the solution of a single decision variable.
- Parameter
var
: - The decision variable.
Returns: The value of the decision variable after solving the problem.
Raises: - invalid_argument if
var
is not captured in the mapping decision_variable_index
, as the input argument ofset_decision_variable_index().
- GetSolution(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, arg0: numpy.ndarray[object[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]
Gets the solution of an Eigen matrix of decision variables.
- Template parameter
Derived
: - An Eigen matrix containing Variable.
- Parameter
var
: - The decision variables.
Returns: The value of the decision variable after solving the problem. - GetSolution(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, arg0: numpy.ndarray[object[m, n]]) -> numpy.ndarray[numpy.float64[m, n]]
Gets the solution of an Eigen matrix of decision variables.
- Template parameter
Derived
: - An Eigen matrix containing Variable.
- Parameter
var
: - The decision variables.
Returns: The value of the decision variable after solving the problem. - GetSolution(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, arg0: pydrake.symbolic.Expression) -> pydrake.symbolic.Expression
Substitutes the value of all decision variables into the Expression.
- Parameter
e
: - The decision variable.
Returns: the Expression that is the result of the substitution. - GetSolution(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, arg0: pydrake.symbolic.Polynomial) -> pydrake.symbolic.Polynomial
Substitutes the value of all decision variables into the coefficients of the symbolic polynomial.
- Parameter
p
: - A symbolic polynomial. Its indeterminates can’t intersect with the set of decision variables of the MathematicalProgram from which this result is obtained.
Returns: the symbolic::Polynomial as the result of the substitution. - GetSolution(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, arg0: numpy.ndarray[object[m, n]]) -> numpy.ndarray[object[m, n]]
-
GetSuboptimalSolution
(*args, **kwargs)¶ Overloaded function.
- GetSuboptimalSolution(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, arg0: pydrake.symbolic.Variable, arg1: int) -> float
Gets the suboptimal solution of a decision variable. See solution_pools “solution pools”
- Parameter
var
: - The decision variable.
- Parameter
solution_number
: - The index of the sub-optimal solution.
- Precondition:
solution_number
should be in the range [0, num_suboptimal_solution()).
Returns: The suboptimal value of the decision variable after solving the problem. - GetSuboptimalSolution(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, arg0: numpy.ndarray[object[m, 1]], arg1: int) -> numpy.ndarray[numpy.float64[m, 1]]
@name Solution Pools Some solvers (like Gurobi, Cplex, etc) can store a pool of (suboptimal) solutions for mixed integer programming model. Gets the suboptimal solution corresponding to a matrix of decision variables. See solution_pools “solution pools”
- Parameter
var
: - The decision variables.
- Parameter
solution_number
: - The index of the sub-optimal solution.
- Precondition:
solution_number
should be in the range [0, num_suboptimal_solution()).
Returns: The suboptimal values of the decision variables after solving the problem. - GetSuboptimalSolution(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, arg0: numpy.ndarray[object[m, n]], arg1: int) -> numpy.ndarray[numpy.float64[m, n]]
@name Solution Pools Some solvers (like Gurobi, Cplex, etc) can store a pool of (suboptimal) solutions for mixed integer programming model. Gets the suboptimal solution corresponding to a matrix of decision variables. See solution_pools “solution pools”
- Parameter
var
: - The decision variables.
- Parameter
solution_number
: - The index of the sub-optimal solution.
- Precondition:
solution_number
should be in the range [0, num_suboptimal_solution()).
Returns: The suboptimal values of the decision variables after solving the problem.
-
is_success
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult) → bool¶ Returns true if the optimization problem is solved successfully; false otherwise. For more information on the solution status, the user could call get_solver_details() to obtain the solver-specific solution status.
-
set_x_val
(self: pydrake.solvers.mathematicalprogram.MathematicalProgramResult, x_val: numpy.ndarray[numpy.float64[m, 1]]) → None¶ Sets the decision variable values.
-
-
class
pydrake.solvers.mathematicalprogram.
PositiveSemidefiniteConstraint
¶ Bases:
pydrake.solvers.mathematicalprogram.Constraint
Implements a positive semidefinite constraint on a symmetric matrix S
\[\text{ S is p.s.d\]}
namely, all eigen values of S are non-negative.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
pydrake.solvers.mathematicalprogram.
QuadraticCost
¶ Bases:
pydrake.solvers.mathematicalprogram.Cost
Implements a cost of the form
\[.5 x'Qx + b'x + c\].
-
__init__
(self: pydrake.solvers.mathematicalprogram.QuadraticCost, Q: numpy.ndarray[numpy.float64[m, n]], b: numpy.ndarray[numpy.float64[m, 1]], c: float) → None¶ Constructs a cost of the form
\[.5 x'Qx + b'x + c\].
- Parameter
Q
: - Quadratic term.
- Parameter
b
: - Linear term.
- Parameter
c
: - (optional) Constant term.
- Parameter
-
b
(self: pydrake.solvers.mathematicalprogram.QuadraticCost) → numpy.ndarray[numpy.float64[m, 1]]¶
-
c
(self: pydrake.solvers.mathematicalprogram.QuadraticCost) → float¶
-
Q
(self: pydrake.solvers.mathematicalprogram.QuadraticCost) → numpy.ndarray[numpy.float64[m, n]]¶ Returns the symmetric matrix Q, as the Hessian of the cost.
-
UpdateCoefficients
(self: pydrake.solvers.mathematicalprogram.QuadraticCost, new_Q: numpy.ndarray[numpy.float64[m, n]], new_b: numpy.ndarray[numpy.float64[m, 1]], new_c: float = 0) → None¶ Updates the quadratic and linear term of the constraint. The new matrices need to have the same dimension as before.
- Parameter
new_Q
: - New quadratic term.
- Parameter
new_b
: - New linear term.
- Parameter
new_c
: - (optional) New constant term.
- Parameter
-
-
class
pydrake.solvers.mathematicalprogram.
SolutionResult
¶ Members:
kSolutionFound : Found the optimal solution.
kInvalidInput : Invalid input.
kInfeasibleConstraints : The primal is infeasible.
kUnbounded : The primal is unbounded.
kUnknownError : Unknown error.
kInfeasible_Or_Unbounded :
kIterationLimit : Reaches the iteration limits.
kDualInfeasible : Dual problem is infeasible. In this case we cannot
-
__init__
(self: pydrake.solvers.mathematicalprogram.SolutionResult, arg0: int) → None¶
-
kDualInfeasible
= SolutionResult.kDualInfeasible¶
-
kInfeasible_Or_Unbounded
= SolutionResult.kInfeasible_Or_Unbounded¶
-
kInfeasibleConstraints
= SolutionResult.kInfeasibleConstraints¶
-
kInvalidInput
= SolutionResult.kInvalidInput¶
-
kIterationLimit
= SolutionResult.kIterationLimit¶
-
kSolutionFound
= SolutionResult.kSolutionFound¶
-
kUnbounded
= SolutionResult.kUnbounded¶
-
kUnknownError
= SolutionResult.kUnknownError¶
-
name
¶
-
-
pydrake.solvers.mathematicalprogram.
Solve
(prog: pydrake.solvers.mathematicalprogram.MathematicalProgram, initial_guess: Optional[numpy.ndarray[numpy.float64[m, 1]]] = None, solver_options: Optional[pydrake.solvers.mathematicalprogram.SolverOptions] = None) → pydrake.solvers.mathematicalprogram.MathematicalProgramResult¶ Solves an optimization program, with optional initial guess and solver options. This function first chooses the best solver depending on the availability of the solver and the program formulation; it then constructs that solver and call the Solve function of that solver. The optimization result is stored in the return argument.
- Parameter
prog
: - Contains the formulation of the program, and possibly solver options.
- Parameter
initial_guess
: - The initial guess for the decision variables.
- Parameter
solver_options
: - The options in addition to those stored in
prog
.
Returns: result The result of solving the program through the solver. - Parameter
-
class
pydrake.solvers.mathematicalprogram.
SolverId
¶ Identifies a SolverInterface implementation.
A moved-from instance is guaranteed to be empty and will not compare equal to any non-empty ID.
-
__init__
(self: pydrake.solvers.mathematicalprogram.SolverId, name: str) → None¶ Constructs a specific, known solver type. Internally, a hidden identifier is allocated and assigned to this instance; all instances that share an identifier (including copies of this instance) are considered equal. The solver names are not enforced to be unique, though we recommend that they remain so in practice.
-
name
(self: pydrake.solvers.mathematicalprogram.SolverId) → str¶
-
-
class
pydrake.solvers.mathematicalprogram.
SolverInterface
¶ Interface used by implementations of individual solvers.
-
__init__
(self: pydrake.solvers.mathematicalprogram.SolverInterface) → None¶
-
AreProgramAttributesSatisfied
(self: pydrake.solvers.mathematicalprogram.SolverInterface, prog: drake::solvers::MathematicalProgram) → bool¶ Returns true if the program attributes are satisfied by the solver’s capability.
-
available
(self: pydrake.solvers.mathematicalprogram.SolverInterface) → bool¶ Returns true iff this solver was enabled at compile-time. Certain solvers may be excluded at compile-time due to licensing or linking restrictions. When this method returns false, the Solve method will throw.
-
Solve
(*args, **kwargs)¶ Overloaded function.
- Solve(self: pydrake.solvers.mathematicalprogram.SolverInterface, prog: drake::solvers::MathematicalProgram, initial_guess: Optional[numpy.ndarray[numpy.float64[m, 1]]], solver_options: Optional[drake::solvers::SolverOptions], result: drake::solvers::MathematicalProgramResult) -> None
Solves an optimization program with optional initial guess and solver options. Note that these initial guess and solver options are not written to
prog
. If theprog
has set an option for a solver, andsolver_options
contains a different value for the same option on the same solver, thensolver_options
takes priority.- Solve(self: pydrake.solvers.mathematicalprogram.SolverInterface, prog: drake::solvers::MathematicalProgram, initial_guess: Optional[numpy.ndarray[numpy.float64[m, 1]]] = None, solver_options: Optional[drake::solvers::SolverOptions] = None) -> drake::solvers::MathematicalProgramResult
Like SolverInterface::Solve(), but the result is a return value instead of an output argument.
-
solver_id
(self: pydrake.solvers.mathematicalprogram.SolverInterface) → drake::solvers::SolverId¶ Returns the identifier of this solver.
-
solver_type
(self: pydrake.solvers.mathematicalprogram.SolverInterface) → Optional[drake::solvers::SolverType]¶
-
SolverName
(self: pydrake.solvers.mathematicalprogram.SolverInterface) → str¶
-
-
class
pydrake.solvers.mathematicalprogram.
SolverOptions
¶ Stores options for multiple solvers. This interface does not do any verification of solver parameters. It does not even verify that the specified solver exists. Use this only when you have particular knowledge of what solver is being invoked, and exactly what tuning is required.
Supported solver names/options:
“SNOPT” – Parameter names and values as specified in SNOPT User’s Guide section 7.7 “Description of the optional parameters”, used as described in section 7.5 for snSet(). The SNOPT user guide can be obtained from https://web.stanford.edu/group/SOL/guides/sndoc7.pdf
“IPOPT” – Parameter names and values as specified in IPOPT users guide section “Options Reference” http://www.coin-or.org/Ipopt/documentation/node40.html
“GUROBI” – Parameter name and values as specified in Gurobi Reference Manual, section 10.2 “Parameter Descriptions” https://www.gurobi.com/documentation/9.0/refman/parameters.html
“SCS” – Parameter name and values as specified in the struct SCS_SETTINGS in SCS header file https://github.com/cvxgrp/scs/blob/master/include/scs.h Note that the SCS code on github master might be more up-to-date than the version used in Drake.
“MOSEK” – Parameter name and values as specified in Mosek Reference https://docs.mosek.com/9.0/capi/parameters.html
-
__init__
(self: pydrake.solvers.mathematicalprogram.SolverOptions) → None¶
-
GetOptions
(self: pydrake.solvers.mathematicalprogram.SolverOptions, solver_id: pydrake.solvers.mathematicalprogram.SolverId) → dict¶
-
SetOption
(*args, **kwargs)¶ Overloaded function.
- SetOption(self: pydrake.solvers.mathematicalprogram.SolverOptions, solver_id: pydrake.solvers.mathematicalprogram.SolverId, solver_option: str, option_value: float) -> None
Set common options for all solvers supporting that option (for example, printing the progress in each iteration). If the solver doesn’t support the option, the option is ignored.
- SetOption(self: pydrake.solvers.mathematicalprogram.SolverOptions, solver_id: pydrake.solvers.mathematicalprogram.SolverId, solver_option: str, option_value: int) -> None
Set common options for all solvers supporting that option (for example, printing the progress in each iteration). If the solver doesn’t support the option, the option is ignored.
- SetOption(self: pydrake.solvers.mathematicalprogram.SolverOptions, solver_id: pydrake.solvers.mathematicalprogram.SolverId, solver_option: str, option_value: str) -> None
Set common options for all solvers supporting that option (for example, printing the progress in each iteration). If the solver doesn’t support the option, the option is ignored.
-
-
class
pydrake.solvers.mathematicalprogram.
SolverType
¶ Members:
kCsdp :
kDReal :
kEqualityConstrainedQP :
kGurobi :
kIpopt :
kLinearSystem :
kMobyLCP :
kMosek :
kNlopt :
kOsqp :
kScs :
kSnopt :
-
__init__
(self: pydrake.solvers.mathematicalprogram.SolverType, arg0: int) → None¶
-
kCsdp
= SolverType.kCsdp¶
-
kDReal
= SolverType.kDReal¶
-
kEqualityConstrainedQP
= SolverType.kEqualityConstrainedQP¶
-
kGurobi
= SolverType.kGurobi¶
-
kIpopt
= SolverType.kIpopt¶
-
kLinearSystem
= SolverType.kLinearSystem¶
-
kMobyLCP
= SolverType.kMobyLCP¶
-
kMosek
= SolverType.kMosek¶
-
kNlopt
= SolverType.kNlopt¶
-
kOsqp
= SolverType.kOsqp¶
-
kScs
= SolverType.kScs¶
-
kSnopt
= SolverType.kSnopt¶
-
name
¶
-
-
class
pydrake.solvers.mathematicalprogram.
VisualizationCallback
¶ Bases:
pydrake.solvers.mathematicalprogram.EvaluatorBase
Defines a simple evaluator with no outputs that takes a callback function pointer. This is intended for debugging / visualization of intermediate results during an optimization (for solvers that support it).
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-


Comparison Report: {SOURCE} vs. {TARGET}
Objects that differ
{DIFFER}
Objects on {SOURCE} but not on {TARGET}
{SOURCE_NOT_TARGET}
Objects on {TARGET} but not on {SOURCE}
{TARGET_NOT_SOURCE}
Objects that are the same on both
{SAME}


TableManners
Filter your <table>s.
已启用
Open-sourced on
kingcos/TableManners
.
Powered by
kingcos.me
.


Some Page
Some tab
Some tab
Some tab
Some content
Launch App
Type your statement of intent
in the box below
Process!
Close


--- --- {% capture markdown %} # Heading 1 {% endcapture %} {% assign text = markdown | markdownify %} {% include anchor_headings.html html=text headerAttrs='data-my-id="%html_id%" data-original-title="My original title was "%heading%""' %}


Thank you for joining with us as we begin our new partnership together. You will meet amazing developers in this platform from various parts of the world. You can share amazing content/thoughts with others. You can also create your cooperate profile and also download it. Many more other surprises on your way 😍
You can login into application by Clicking Here


Program started at Mon-07-May-2007 17:47.
Analysed requests from Fri-01-Sep-2006 01:00 to Sat-30-Sep-2006 23:59 (29.96 days).
(Go To: Top | General Summary | Monthly Report | Daily Summary | Hourly Summary)
This report contains overall statistics.
Successful requests: 16,615,405
Average successful requests per day: 554,629
Successful requests for pages: 5,638,849
Average successful requests for pages per day: 188,227
Failed requests: 5,960
Redirected requests: 393,460
Distinct files requested: 817
Distinct hosts served: 197,625
Corrupt logfile lines: 176
Unwanted logfile entries: 14,906
Data transferred: 268.57 gigabytes
Average data transferred per day: 8.96 gigabytes
(Go To: Top | General Summary | Monthly Report | Daily Summary | Hourly Summary)
This report lists the activity in each month.
Each unit () represents 200,000 requests for pages or part thereof.
| month | reqs | pages | |
|---|---|---|---|
| Sep 2006 | 16615405 | 5638849 |
Busiest month: Sep 2006 (5,638,849 requests for pages).
(Go To: Top | General Summary | Monthly Report | Daily Summary | Hourly Summary)
This report lists the total activity for each day of the week, summed over all the weeks in the report.
Each unit () represents 30,000 requests for pages or part thereof.
| day | reqs | pages | |
|---|---|---|---|
| Sun | 2646821 | 898940 | |
| Mon | 3372970 | 1138460 | |
| Tue | 2311451 | 768725 | |
| Wed | 2125528 | 722464 | |
| Thu | 1824811 | 628834 | |
| Fri | 2054010 | 718828 | |
| Sat | 2279814 | 762598 |
(Go To: Top | General Summary | Monthly Report | Daily Summary | Hourly Summary)
This report lists the total activity for each hour of the day, summed over all the days in the report.
Each unit () represents 10,000 requests for pages or part thereof.
| hour | reqs | pages | |
|---|---|---|---|
| 0 | 250039 | 90370 | |
| 1 | 116627 | 49466 | |
| 2 | 59460 | 27446 | |
| 3 | 60427 | 39031 | |
| 4 | 45650 | 26490 | |
| 5 | 48925 | 21713 | |
| 6 | 115588 | 47919 | |
| 7 | 308233 | 107654 | |
| 8 | 676814 | 220772 | |
| 9 | 934753 | 310578 | |
| 10 | 971750 | 321934 | |
| 11 | 982977 | 328751 | |
| 12 | 1115475 | 375535 | |
| 13 | 1114390 | 370335 | |
| 14 | 873434 | 295495 | |
| 15 | 926379 | 311162 | |
| 16 | 1042961 | 351643 | |
| 17 | 1111221 | 367492 | |
| 18 | 1152867 | 387119 | |
| 19 | 1143815 | 386312 | |
| 20 | 1145175 | 385387 | |
| 21 | 1054581 | 355114 | |
| 22 | 861447 | 288843 | |
| 23 | 502417 | 172288 |


Generates a random number with the gaussian distribution.
the mean value
the standard deviation
Finds the maximum value of an number array
Finds the maximum value index of an number array
Finds the minimum value of an number array
Finds the minimum value index of an number array
Pairing two numbers
A natural number, which is an integer greater than or equal to zero
A natural number, which is an integer greater than or equal to zero
An Integer that uniquely represents a pair of Integers
Returns an random element from the given array.
the array to pick from
the random picked element
Returns a random boolean
random boolean
Returns a random double in the range [min,max)
bound
bound
random double in [min,max)
Returns a random integer in the range [min,max)
bound
bound
random integer in [min,max)
Removes an element from an array.
the array
the element which will be removed
false -> element does not exists on array; true -> element removed from array
Shuffles an array
the array
the shuffled array
Calculates the sum of all values of an array
Generated using TypeDoc
Calculates the average value of an array


We are volunteers using our skills and expertise to create tech tools to help elect Hillary Clinton and other Democratic and progressive candidates. We are coders, designers, leaders, writers, mentors, and researchers. Each project we work on focuses on an app, service, data resource, or other technology to advance the cause. We are a team — join us!
Get Involved


| 013:018 Khan | : |
For those who answered their Lord's Call [believed in the Oneness of Allah and followed His Messenger Muhammad SAW i.e. Islamic Monotheism] is Al-Husna (i.e. Paradise). But those who answered not His Call (disbelieved in the Oneness of Allah and followed not His Messenger Muhammad SAW), if they had all that is in the earth together with its like, they would offer it in order to save themselves (from the torment, it will be in vain). For them there will be the terrible reckoning. Their dwelling place will be Hell; - and worst indeed is that place for rest. |
| 013:018 Maulana | : |
For those who respond to their Lord is good. And as for those who respond not to Him, even if they had all that is in the earth and the like thereof with it, they would certainly offer it for a ransom. As for those, theirs is an evil reckoning and their abode is hell; and evil is the resting-place. |
| 013:018 Pickthal | : |
For those who answered Allah's call is bliss; and for those who answered not His call, if they had all that is in the earth, and therewith the like thereof, they would proffer it as ransom. Such will have a woeful reckoning, and their habitation will be hell, a dire abode. |
| 013:018 Rashad | : |
Those who respond to their Lord deserve the good rewards. As for those who failed to respond to Him, if they possessed everything on earth - even twice as much - they would readily give it up as ransom.  Whatever those who have not answered the call of their Lord offer to redeem themselves, even if they offer double the wealth of the whole earth, will not be accepted. They will face a terrible reckoning and their dwelling will be hell, a terrible place to rest! |
| 013:018 Shakir | : |
For those who respond to their Lord is good; and (as for) those who do not respond to Him, had they all that is in the earth and the like thereof with it they would certainly offer it for a ransom. (As for) those, an evil reckoning shall be theirs and their abode is hell, and evil is the resting-place. |
| 013:018 Sherali | : |
For those who respond to their Lord is external good; and as for those who respond not to HIM, if they had all that is in the earth and the like of it added thereto, they would readily ransom themselves therewith. It is these that shall have an evil reckoning and their abode is Hell. What a wretched place of rest ! |
| 013:018 Yusufali | : |
For those who respond to their Lord, are (all) good things. But those who respond not to Him,- Even if they had all that is in the heavens and on earth, and as much more, (in vain) would they offer it for ransom. For them will the reckoning be terrible: their abode will be Hell,- what a bed of misery! |
Concepts/Themes Covered: أركان الإسلام > التوحيد > توحيد الله تعالي > الوعد والوعيد Pillars of Islam> Islamic> Oneness of Allah> Promise and Threat أركان الإسلام > التوحيد > الشرك والمشركون > تنزيه الله جلّ جلاله عن الشريك Pillars of Islam> Islamic> Polytheism and the Polytheists> Allah's Freedom from Partnership أركان الإسلام > التوحيد > الكافرون > صفات الكفار Pillars of Islam> Islamic> The Disbelievers> The Characteristics of the Disbelievers أركان الإسلام > التوحيد > المكذبون الظالمون > صفاتهم Pillars of Islam> Islamic> The Oppressive Liars> Their Characteristics الإيمان > الغيب > الجنة > أسماءالجنة > الحسنى Faith> The Unseen World> The Paradise> Paradise Names> The Kindness Paradise الإيمان > الغيب > النار > أسماء النار > بئس المهاد Faith> The Unseen World> Hell-Fire>Hell Names> Bad Flat Land الإيمان > الله جلّ جلاله > التسليم لأوامره جلّ وعلا Faith> Allah, Glory to his Majesty> The Submission to His Orders (Glory and Almighty to Him) الإيمان > المؤمنون > استجابتهم لله ورسوله Faith> The Believers> Their Response to Allah and his Messenger الإيمان > المؤمنون > سعادتهم في الدنيا والآخرة Faith> The Believers> Their Happiness in the World and the hereafter
This tool uses eight English parallel translations for the Holy Quran imported from Mr. Clay Smith. You can also visit Qurany Concepts for browsing the Quran themes or topics. If you want to search the Holy Quran for keywords, please visit Qurany Keywords.


Current summoner is not in match for now. Refresh this page when summoner is playing game.
{{participant.summonerName}} Level {{participant.summonerData.summonerLevel}}


You need min 695px screen to use this app
Give a fun look to your Github Contribution Graph
Step 1. Install Node JS on your pc
Step 2. Create an empty private repository (any name e.g) in GitHub and clone it to PC
Step 3. Download
gh_graph_magician
and extract it to
cloned repository directory
Step 4. Create pattern in the grid and set intensity from the range selector below
Step 5. Click the Generate button to download the config file
Step 6. Copy the downloaded config file to the cloned repository directory
Step 7. Finally, run the SETUP file
AND see the Magic!


---
layout: post
title: First Snow of The Year
categories: []
tags: []
status: publish
type: post
published: true
meta:
_original_post_id: ''
_original_import_author: John Duprey
author:
---
-
-
jduprey
- November 9th, 2004
We had our first snow of the year and it actually "stuck" ... kinda. While I still find myself wondering what happened to summer, autumn has all but passed and we are staring down winter. We had our first snow yesterday. It came down light and fluffy, think snow globe, and some of it actually stuck to the ground for a while. The last couple of weekends I've enjoyed the smell of dry, brightly colored leaves. Winter, it seems, is on its way.