placo::problem#

class placo.Expression#
A: any#

None( (placo.Expression)arg1) -> object :

C++ signature :

Eigen::Matrix<double, -1, -1, 0, -1, -1> {lvalue} None(placo::problem::Expression {lvalue})

b: any#

None( (placo.Expression)arg1) -> object :

C++ signature :

Eigen::Matrix<double, -1, 1, 0, -1, 1> {lvalue} None(placo::problem::Expression {lvalue})

cols() int#

Number of cols in A.

static from_double(self, value: float) Expression#

Builds an expression from a double (A will be zero, the expression is only one row)

Parameters:

value (float) – value

static from_vector(self, v: ndarray) Expression#

Builds an expression from a vector (A will be zeros)

Parameters:

v (numpy.ndarray) – vector

is_constant() bool#

checks if the expression is constant (doesn’t depend on decision variables)

is_scalar() bool#

checks if the expression is a scalar

left_multiply(M: ndarray) Expression#

Multiply an expression on the left by a given matrix M.

Parameters:

M (numpy.ndarray) – matrix

mean() Expression#

Reduces a multi-rows expression to the mean of its items.

piecewise_add(f: float) Expression#

Adds the expression element by element to another expression.

rows() int#

Number of rows in A.

slice(start: int, rows: int = -1) Expression#

Slice rows from a given expression.

Parameters:
  • start (int) – start row

  • rows (int) – number of rows (default: -1, all rows)

sum() Expression#

Reduces a multi-rows expression to the sum of its items.

value(x: ndarray) ndarray#

Retrieve the expression value, given a decision variable. This can be used after a problem is solved to retrieve a specific expression value.

class placo.Integrator#

Integrator can be used to efficiently build expressions and values over a decision variable that is integrated over time with a given linear system.

A: any#

None( (placo.Integrator)arg1) -> object :

C++ signature :

Eigen::Matrix<double, -1, -1, 0, -1, -1> {lvalue} None(placo::problem::Integrator {lvalue})

B: any#

None( (placo.Integrator)arg1) -> object :

C++ signature :

Eigen::Matrix<double, -1, -1, 0, -1, -1> {lvalue} None(placo::problem::Integrator {lvalue})

M: any#

None( (placo.Integrator)arg1) -> object :

C++ signature :

Eigen::Matrix<double, -1, -1, 0, -1, -1> {lvalue} None(placo::problem::Integrator {lvalue})

expr(step: int, diff: int = -1) Expression#

Builds an expression for the given step and differentiation.

Parameters:
  • step (int) – the step, (if -1 the last step will be used)

  • diff (int) – differentiation (if -1, the expression will be a vector of size order with all orders)

expr_t(t: float, diff: int = -1) Expression#

Builds an expression for the given time and differentiation.

Parameters:
  • t (float) – the time

  • diff (int) – differentiation (if -1, the expression will be a vector of size order with all orders)

final_transition_matrix: any#

None( (placo.Integrator)arg1) -> object :

C++ signature :

Eigen::Matrix<double, -1, -1, 0, -1, -1> {lvalue} None(placo::problem::Integrator {lvalue})

get_trajectory() IntegratorTrajectory#

Retrieve a trajectory after a solve.

t_start: any#

None( (placo.Integrator)arg1) -> float :

C++ signature :

double {lvalue} None(placo::problem::Integrator {lvalue})

static upper_shift_matrix(self, order: int) ndarray#

Builds a matrix M so that the system differential equation is dX = M X.

value(t: float, diff: int) float#

Computes.

class placo.IntegratorTrajectory#
duration() float#

Trajectory duration.

value(t: float, diff: int) float#

Gets the value of the trajectory at a given time and differentiation.

Parameters:
  • t (float) – time

  • diff (int) – differentiation

class placo.PolygonConstraint#
static in_polygon(self, expression_x: Expression, expression_y: Expression, polygon: list[ndarray], margin: float = 0.0) ProblemConstraint#
static in_polygon_xy(self, expression_xy: Expression, polygon: list[ndarray], margin: float = 0.0) ProblemConstraint#

Given a polygon, produces inequalities so that the given point lies inside the polygon. WARNING: Polygon must be clockwise (meaning that the exterior of the shape is on the trigonometric normal of the vertices)

class placo.Problem#
add_constraint(constraint: ProblemConstraint) ProblemConstraint#

Adds a given constraint to the problem.

add_limit(expression: Expression, target: ndarray) ProblemConstraint#

Adds a limit, “absolute” inequality constraint (abs(Ax + b) <= t)

add_variable(size: int = 1) Variable#

Adds a n-dimensional variable to a problem.

Parameters:

size (int) – dimension of the variable

clear_constraints() None#

Clear all the constraints.

clear_variables() None#

Clear all the variables.

determined_variables: any#

None( (placo.Problem)arg1) -> int :

C++ signature :

