wmpy.optimization.scipyoptimizer.ScipyOptimizer

class ScipyOptimizer(epsilon=0.01)[source]

Bases: object

Default constructor.

Parameters:

epsilon (float) – small float constant used to enforce strict inequality constraints

Methods

compute_inner_box

Returns the largest axis-aligned hyperrectangle fully enclosed in the polytope by solving the convex optimization problem on 2N variables described here:

compute_outer_box

Returns the smallest axis-aligned hyperrectangle fully enclosing the polytope by making 2N calls to an LP solver.

optimize

Solves the constrained optimization problem where:

compute_inner_box(polytope)[source]

Returns the largest axis-aligned hyperrectangle fully enclosed in the polytope by solving the convex optimization problem on 2N variables described here:

The result is stored for future uses.

Parameters:

polytope (Polytope) – the Polytope instance

Return type:

tuple[ndarray, ndarray]

Returns:

Two numpy arrays corresponding to the extremes of the box.

compute_outer_box(polytope)[source]

Returns the smallest axis-aligned hyperrectangle fully enclosing the polytope by making 2N calls to an LP solver.

The result is stored for future uses.

Parameters:

polytope (Polytope) – the Polytope instance

Return type:

tuple[ndarray, ndarray]

Returns:

Two numpy arrays corresponding to the extremes of the box.

optimize(polytope, polynomial, maximize=True)[source]

Solves the constrained optimization problem where:

  • polynomial is the objective function

  • polytope is the convex domain

Either polynomial is maximized (default) or minimized.

Parameters:
  • polytope (Polytope) – convex integration bounds

  • polynomial (Polynomial) – the objective function

  • maximize (bool) – Boolean flag (optional, def: True)

Return type:

ndarray

Returns:

A numpy array corresponding to the arg{max/min}.