31 #ifndef __LRSWrapper_WRAPPER__H__ 32 #define __LRSWrapper_WRAPPER__H__ 48 #include <unordered_set> 65 # define FORMAT "%4.4lu" 66 # define MAXD 2147483647L 73 # define MAXD 9223372036854775807L 74 # define BASE 1000000000L 75 # define FORMAT "%9.9lu" 83 typedef __int64 int64_t;
84 typedef unsigned __int64 uint64_t;
91 #define enumStringify(name) #name 106 template <
typename GUM_SCALAR >
110 using matrix =
typename std::vector< std::vector< GUM_SCALAR > >;
250 std::vector< int64_t >& Num,
251 std::vector< int64_t >& Den)
const;
375 void fillH(
const GUM_SCALAR& min,
const GUM_SCALAR& max,
const Size& modal);
394 void fillV(
const std::vector< GUM_SCALAR >& vertex);
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
lrs_dat * __dat
Structure for holding static problem data of lrs.
~LRSWrapper()
Default Destructor.
void V2H()
V-representation to H-representation.
void fillMatrix(const std::vector< std::vector< GUM_SCALAR > > &matrix)
Fill the H-representation from the matrix given in argument.
unsigned int __card
Cardinality of the variable.
void __coutOff() const
The function that redirects standard cout to /dev/null.
matrix __output
Output matrix - either a V-representation or an H-representation.
const GUM_SCALAR & getVolume() const
Get the volume of the polytope that has been computed.
const matrix & getInput() const
Get the intput matrix of the problem.
void __getLRSWrapperOutput(lrs_mp Nin, lrs_mp Din, std::vector< int64_t > &Num, std::vector< int64_t > &Den) const
Translate a single output from lrs.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void __initLrs()
Initialize lrs structs and first basis according to flags.
std::vector< GUM_SCALAR > __vertex
In case we have lower = upper for all modalities, a point probability, there is no need to use lrs...
typename std::vector< std::vector< GUM_SCALAR > > matrix
Shortcut for dynamic matrix using vectors.
#define enumStringify(name)
lrs_dic * __dic
Structure for holding current dictionary and indices of lrs.
void __freeLrs()
Free lrs space.
void fillV(const std::vector< GUM_SCALAR > &vertex)
Creates the V-representation of a polytope by adding a vertex to the problem input __input...
void fillH(const GUM_SCALAR &min, const GUM_SCALAR &max, const Size &modal)
Creates the H-representation of min <= p(X=modal | .) <= max and add it to the problem input __input...
__states __state
The current state of the LrsWrapper.
Class template acting as a wrapper for Lexicographic Reverse Search by David Avis.
void setUpH(const Size &card)
Sets up an H-representation.
int __oldCout
File descriptor of standard cout.
std::unordered_set< int > __insertedModals
To keep track of which constraints over modalities have been inserted.
unsigned int __vertices
The number of vertices of the polytope.
void nextHInput()
Reset the wrapper for next computation for a H-representation with the same variable cardinality and ...
void tearDown()
Reset the wrapper as if it was built.
void __coutOn() const
The function that restores standard cout.
matrix __input
Input matrix - either a V-representation or an H-representation.
const char * __setUpStateNames[5]
To print an enum field name instead of it's value.
lrs_mp_matrix __Lin
Holds lrs input linearities if any are found.
void setUpV(const Size &card, const Size &vertices)
Sets up a V-representation.
lrs_mp_vector __lrsOutput
One line of output of lrs : aither a ray, a vertex, a facet or a linearity.
void H2V()
H-representation to V-representation.
GUM_SCALAR __volume
The volume of the polytope, if computed, 0 otherwise.
void elimRedundVrep()
V-Redundancy elimination.
__states
The possible states of the LrsWrapper.
void __fill() const
Fill lrs_dictionnary and datas from __input using integer rationals.
const matrix & getOutput() const
Get the output matrix solution of the problem.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
LRSWrapper()
Default Constructor.
void computeVolume()
Computes a polytope ( pseudo ) volume from it's V-representation.
std::vector< std::vector< GUM_SCALAR > > __insertedVertices
To keep track of inserted vertices and total.
const unsigned int & getVerticesNumber() const
Get the number of vertices of this polytope.