int {lvalue} None(placo::problem::Problem {lvalue})

dump_status() None#
free_variables: any#

None( (placo.Problem)arg1) -> int :

C++ signature :

int {lvalue} None(placo::problem::Problem {lvalue})

n_equalities: any#

None( (placo.Problem)arg1) -> int :

C++ signature :

int {lvalue} None(placo::problem::Problem {lvalue})

n_inequalities: any#

None( (placo.Problem)arg1) -> int :

C++ signature :

int {lvalue} None(placo::problem::Problem {lvalue})

n_variables: any#

None( (placo.Problem)arg1) -> int :

C++ signature :

int {lvalue} None(placo::problem::Problem {lvalue})

regularization: any#

None( (placo.Problem)arg1) -> float :

C++ signature :

double {lvalue} None(placo::problem::Problem {lvalue})

rewrite_equalities: any#

None( (placo.Problem)arg1) -> bool :

C++ signature :

bool {lvalue} None(placo::problem::Problem {lvalue})

slack_variables: any#

None( (placo.Problem)arg1) -> int :

C++ signature :

int {lvalue} None(placo::problem::Problem {lvalue})

slacks: any#

None( (placo.Problem)arg1) -> numpy.ndarray :

C++ signature :

Eigen::Matrix<double, -1, 1, 0, -1, 1> None(placo::problem::Problem)

solve() None#

Solves the problem, raises QPError in case of failure.

use_sparsity: any#

None( (placo.Problem)arg1) -> bool :

C++ signature :

bool {lvalue} None(placo::problem::Problem {lvalue})

x: any#

None( (placo.Problem)arg1) -> object :

C++ signature :

Eigen::Matrix<double, -1, 1, 0, -1, 1> {lvalue} None(placo::problem::Problem {lvalue})

class placo.ProblemConstraint#

Represents a constraint to be enforced by a Problem.

configure(type: str, weight: float = 1.0) None#

Configures the constraint.

Parameters:

weight (float) – weight

expression: any#

None( (placo.ProblemConstraint)arg1) -> object :

C++ signature :

placo::problem::Expression {lvalue} None(placo::problem::ProblemConstraint {lvalue})

is_active: any#

None( (placo.ProblemConstraint)arg1) -> bool :

C++ signature :

bool {lvalue} None(placo::problem::ProblemConstraint {lvalue})

priority: any#

None( (placo.ProblemConstraint)arg1) -> str :

C++ signature :

char const* None(placo::problem::ProblemConstraint)

weight: any#

None( (placo.ProblemConstraint)arg1) -> float :

C++ signature :

double {lvalue} None(placo::problem::ProblemConstraint {lvalue})

class placo.ProblemPolynom(variable: Variable)#
expr(x: float, derivative: int = 0) Expression#

Builds a problem expression for the value of the polynom.

Parameters:
  • x (float) – abscissa

  • derivative (int) – differentiation order (0: p, 1: p’, 2: p’’ etc.)

get_polynom() Polynom#

Obtain resulting polynom (after problem is solved)

class placo.QPError(message: str = '')#

Exception raised by Problem in case of failure.

what() str#
class placo.Sparsity#
add_interval(start: int, end: int) None#

Adds an interval to the sparsity, this will compute the union of intervals.

Parameters:
  • start (int) – interval start

  • end (int) – interval end

static detect_columns_sparsity(self, M: ndarray) Sparsity#

Helper to detect columns sparsity.

Parameters:

M (numpy.ndarray) – given matrix

intervals: any#

None( (placo.Sparsity)arg1) -> numpy.ndarray :

C++ signature :

Eigen::Matrix<int, -1, -1, 0, -1, -1> None(placo::problem::Sparsity)

print_intervals() None#

Print intervals.

class placo.SparsityInterval#
end: any#

None( (placo.SparsityInterval)arg1) -> int :

C++ signature :

int {lvalue} None(placo::problem::Sparsity::Interval {lvalue})

start: any#

None( (placo.SparsityInterval)arg1) -> int :

C++ signature :

int {lvalue} None(placo::problem::Sparsity::Interval {lvalue})

class placo.Variable#

Represents a variable in a Problem.

expr(start: int = -1, rows: int = -1) Expression#

Builds an expression from a variable.

Parameters:
  • start (int) – start row (default: 0)

  • rows (int) – number of rows (default: -1, all rows)

k_end: any#

None( (placo.Variable)arg1) -> int :

C++ signature :

int {lvalue} None(placo::problem::Variable {lvalue})

k_start: any#

None( (placo.Variable)arg1) -> int :

C++ signature :

int {lvalue} None(placo::problem::Variable {lvalue})

value: any#

None( (placo.Variable)arg1) -> object :

C++ signature :

Eigen::Matrix<double, -1, 1, 0, -1, 1> {lvalue} None(placo::problem::Variable {lvalue})