Polytopesimplifier

class ConvexProgram(Aeq, beq, c, df, ddf, barrier)[source]

Convex Program is given by min <c,x> + sum f_i(x_i) subject Ax = b, x_i in K_i given that such block K_i is a strictly convex set

A[source]

constraint matrix A

ConvexProgram(Aeq, beq, c, df, ddf, barrier)[source]

o = ConvexProgram(Aeq, beq, c, df, ddf, barrier) Output a ConvexProgram representing the linear program min <c,x> + sum f_i(x_i) subject Aeq x = beq, barrier(x) < inf

static LinearProgram(Aeq, beq, c, lb, ub)[source]

o = LinearProgram(Aeq, beq, c, lb, ub) Output a ConvexProgram representing the linear program min <c,x> subject Aeq x = beq, lb <= x <= ub

b[source]

constraint vector b

barrier[source]

barrier for prod K_i

c[source]

cost vector c

collapse(x, blocks)[source]

Collapse the domain on the blocks to boundaries closest to x Return okay = 1 if the collapse is successful Return okay = 0 if the rows are not inconsistenc (infeasible).

ddf[source]

second derivative of cost function

df[source]

first derivative of cost function

distance(o, x, v)[source]

t = o.distance(x) Output the distance of x with its closest boundary for each block Any negative entries implies infeasible

t = o.distance(x, v) Output the maximum step from x with direction v for each coordinate (The maximum step may not reach the boundary.)

export(o, x)[source]

z = o.export(x) Output x in the original coordinate system

feasible[source]

indicate if the domain is empty, [] means not determined

findInterior(o)[source]

x = o.findInterior() Find an interior point of the convex set using analytic center return NaN if the set is empty

idx[source]

original coordinates that x supported on

interior[source]

some interior point we found

normalize(o)[source]

x = o.normalize()

removeRedundantRows()[source]

Remove redundant rows from Ax=b Return 1 if the removal is successful Return 0 if the rows are not inconsistenc (infeasible).

rescale()[source]

Rescale rows to improve numerical stability

rowReorder()[source]

Reorder rows to speed up sparse cholesky

scale[source]

scale of x.

scale2[source]

scale.^2

solver[source]

Linear system solver used to solve (A W A’)^-1

x0[source]

We represent any z in the domain implicitly by x as follows: z = x0; z(idx) += scale.*x;

class TwoSidedBarrier(lb, ub, vdim)[source]

The log barrier for the domain {lu <= x <= ub}: phi(x) = - sum log(x - lb) - sum log(ub - x).

TwoSidedBarrier(lb, ub, vdim)[source]

o.update(lb, ub) Update the bounds lb and ub.

boundary(o, x)[source]

[A, b] = o.boundary(x) Output the normal at the boundary around x for each barrier. Assume: only 1 vector is given

boundary_distance(o, x)[source]

v = o.boundary_distance(x) Output the distance of x with its closest boundary for each coordinate

center[source]

Some feasible point x

extraHessian[source]

Extra factor added when computing Hessian. Used to handle free constraints.

feasible(o, x)[source]

r = o.feasible(x) Output if x is feasible.

freeIdx[source]

Indices that ub == Inf and lb == -Inf

gradient(o, x)[source]

g = o.gradient(x) Output gradient phi(x).

hessian(o, x)[source]

g = o.hessian(x) Output Hessian phi(x).

hessian_norm(o, x, d)[source]

v = o.hessian_norm(x, d) Output d_i (hess phi(x))_ii d_i for each i

lb[source]

lb

logdet_gradient(o, x)[source]

v = o.logdet_gradient(x) Output the gradient of log det (hess phi(x)) which is (hess phi(x))^-1 (grad hess phi (x))

lowerIdx[source]

Indices that ub == Inf

n[source]

Number of variables

quadratic_form_gradient(o, x, u)[source]

v = o.quadratic_form_gradient(x, u) Output the -grad of u’ (hess phi(x)) u.

set_bound(lb, ub)[source]

Update the bounds lb and ub.

set_vdim(o, vdim)[source]

o.set_bound(lb, ub) Update the dimension dim.

step_size(o, x, v)[source]

t = o.stepsize(x, v) Output the maximum step size from x with direction v.

tensor(o, x)[source]

g = o.tensor(x) Output the third derivative of phi(x).

ub[source]

ub

upperIdx[source]

Indices that lb == -Inf

vdim[source]

Each point is stored along the dimension vdim

analyticCenter(f, x, opts)[source]

x = analyticCenter(f, opts, x) compute the analytic center for the domain {Ax=b} intersect the domain of f

Input
  • f - a ConvexProgram

  • x - a feasible initial point (optional)

  • opts - a structure for options with the following properties (optional) – MaxIter - maximum number of iterations Output - maximum number of iterations CentralityTol, FeasibilityTol - stop the following are satisfied

    ||(A’ * lambda - grad f(x)) / sqrt(hess)||_inf < CentralityTol ||A x - b||_inf < FeasibilityTol

    CollapseDistanceTol -

    if x_i is CollapseDistanceTol close to some boundary, we assume the block i is tight.

    SolverIter - the number of iteration in solving linear systems VectorType - the class we use for x (@double, @ddouble, @qdouble)

Output
  • x - It outputs the analytic center of f

  • info - a structure containing centrality, feasibility and iter.

  • f - the problem f will be modified as we discover collapsed subspace

demo[source]

it outputs NaN if the problem is infeasible.

lewisCenter(f, x, opts)[source]

x = LewisCenter(f, opts, x) compute the analytic center for the domain {Ax=b} intersect the domain of f

Input
  • f - a ConvexProgram

  • x - a feasible initial point

  • opts - a structure for options with the following properties (optional) – MaxIter - maximum number of iterations Output - maximum number of iterations CentralityTol, FeasibilityTol - stop the following are satisfied

    ||(A’ * lambda - grad f(x)) / sqrt(hess)||_inf < CentralityTol ||A x - b||_inf < FeasibilityTol

    p - the parameter for lp Lewis weight JLDim - the number of dimensions used in estimating leverage score

Output
  • x - It outputs the analytic center of f

  • info - a structure containing centrality, feasibility and iter.