Prerequisits

#include <lrs_interface.h>
    

Introduction

class lrs_interface::solver;
An interface to the lrslib library, implementing the main LP and convex hull computations with exact arithmetic.
This class and all related types are defined in the namespace lrs_interface. The namespace prefix is omitted in the descriptions below for the sake of compactness; you must nevertheless specify it explicitly in your applications, or import it with the using namespace directive.
solver();
Create an instance of the interface class. It contains only global internal data shared by all LP problems, so you will not usually need multiple instances of solver in your program. Nor they would disturb each other.
typedef std::pair< Matrix <Rational>, Matrix<Rational> > matrix_pair;
matrix_pair solver::enumerate_facets (const Matrix<Rational>& Points)
throw(infeasible);
Find the convex hull of the given point set. Points must contain homogeneous coordinates of the points; the elements in the first column must be 1 for affine points and 0 for rays.
Returns the facet normals in first, and the basis of the subspace orthogonal to Points in second.
Matrix<Rational> solver::enumerate_vertices (const Matrix<Rational>& Inequalities, const Matrix<Rational>& Equations)
throw(infeasible, not_pointed);
Dual convex hull problem: find the vertices of a polyhedron given as an intersection of halfspaces (Inequalities∗X>=0) and hyperplanes (Equations∗=0).
Returns the homogeneous coordinates of the vertices.
std::pair< Bitset, Matrix<Rational> > solver::find_vertices_among_points (const Matrix<Rational>& Points)
throw(infeasible);
Separate the extremal vertices from the redundant points in a given point set. Points must contain homogeneous coordinates. This operation is cheaper than the complete convex hull computation, as it is based on repeating LP solving.
Returns the vertex indices in first, and the basis of the subspace orthogonal to Points in second.
Vector<Rational> solver::find_a_vertex (const Matrix<Rational>& Inequalities, const Matrix<Rational>& Equations)
throw(infeasible, not_pointed);
Find an arbitrary vertex for which Inequalities∗X>=0 and Equations∗=0 hold. Returns the homogeneous coordinates.
typedef std::pair< bool, Vector<Rational> > feasibility_solution;
feasibility_solution solver::check_feasibility (const Matrix<Rational>& Inequalities, const Matrix<Rational>& Equations);
The same as above, but the infeasible case is reported using the boolean first member of the return value, instead of raising an exception.
typedef std::pair< Rational, Vector<Rational> > lp_solution;
lp_solution solver::solve_lp (const Matrix<Rational>& Inequalities, const Matrix<Rational>& Equations, const Vector<Rational>& Objective, bool maximize)
throw(infeasible, unbounded);
Solve the linear programming problem Objective∗Xmax (min if maximize==false) subject to Inequalities∗X>=0 and Equations∗X=0.
Returns the objective function value in first, the extremal vertex in second.