aGrUM  0.13.2
gum::credal::LRSWrapper< GUM_SCALAR > Class Template Reference

Class template acting as a wrapper for Lexicographic Reverse Search by David Avis. More...

#include <agrum/CN/LrsWrapper.h>

+ Collaboration diagram for gum::credal::LRSWrapper< GUM_SCALAR >:

Public Member Functions

Constructors / Destructors
 LRSWrapper ()
 Default Constructor. More...
 
 ~LRSWrapper ()
 Default Destructor. More...
 
Getters and setters
const matrixgetInput () const
 Get the intput matrix of the problem. More...
 
const matrixgetOutput () const
 Get the output matrix solution of the problem. More...
 
const unsigned int & getVerticesNumber () const
 Get the number of vertices of this polytope. More...
 
const GUM_SCALAR & getVolume () const
 Get the volume of the polytope that has been computed. More...
 
setUp / tearDown
void setUpH (const unsigned int &card)
 Sets up an H-representation. More...
 
void setUpV (const unsigned int &card, const unsigned int &vertices)
 Sets up a V-representation. More...
 
void tearDown ()
 Reset the wrapper as if it was built. More...
 
void nextHInput ()
 Reset the wrapper for next computation for a H-representation with the same variable cardinality and number of inequalities. More...
 
Input filling methods
void fillH (const GUM_SCALAR &min, const GUM_SCALAR &max, const unsigned int &modal)
 Creates the H-representation of min <= p(X=modal | .) <= max and add it to the problem input __input. More...
 
void fillMatrix (const std::vector< std::vector< GUM_SCALAR > > &matrix)
 Fill the H-representation from the matrix given in argument. More...
 
void fillV (const std::vector< GUM_SCALAR > &vertex)
 Creates the V-representation of a polytope by adding a vertex to the problem input __input. More...
 
lrs algorithms
void H2V ()
 H-representation to V-representation. More...
 
void V2H ()
 V-representation to H-representation. More...
 
void computeVolume ()
 Computes a polytope ( pseudo ) volume from it's V-representation. More...
 
void elimRedundVrep ()
 V-Redundancy elimination. More...
 

Detailed Description

template<typename GUM_SCALAR>
class gum::credal::LRSWrapper< GUM_SCALAR >

Class template acting as a wrapper for Lexicographic Reverse Search by David Avis.

Template Parameters
GUM_SCALARA floating type ( float, double, long double ... ).
Author
Matthieu HOURBRACQ and Pierre-Henri WUILLEMIN

Definition at line 104 of file LrsWrapper.h.

Member Typedef Documentation

template<typename GUM_SCALAR>
using gum::credal::LRSWrapper< GUM_SCALAR >::matrix = typename std::vector< std::vector< GUM_SCALAR > >
private

Shortcut for dynamic matrix using vectors.

Definition at line 107 of file LrsWrapper.h.

Member Enumeration Documentation

template<typename GUM_SCALAR>
enum gum::credal::LRSWrapper::__states : char
strongprivate

The possible states of the LrsWrapper.

Some functions will throw an exception if the state is not correct. It allows the user to avoid making - invisible - mistakes.

Enumerator
none 
Hup 
Vup 
H2Vready 
V2Hready 

Definition at line 141 of file LrsWrapper.h.

141  : char {
142  none = char(0),
143  Hup = char(1),
144  Vup = char(2),
145  H2Vready = char(3),
146  V2Hready = char(4),
147  };

Constructor & Destructor Documentation

template<typename GUM_SCALAR >
gum::credal::LRSWrapper< GUM_SCALAR >::LRSWrapper ( )

Default Constructor.

Definition at line 32 of file LrsWrapper_tpl.h.

32  {
34 
35  __vertices = 0;
36  __card = 0;
37 
38  __volume = 0;
39 
40  __getVolume = false;
41  __hull = false;
42  __polytope = false;
43 
44  GUM_CONSTRUCTOR(LRSWrapper);
45  }
unsigned int __card
Cardinality of the variable.
Definition: LrsWrapper.h:118
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
unsigned int __vertices
The number of vertices of the polytope.
Definition: LrsWrapper.h:125
GUM_SCALAR __volume
The volume of the polytope, if computed, 0 otherwise.
Definition: LrsWrapper.h:153
LRSWrapper()
Default Constructor.
template<typename GUM_SCALAR >
gum::credal::LRSWrapper< GUM_SCALAR >::~LRSWrapper ( )

Default Destructor.

Definition at line 48 of file LrsWrapper_tpl.h.

48  {
49  GUM_DESTRUCTOR(LRSWrapper);
50  }
LRSWrapper()
Default Constructor.

Member Function Documentation

template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::__coutOff ( ) const
private

The function that redirects standard cout to /dev/null.

Definition at line 721 of file LrsWrapper_tpl.h.

721  {
722  fflush(stdout);
723 #ifdef _MSC_VER
724  freopen("NUL", "w", stdout);
725 #else // _MSC_VER
726  __oldCout = dup(1);
727 
728  int new_cout = open("/dev/null", O_WRONLY);
729  dup2(new_cout, 1);
730  close(new_cout);
731 #endif // _MSC_VER
732  }
int __oldCout
File descriptor of standard cout.
Definition: LrsWrapper.h:173
template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::__coutOn ( ) const
private

The function that restores standard cout.

Definition at line 735 of file LrsWrapper_tpl.h.

735  {
736  fflush(stdout);
737 #ifdef _MSC_VER
738  freopen("CON", "w", stdout);
739 #else // _MSC_VER
740  dup2(__oldCout, 1);
741  close(__oldCout);
742 #endif // _MSC_VER
743  }
int __oldCout
File descriptor of standard cout.
Definition: LrsWrapper.h:173
template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::__fill ( ) const
private

Fill lrs_dictionnary and datas from __input using integer rationals.

Build polyhedron constraints and objective. Rational< GUM_SCALAR >::continuedFrac is the default algorithm used to approximate reals by integer rationals.

Definition at line 561 of file LrsWrapper_tpl.h.

References gum::Rational< GUM_SCALAR >::continuedFracFirst().

561  {
562  int64_t cols = int64_t(__input[0].size());
563 
564  int64_t* num = new int64_t[cols]; // ISO C++ forbids variable length array,
565  // we need to do this instead
566  int64_t* den = new int64_t[cols];
567 
568  int64_t rows = int64_t(__input.size());
569 
570  int64_t numerator, denominator;
571 
572  for (int64_t row = 0; row < rows; row++) {
573  for (int64_t col = 0; col < cols; col++) {
575  numerator, denominator, __input[row][col]);
576 
577  num[col] = numerator;
578  den[col] = denominator;
579  }
580 
581  /* GE is inequality, EQ is equation */
582  /* 1L, 0L respectively */
583  lrs_set_row(__dic,
584  __dat,
585  row + 1,
586  num,
587  den,
588  1L); // do NOT forget this + 1 on row
589  }
590 
591  delete[] num;
592  delete[] den;
593  }
lrs_dat * __dat
Structure for holding static problem data of lrs.
Definition: LrsWrapper.h:182
lrs_dic * __dic
Structure for holding current dictionary and indices of lrs.
Definition: LrsWrapper.h:179
static void continuedFracFirst(int64_t &numerator, int64_t &denominator, const GUM_SCALAR &number, const double &zero=1e-6)
Find the first best rational approximation.
Definition: rational_tpl.h:93
matrix __input
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:111

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::__freeLrs ( )
private

Free lrs space.

Definition at line 692 of file LrsWrapper_tpl.h.

692  {
693  /* free space : do not change order of next lines! */
694 
695  lrs_clear_mp_vector(__lrsOutput, __dat->n);
696 
697  if (__dat->nredundcol > 0)
698  lrs_clear_mp_matrix(__Lin, __dat->nredundcol, __dat->n);
699 
700  if (__dat->runs > 0) {
701  free(__dat->isave);
702  free(__dat->jsave);
703  }
704 
705  auto savem = __dic->m; /* need this to clear __dat*/
706 
707  lrs_free_dic(__dic, __dat); /* deallocate lrs_dic */
708 
709  __dat->m = savem;
710  lrs_free_dat(__dat);
711 
712  std::string name = "LrsWrapper:";
713  std::vector< char > chars(name.c_str(), name.c_str() + name.size() + 1u);
714 
715  lrs_close(&chars[0]);
716 
717  // __coutOn();
718  }
lrs_dat * __dat
Structure for holding static problem data of lrs.
Definition: LrsWrapper.h:182
lrs_dic * __dic
Structure for holding current dictionary and indices of lrs.
Definition: LrsWrapper.h:179
lrs_mp_matrix __Lin
Holds lrs input linearities if any are found.
Definition: LrsWrapper.h:190
lrs_mp_vector __lrsOutput
One line of output of lrs : aither a ray, a vertex, a facet or a linearity.
Definition: LrsWrapper.h:187
template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::__getLRSWrapperOutput ( lrs_mp  Nin,
lrs_mp  Din,
std::vector< int64_t > &  Num,
std::vector< int64_t > &  Den 
) const
private

Translate a single output from lrs.

Only vertices are supposed to be read at this step.

Parameters
NinInput numerators in mp format (returned by lrs).
DinInput denominators in mp format (returned by lrs).
NumOutput integer numerators.
DenOutput integer denominators.

Definition at line 502 of file LrsWrapper_tpl.h.

References BASE.

506  {
507  int64_t Nsize = (Nin[0] > 0) ? Nin[0] : -Nin[0];
508  int64_t Dsize = (Din[0] > 0) ? Din[0] : -Din[0];
509 
510  int64_t num = 0L;
511  int64_t den = 0L;
512 
513  int64_t tmp;
514 
515  for (decltype(Nsize) i = Nsize - 1; i > 0; i--) {
516  tmp = Nin[i];
517 
518  for (decltype(i) j = 1; j < i; j++)
519  tmp *= BASE;
520 
521  num += tmp;
522  }
523 
524  if (!(Din[0] == 2L && Din[1] == 1L)) { /* rational */
525  for (decltype(Dsize) i = Dsize - 1; i > 0; i--) {
526  tmp = Din[i];
527 
528  for (decltype(i) j = 1; j < i; j++)
529  tmp *= BASE;
530 
531  den += tmp;
532  }
533  } else {
534  den = 1L;
535  }
536 
537  int64_t Nsign = ((Nin[0] < 0) ? -1L : 1L);
538  int64_t Dsign = ((Din[0] < 0) ? -1L : 1L);
539 
540  if ((Nsign * Dsign) == -1L) num = -num;
541 
542  Num.push_back(num);
543  Den.push_back(den);
544  }
#define BASE
Definition: LrsWrapper.h:71
template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::__initLrs ( )
private

Initialize lrs structs and first basis according to flags.

Definition at line 596 of file LrsWrapper_tpl.h.

References GUM_ERROR.

596  {
598  GUM_ERROR(OperationNotAllowed,
599  "LRSWrapper< GUM_SCALAR >::__initLrs : not ready, current state "
600  "is still : "
601  << __setUpStateNames[static_cast< int >(__state)]);
602 
603  //__coutOff();
604 
605  std::string name = "\n*LrsWrapper:";
606  std::vector< char > chars(name.c_str(), name.c_str() + name.size() + 1u);
607  // use &chars[0] as a char*
608 
609  if (!lrs_init(&chars[0])) {
610  // __coutOn();
611  GUM_ERROR(FatalError,
612  "LRSWrapper< GUM_SCALAR >::__initLrs : failed lrs_init");
613  }
614 
615  name = "LRSWrapper globals";
616  chars = std::vector< char >(name.c_str(), name.c_str() + name.size() + 1u);
617 
618  __dat = lrs_alloc_dat(&chars[0]);
619 
620  if (__dat == nullptr) {
621  // __coutOn();
622  GUM_ERROR(FatalError,
623  "LRSWrapper< GUM_SCALAR >::__initLrs : failed lrs_alloc_dat");
624  }
625 
626  __dat->n = Size(__input[0].size());
627  __dat->m = Size(__input.size());
628 
629  __dat->getvolume = (__getVolume) ? 1L : 0L;
630  __dat->hull = (__hull) ? 1L : 0L;
631  __dat->polytope = (__polytope) ? 1L : 0L;
632 
633  __lrsOutput = lrs_alloc_mp_vector(__dat->n);
634 
635  __dic = lrs_alloc_dic(__dat);
636 
637  if (__dic == nullptr) {
638  // __coutOn();
639  GUM_ERROR(FatalError,
640  "LRSWrapper< GUM_SCALAR >::__initLrs : failed lrs_alloc_dic");
641  }
642 
643  __fill();
644 
645  /* Pivot to a starting dictionary */
646  if (!lrs_getfirstbasis(&__dic, __dat, &__Lin, 0L)) {
647  // __coutOn();
648  GUM_ERROR(
649  FatalError,
650  "LRSWrapper< GUM_SCALAR >::__initLrs : failed lrs_getfirstbasis");
651  }
652 
653  /* There may have been column redundancy */
654  /* If so the linearity space is obtained and redundant */
655  /* columns are removed. User can access linearity space */
656  /* from lrs_mp_matrix Lin dimensions nredundcol x d+1 */
657 
658  decltype(__dat->nredundcol) startcol = 0;
659 
660  if (__dat->homogeneous && __dat->hull) {
661  startcol++; /* col zero not treated as redundant */
662 
663  if (!__dat->restart) {
664  // __coutOn();
665 
666  for (decltype(__dat->nredundcol) col = startcol; col < __dat->nredundcol;
667  col++)
668  lrs_printoutput(__dat, __Lin[col]);
669 
670  GUM_ERROR(FatalError,
671  "LRSWrapper< GUM_SCALAR >::__initLrs : redundant columns !");
672  }
673  }
674  /*
675  if ( __dat->nredundcol > 0 ) {
676  __coutOn();
677 
678  for ( decltype( __dat->nredundcol ) col = 0, end =
679  __dat->nredundcol;
680  col < end;
681  col++ )
682  lrs_printoutput( __dat, __Lin[col] );
683 
684  GUM_ERROR(
685  FatalError,
686  "LRSWrapper< GUM_SCALAR >::__initLrs : redundant columns !" );
687  }
688  */
689  }
unsigned long Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:50
lrs_dat * __dat
Structure for holding static problem data of lrs.
Definition: LrsWrapper.h:182
lrs_dic * __dic
Structure for holding current dictionary and indices of lrs.
Definition: LrsWrapper.h:179
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
matrix __input
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:111
const char * __setUpStateNames[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:157
void __fill() const
Fill lrs_dictionnary and datas from __input using integer rationals.
lrs_mp_matrix __Lin
Holds lrs input linearities if any are found.
Definition: LrsWrapper.h:190
lrs_mp_vector __lrsOutput
One line of output of lrs : aither a ray, a vertex, a facet or a linearity.
Definition: LrsWrapper.h:187
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::computeVolume ( )

Computes a polytope ( pseudo ) volume from it's V-representation.

Warning
Volume can only be computed using V-representation. H-representation volume computation is not predictable.
Probabilistic polytopes are not full dimensional : they lie in the simplex' hyper plane, therefor a pseudo-volume will be computed by projecting the polytope. The projection used is the lexicographically smallest coordinate subspace.

Definition at line 370 of file LrsWrapper_tpl.h.

References BASE, and GUM_ERROR.

370  {
371  if (!__state == __states::V2Hready)
372  GUM_ERROR(OperationNotAllowed,
373  "LRSWrapper< GUM_SCALAR >::computeVolume : "
374  "volume is only for V-representation or "
375  "fillV has not been called with all "
376  "vertices, current state is still : "
378 
379  // __coutOff();
380 
381  __getVolume = true;
382 
383  __initLrs();
384 
385  do {
386  for (decltype(__dic->d) col = 0, end = __dic->d; col <= end; col++)
387  lrs_getsolution(__dic, __dat, __lrsOutput, col);
388  } while (lrs_getnextbasis(&__dic, __dat, 0L));
389 
390  int64_t Nsize =
391  (__dat->Nvolume[0] > 0) ? __dat->Nvolume[0] : -__dat->Nvolume[0];
392  int64_t Dsize =
393  (__dat->Dvolume[0] > 0) ? __dat->Dvolume[0] : -__dat->Dvolume[0];
394 
395  int64_t num = 0L, den = 0L;
396  int64_t tmp;
397 
398  for (decltype(Nsize) i = Nsize - 1; i > 0; i--) {
399  tmp = __dat->Nvolume[i];
400 
401  for (decltype(i) j = 1; j < i; j++)
402  tmp *= BASE;
403 
404  num += tmp;
405  }
406 
407  for (decltype(Dsize) i = Dsize - 1; i > 0; i--) {
408  tmp = __dat->Dvolume[i];
409 
410  for (decltype(i) j = 1; j < i; j++)
411  tmp *= BASE;
412 
413  den += tmp;
414  }
415 
416  __volume = num * 1.0 / den;
417 
418  __freeLrs();
419 
420  // __coutOn();
421  }
lrs_dat * __dat
Structure for holding static problem data of lrs.
Definition: LrsWrapper.h:182
#define BASE
Definition: LrsWrapper.h:71
void __initLrs()
Initialize lrs structs and first basis according to flags.
lrs_dic * __dic
Structure for holding current dictionary and indices of lrs.
Definition: LrsWrapper.h:179
void __freeLrs()
Free lrs space.
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
const char * __setUpStateNames[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:157
lrs_mp_vector __lrsOutput
One line of output of lrs : aither a ray, a vertex, a facet or a linearity.
Definition: LrsWrapper.h:187
GUM_SCALAR __volume
The volume of the polytope, if computed, 0 otherwise.
Definition: LrsWrapper.h:153
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::elimRedundVrep ( )

V-Redundancy elimination.

Eliminates redundant vertices from a polytope V-representation input __input.

Definition at line 424 of file LrsWrapper_tpl.h.

References GUM_ERROR.

Referenced by gum::credal::InferenceEngine< GUM_SCALAR >::_updateCredalSets().

424  {
426  GUM_ERROR(
427  OperationNotAllowed,
428  "LRSWrapper< GUM_SCALAR >::elimRedundVrep : only for "
429  "V-representation or fillV has not been called with all vertices, "
430  "current state is still : "
431  << __setUpStateNames[static_cast< int >(__state)]);
432 
433  // __coutOff();
434 
435  __initLrs();
436 
437  int64_t* redineq; /* redineq[i]=0 if ineq i non-red,1 if red,2 linearity */
438 
439  /*********************************************************************************/
440  /* Test each row of the dictionary to see if it is redundant */
441  /*********************************************************************************/
442 
443  /* note some of these may have been changed in getting initial dictionary
444  */
445  auto m = __dic->m_A;
446  auto d = __dic->d;
447  /* number of linearities in input */ /* should be 0 ! */
448  auto nlinearity = __dat->nlinearity;
449  auto lastdv = __dat->lastdv;
450 
451  /* linearities are not considered for redundancy */
452  redineq = (int64_t*)calloc((m + 1), sizeof(int64_t));
453 
454  for (decltype(nlinearity) i = 0; i < nlinearity; i++)
455  redineq[__dat->linearity[i]] = 2L;
456 
457  /* rows 0..lastdv are cost, decision variables, or linearities */
458  /* other rows need to be tested */
459 
460  for (decltype(m + d) index = lastdv + 1, end = m + d; index <= end;
461  index++) {
462  /* input inequality number of current index */
463  auto ineq =
464  __dat->inequality[index - lastdv]; /* the input inequality number corr.
465  to this index */
466 
467  redineq[ineq] = checkindex(__dic, __dat, index);
468  }
469 
470  /* linearities */
471  if (nlinearity > 0)
472  GUM_ERROR(FatalError,
473  "LRSWrapper< GUM_SCALAR >::elimRedundVrep : not "
474  "reading a vertex but a linearity !");
475 
476  /* count number of non-redundant inequalities */
477  /*
478  auto nredund = nlinearity;
479  for ( decltype ( m ) i = 1; i <= m; i++ )
480  if ( redineq[ i ] == 0 )
481  nredund++;
482  */
483 
484  //__vertices = nredund;
485  //__output = std::vector< std::vector< GUM_SCALAR > > ( nredund,
486  // std::vector<
487  // GUM_SCALAR > ( __dat->n - 1 ) );
488 
489  for (decltype(m) i = 1; i <= m; i++)
490  if (redineq[i] == 0)
491  __output.push_back(std::vector< GUM_SCALAR >(++__input[i - 1].begin(),
492  __input[i - 1].end()));
493 
494  __vertices = (unsigned int)__output.size();
495 
496  __freeLrs();
497 
498  // __coutOn();
499  }
lrs_dat * __dat
Structure for holding static problem data of lrs.
Definition: LrsWrapper.h:182
matrix __output
Output matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:115
void __initLrs()
Initialize lrs structs and first basis according to flags.
lrs_dic * __dic
Structure for holding current dictionary and indices of lrs.
Definition: LrsWrapper.h:179
void __freeLrs()
Free lrs space.
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
unsigned int __vertices
The number of vertices of the polytope.
Definition: LrsWrapper.h:125
matrix __input
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:111
const char * __setUpStateNames[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:157
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::fillH ( const GUM_SCALAR &  min,
const GUM_SCALAR &  max,
const unsigned int &  modal 
)

Creates the H-representation of min <= p(X=modal | .) <= max and add it to the problem input __input.

Parameters
minThe lower value of p(X=modal | .).
maxThe upper value of p(X=modal | .).
modalThe modality on which we put constraints.

Definition at line 185 of file LrsWrapper_tpl.h.

References GUM_ERROR.

Referenced by gum::credal::CredalNet< GUM_SCALAR >::intervalToCredal().

187  {
188  if (__state != __states::Hup)
189  GUM_ERROR(
190  OperationNotAllowed,
191  "LRSWrapper< GUM_SCALAR >::fillH : setUpH or nextInput has not "
192  "been called or H-representation is complete, current state is : "
193  << __setUpStateNames[static_cast< int >(__state)]);
194 
195  if (modal >= __card)
196  GUM_ERROR(OutOfBounds,
197  "LRSWrapper< GUM_SCALAR >::fillH : modality is "
198  "greater or equal than cardinality : "
199  << modal << " >= " << __card);
200 
201  __input[modal * 2][0] = -min;
202  __input[modal * 2][modal + 1] = 1;
203 
204  __input[modal * 2 + 1][0] = max;
205  __input[modal * 2 + 1][modal + 1] = -1;
206 
207  __vertex[modal] = max;
208 
209  __insertedModals.insert(modal);
210 
212  }
unsigned int __card
Cardinality of the variable.
Definition: LrsWrapper.h:118
std::vector< GUM_SCALAR > __vertex
In case we have lower = upper for all modalities, a point probability, there is no need to use lrs...
Definition: LrsWrapper.h:134
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
std::unordered_set< int > __insertedModals
To keep track of which constraints over modalities have been inserted.
Definition: LrsWrapper.h:122
matrix __input
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:111
const char * __setUpStateNames[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:157
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::fillMatrix ( const std::vector< std::vector< GUM_SCALAR > > &  matrix)

Fill the H-representation from the matrix given in argument.

Parameters
matrixThe H-representation of the polytope of the form 0 <= -b
  • Ax, A is the matrix, each column the coefficient of the variable in x.

Definition at line 215 of file LrsWrapper_tpl.h.

References GUM_ERROR.

Referenced by gum::credal::lp::LpInterface< GUM_SCALAR >::solve().

216  {
217  if (__state != __states::Hup)
218  GUM_ERROR(
219  OperationNotAllowed,
220  "LRSWrapper< GUM_SCALAR >::fillH : setUpH or nextInput has not "
221  "been called or H-representation is complete, current state is : "
222  << __setUpStateNames[static_cast< int >(__state)]);
223 
224  if (matrix[0].size() - 1 != __card)
225  GUM_ERROR(OutOfBounds,
226  "LRSWrapper< GUM_SCALAR >::fillMatrix : size is "
227  "different than cardinality : "
228  << (matrix[0].size() - 1) << " != " << __card);
229 
230  __input = matrix;
231 
232  for (unsigned int modal = 0; modal < __card; modal++) {
233  __insertedModals.insert(modal);
234  }
235 
237  }
unsigned int __card
Cardinality of the variable.
Definition: LrsWrapper.h:118
typename std::vector< std::vector< GUM_SCALAR > > matrix
Shortcut for dynamic matrix using vectors.
Definition: LrsWrapper.h:107
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
std::unordered_set< int > __insertedModals
To keep track of which constraints over modalities have been inserted.
Definition: LrsWrapper.h:122
matrix __input
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:111
const char * __setUpStateNames[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:157
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::fillV ( const std::vector< GUM_SCALAR > &  vertex)

Creates the V-representation of a polytope by adding a vertex to the problem input __input.

Parameters
vertexThe vertex we wish to add to the V-representation of the polytope.

Definition at line 240 of file LrsWrapper_tpl.h.

References GUM_ERROR.

Referenced by gum::credal::InferenceEngine< GUM_SCALAR >::_updateCredalSets().

240  {
241  if (__state != __states::Vup)
242  GUM_ERROR(
243  OperationNotAllowed,
244  "LRSWrapper< GUM_SCALAR >::fillV : setUpV or nextInput has not "
245  "been called or V-representation is complete, current state is : "
246  << __setUpStateNames[static_cast< int >(__state)]);
247 
248  if (__insertedVertices.size() == __vertices)
249  GUM_ERROR(OutOfBounds,
250  "LRSWrapper< GUM_SCALAR >::fillV : input is already full with "
251  << __vertices << " vertices.");
252 
253  bool eq = true;
254 
255  for (const auto& v : __insertedVertices) {
256  eq = true;
257 
258  for (decltype(__card) mod = 0; mod < __card; mod++)
259  if (std::fabs(v[mod] - vertex[mod]) > 1e-6) {
260  eq = false;
261  break;
262  }
263 
264  if (eq) {
265  __vertices--;
266  return;
267  // GUM_ERROR ( DuplicateElement, "LRSWrapper< GUM_SCALAR >::fillV :
268  // vertex
269  // already present : " << vertex );
270  }
271  }
272 
273  auto row = __insertedVertices.size();
274 
275  for (decltype(__card) mod = 0; mod < __card; mod++)
276  __input[row][mod + 1] = vertex[mod];
277 
278  __insertedVertices.push_back(vertex);
279 
280  if (__insertedVertices.size() == __vertices) __state = __states::V2Hready;
281  }
unsigned int __card
Cardinality of the variable.
Definition: LrsWrapper.h:118
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
unsigned int __vertices
The number of vertices of the polytope.
Definition: LrsWrapper.h:125
matrix __input
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:111
const char * __setUpStateNames[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:157
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
std::vector< std::vector< GUM_SCALAR > > __insertedVertices
To keep track of inserted vertices and total.
Definition: LrsWrapper.h:130

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
auto gum::credal::LRSWrapper< GUM_SCALAR >::getInput ( ) const

Get the intput matrix of the problem.

Returns
A constant reference to the __intput matrix.

Definition at line 53 of file LrsWrapper_tpl.h.

53  {
54  return __input;
55  }
matrix __input
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:111
template<typename GUM_SCALAR >
auto gum::credal::LRSWrapper< GUM_SCALAR >::getOutput ( ) const

Get the output matrix solution of the problem.

Returns
A constant reference to the __output matrix.

Definition at line 58 of file LrsWrapper_tpl.h.

Referenced by gum::credal::InferenceEngine< GUM_SCALAR >::_updateCredalSets(), gum::credal::CredalNet< GUM_SCALAR >::intervalToCredal(), and gum::credal::lp::LpInterface< GUM_SCALAR >::solve().

58  {
59  return __output;
60  }
matrix __output
Output matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:115

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
const unsigned int & gum::credal::LRSWrapper< GUM_SCALAR >::getVerticesNumber ( ) const

Get the number of vertices of this polytope.

Returns
A constant reference to the number of vertices __vertices.

Definition at line 63 of file LrsWrapper_tpl.h.

63  {
64  return __vertices;
65  }
unsigned int __vertices
The number of vertices of the polytope.
Definition: LrsWrapper.h:125
template<typename GUM_SCALAR >
const GUM_SCALAR & gum::credal::LRSWrapper< GUM_SCALAR >::getVolume ( ) const

Get the volume of the polytope that has been computed.

Warning
Volume can only be computed using V-representation. H-representation volume computation is not predictable.
Probabilistic polytopes are not full dimensional : they lie in the simplex' hyper plane, therefor a pseudo-volume will be computed by projecting the polytope. The projection used is the lexicographically smallest coordinate subspace.
Returns
A constant reference to the polytope volume.

Definition at line 68 of file LrsWrapper_tpl.h.

References GUM_ERROR.

68  {
69  if (__volume != 0)
70  return __volume;
71  else
72  GUM_ERROR(OperationNotAllowed,
73  "LRSWrapper< GUM_SCALAR >::getVolume () : "
74  "volume computation was not asked for this "
75  "credal set, call computeVolume() from a "
76  "V-representation.");
77  }
GUM_SCALAR __volume
The volume of the polytope, if computed, 0 otherwise.
Definition: LrsWrapper.h:153
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::H2V ( )

H-representation to V-representation.

Computes the V-representation of a polytope, i.e. it's vertices, from it's H-representation, i.e. the hyper-plan inequalities.

Definition at line 284 of file LrsWrapper_tpl.h.

References GUM_ERROR.

Referenced by gum::credal::CredalNet< GUM_SCALAR >::intervalToCredal(), and gum::credal::lp::LpInterface< GUM_SCALAR >::solve().

284  {
286  GUM_ERROR(OperationNotAllowed,
287  "LRSWrapper< GUM_SCALAR >::H2V : fillH has not been called with "
288  "all modalities, current state is still : "
289  << __setUpStateNames[static_cast< int >(__state)]);
290 
291  // check that we have a credal set and not a precise point probability,
292  // i.e.
293  // sum of vertex elements is close to one ( floating type precision )
294  GUM_SCALAR sum = 0;
295 
296  for (const auto elem : __vertex)
297  sum += elem;
298 
299  if (std::fabs(sum - 1) < 1e-6) {
300  __output = std::vector< std::vector< GUM_SCALAR > >(1, __vertex);
301  return;
302  }
303 
304  // not precise point probability, initialize lrs
305 
306  // __coutOff();
307 
308  __initLrs();
309 
310  /* We initiate reverse search from this dictionary */
311  /* getting new dictionaries until the search is complete */
312  /* User can access each output line from output which is */
313  /* vertex/ray/facet from the lrs_mp_vector output */
314  /* prune is TRUE if tree should be pruned at current node */
315 
316  // pruning is not used
317 
318  std::vector< int64_t > Num; /* numerators of all vertices */
319  std::vector< int64_t > Den; /* denominators of all vertices */
320 
321  do {
322  for (decltype(__dic->d) col = 0, end = __dic->d; col <= end; col++)
323  if (lrs_getsolution(__dic, __dat, __lrsOutput, col)) {
324  // iszero macro could be used here for the test on right
325  if (__dat->hull
326  || ((((__lrsOutput[0])[0] == 2 || (__lrsOutput[0])[0] == -2)
327  && (__lrsOutput[0])[1] == 0)
328  ? 1L
329  : 0L)) {
330  // __coutOn();
331  /*for ( decltype(Q->n) i = 0; i < Q->n; i++ )
332  pmp ("", output[i]);*/
333  GUM_ERROR(FatalError,
334  "LRSWrapper< GUM_SCALAR >::H2V : asked for "
335  "Q-hull computation or not reading a vertex !");
336  } else
337  for (decltype(__dat->n) i = 1, end = __dat->n; i < end; i++)
339  }
340  } while (lrs_getnextbasis(&__dic, __dat, 0L));
341 
342  auto vtx = Num.size();
343  std::vector< GUM_SCALAR > vertex(__card);
344 
345  for (decltype(vtx) i = 1; i <= vtx; i++) {
346  vertex[(i - 1) % __card] = GUM_SCALAR(Num[i - 1] * 1.0 / Den[i - 1]);
347 
348  if (i % __card == 0) {
349  __output.push_back(vertex);
350  __vertices++;
351  }
352  }
353 
354  __freeLrs();
355 
356  // __coutOn();
357  }
lrs_dat * __dat
Structure for holding static problem data of lrs.
Definition: LrsWrapper.h:182
unsigned int __card
Cardinality of the variable.
Definition: LrsWrapper.h:118
matrix __output
Output matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:115
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...
Definition: LrsWrapper.h:134
lrs_dic * __dic
Structure for holding current dictionary and indices of lrs.
Definition: LrsWrapper.h:179
void __freeLrs()
Free lrs space.
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
unsigned int __vertices
The number of vertices of the polytope.
Definition: LrsWrapper.h:125
const char * __setUpStateNames[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:157
lrs_mp_vector __lrsOutput
One line of output of lrs : aither a ray, a vertex, a facet or a linearity.
Definition: LrsWrapper.h:187
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
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.

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::nextHInput ( )

Reset the wrapper for next computation for a H-representation with the same variable cardinality and number of inequalities.

Usefull when creating credal networks specified as intervals over modalities.

Reset wrapper state __state to it's previous state and clear output matrix __output. Keeps the cardinality __card of the variable and therefor the input matrix __intput structure.

Definition at line 153 of file LrsWrapper_tpl.h.

References GUM_ERROR.

Referenced by gum::credal::CredalNet< GUM_SCALAR >::intervalToCredal().

153  {
154  __insertedModals.clear();
155  __insertedVertices.clear();
156  __output.clear();
157  __vertex.clear();
158  __vertex.resize(__card, 0);
159 
160  __volume = 0;
161  __vertices = 0;
162 
163  __getVolume = false;
164  __hull = false;
165  __polytope = false;
166 
169  else if (__state == __states::V2Hready) {
171  GUM_ERROR(
172  OperationNotAllowed,
173  "LRSWrapper< GUM_SCALAR >::nextHInput : only for H-representation "
174  "as input. Previous state was : "
175  << __setUpStateNames[static_cast< int >(__state)]);
176  } else {
177  __input.clear();
179  __card = 0;
180  __vertex.clear();
181  }
182  }
unsigned int __card
Cardinality of the variable.
Definition: LrsWrapper.h:118
matrix __output
Output matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:115
std::vector< GUM_SCALAR > __vertex
In case we have lower = upper for all modalities, a point probability, there is no need to use lrs...
Definition: LrsWrapper.h:134
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
std::unordered_set< int > __insertedModals
To keep track of which constraints over modalities have been inserted.
Definition: LrsWrapper.h:122
unsigned int __vertices
The number of vertices of the polytope.
Definition: LrsWrapper.h:125
matrix __input
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:111
const char * __setUpStateNames[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:157
GUM_SCALAR __volume
The volume of the polytope, if computed, 0 otherwise.
Definition: LrsWrapper.h:153
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
std::vector< std::vector< GUM_SCALAR > > __insertedVertices
To keep track of inserted vertices and total.
Definition: LrsWrapper.h:130

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::setUpH ( const unsigned int &  card)

Sets up an H-representation.

Initialize input matrix __input to correct dimensions and wrapper state __state to __states::Hup.

Parameters
cardA constant reference to the cardinality of the variable.

Definition at line 80 of file LrsWrapper_tpl.h.

References GUM_ERROR.

Referenced by gum::credal::CredalNet< GUM_SCALAR >::intervalToCredal(), and gum::credal::lp::LpInterface< GUM_SCALAR >::solve().

80  {
81  if (card < 2)
82  GUM_ERROR(OperationNotAllowed,
83  "LRSWrapper< GUM_SCALAR >::setUpH : "
84  "cardinality must be at least 2");
85 
86  tearDown();
87 
88  __input = std::vector< std::vector< GUM_SCALAR > >(
89  card * 2 + 2, std::vector< GUM_SCALAR >(card + 1, 0));
90 
91  __input[card * 2] = std::vector< GUM_SCALAR >(card + 1, -1);
92  __input[card * 2][0] = 1;
93 
94  __input[card * 2 + 1] = std::vector< GUM_SCALAR >(card + 1, 1);
95  __input[card * 2 + 1][0] = -1;
96 
97  __output = std::vector< std::vector< GUM_SCALAR > >();
98 
99  __vertex = std::vector< GUM_SCALAR >(card);
100 
102 
103  __card = card;
104  }
unsigned int __card
Cardinality of the variable.
Definition: LrsWrapper.h:118
matrix __output
Output matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:115
std::vector< GUM_SCALAR > __vertex
In case we have lower = upper for all modalities, a point probability, there is no need to use lrs...
Definition: LrsWrapper.h:134
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
void tearDown()
Reset the wrapper as if it was built.
matrix __input
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:111
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::setUpV ( const unsigned int &  card,
const unsigned int &  vertices 
)

Sets up a V-representation.

Initialize input matrix __input to correct dimensions and wrapper state __state to __states::Vup.

Parameters
cardA constant reference to the cardinality of the variable.
verticesA constant reference to the number of vertices of the polytope.

Definition at line 107 of file LrsWrapper_tpl.h.

References GUM_ERROR.

Referenced by gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::__updateThreadCredalSets(), and gum::credal::InferenceEngine< GUM_SCALAR >::_updateCredalSets().

108  {
109  if (card < 2)
110  GUM_ERROR(OperationNotAllowed,
111  "LRSWrapper< GUM_SCALAR >::setUpV : "
112  "cardinality must be at least 2");
113 
114  if (vertices < 2)
115  GUM_ERROR(OperationNotAllowed,
116  "LRSWrapper< GUM_SCALAR >::setUpV : vertices "
117  "must be at least 2 to build a polytope");
118 
119  tearDown();
120 
121  __input = std::vector< std::vector< GUM_SCALAR > >(
122  vertices, std::vector< GUM_SCALAR >(card + 1, 1));
123 
124  __output = std::vector< std::vector< GUM_SCALAR > >();
125 
127 
128  __card = card;
129  __vertices = vertices;
130  }
unsigned int __card
Cardinality of the variable.
Definition: LrsWrapper.h:118
matrix __output
Output matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:115
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
unsigned int __vertices
The number of vertices of the polytope.
Definition: LrsWrapper.h:125
void tearDown()
Reset the wrapper as if it was built.
matrix __input
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:111
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::tearDown ( )

Reset the wrapper as if it was built.

Reset wrapper state __state to __states::none and clear all member datas.

Definition at line 133 of file LrsWrapper_tpl.h.

133  {
134  __input.clear();
135  __output.clear();
136  __vertex.clear();
137  __insertedModals.clear();
138 
139  __insertedVertices.clear();
140  __vertices = 0;
141 
142  __volume = 0;
143 
145  __card = 0;
146 
147  __getVolume = false;
148  __hull = false;
149  __polytope = false;
150  }
unsigned int __card
Cardinality of the variable.
Definition: LrsWrapper.h:118
matrix __output
Output matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:115
std::vector< GUM_SCALAR > __vertex
In case we have lower = upper for all modalities, a point probability, there is no need to use lrs...
Definition: LrsWrapper.h:134
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
std::unordered_set< int > __insertedModals
To keep track of which constraints over modalities have been inserted.
Definition: LrsWrapper.h:122
unsigned int __vertices
The number of vertices of the polytope.
Definition: LrsWrapper.h:125
matrix __input
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:111
GUM_SCALAR __volume
The volume of the polytope, if computed, 0 otherwise.
Definition: LrsWrapper.h:153
std::vector< std::vector< GUM_SCALAR > > __insertedVertices
To keep track of inserted vertices and total.
Definition: LrsWrapper.h:130
template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::V2H ( )

V-representation to H-representation.

Warning
Not complete yet.

Computes the H-representation of a polytope from it's V-representation.

Definition at line 360 of file LrsWrapper_tpl.h.

References GUM_ERROR.

360  {
361  if (!__state == __states::V2Hready)
362  GUM_ERROR(OperationNotAllowed,
363  "LRSWrapper< GUM_SCALAR >::V2H : fillV has "
364  "not been called with all vertices, current "
365  "state is still : "
367  }
__states __state
The current state of the LrsWrapper.
Definition: LrsWrapper.h:150
const char * __setUpStateNames[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:157
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

Member Data Documentation

template<typename GUM_SCALAR>
unsigned int gum::credal::LRSWrapper< GUM_SCALAR >::__card
private

Cardinality of the variable.

Definition at line 118 of file LrsWrapper.h.

template<typename GUM_SCALAR>
lrs_dat* gum::credal::LRSWrapper< GUM_SCALAR >::__dat
private

Structure for holding static problem data of lrs.

Definition at line 182 of file LrsWrapper.h.

template<typename GUM_SCALAR>
lrs_dic* gum::credal::LRSWrapper< GUM_SCALAR >::__dic
private

Structure for holding current dictionary and indices of lrs.

Definition at line 179 of file LrsWrapper.h.

template<typename GUM_SCALAR>
bool gum::credal::LRSWrapper< GUM_SCALAR >::__getVolume
private

Definition at line 197 of file LrsWrapper.h.

template<typename GUM_SCALAR>
bool gum::credal::LRSWrapper< GUM_SCALAR >::__hull
private

Definition at line 199 of file LrsWrapper.h.

template<typename GUM_SCALAR>
matrix gum::credal::LRSWrapper< GUM_SCALAR >::__input
private

Input matrix - either a V-representation or an H-representation.

Definition at line 111 of file LrsWrapper.h.

template<typename GUM_SCALAR>
std::unordered_set< int > gum::credal::LRSWrapper< GUM_SCALAR >::__insertedModals
private

To keep track of which constraints over modalities have been inserted.

When the set is full, the state changes from up to ready.

Definition at line 122 of file LrsWrapper.h.

template<typename GUM_SCALAR>
std::vector< std::vector< GUM_SCALAR > > gum::credal::LRSWrapper< GUM_SCALAR >::__insertedVertices
private

To keep track of inserted vertices and total.

When set is full, the state changes from up to ready.

Definition at line 130 of file LrsWrapper.h.

template<typename GUM_SCALAR>
lrs_mp_matrix gum::credal::LRSWrapper< GUM_SCALAR >::__Lin
private

Holds lrs input linearities if any are found.

Definition at line 190 of file LrsWrapper.h.

template<typename GUM_SCALAR>
lrs_mp_vector gum::credal::LRSWrapper< GUM_SCALAR >::__lrsOutput
private

One line of output of lrs : aither a ray, a vertex, a facet or a linearity.

Definition at line 187 of file LrsWrapper.h.

template<typename GUM_SCALAR>
int gum::credal::LRSWrapper< GUM_SCALAR >::__oldCout
mutableprivate

File descriptor of standard cout.

Lrs writes a lot of stuff on standard cout. __oldCout is used to save the current cout before redirecting it to /dev/null when calling lrs. The standard cout is restored when lrs is done.

Definition at line 173 of file LrsWrapper.h.

template<typename GUM_SCALAR>
matrix gum::credal::LRSWrapper< GUM_SCALAR >::__output
private

Output matrix - either a V-representation or an H-representation.

Definition at line 115 of file LrsWrapper.h.

template<typename GUM_SCALAR>
bool gum::credal::LRSWrapper< GUM_SCALAR >::__polytope
private

Definition at line 201 of file LrsWrapper.h.

template<typename GUM_SCALAR>
const char* gum::credal::LRSWrapper< GUM_SCALAR >::__setUpStateNames[5]
private
Initial value:
= {
enumStringify(__states::nHup),
enumStringify(__states::nVup),
enumStringify(__states::nH2Vready),
enumStringify(__states::nV2Hready),
}

To print an enum field name instead of it's value.

Used with GUM_ERROR.

Definition at line 157 of file LrsWrapper.h.

template<typename GUM_SCALAR>
__states gum::credal::LRSWrapper< GUM_SCALAR >::__state
private

The current state of the LrsWrapper.

Definition at line 150 of file LrsWrapper.h.

template<typename GUM_SCALAR>
std::vector< GUM_SCALAR > gum::credal::LRSWrapper< GUM_SCALAR >::__vertex
private

In case we have lower = upper for all modalities, a point probability, there is no need to use lrs.

Definition at line 134 of file LrsWrapper.h.

template<typename GUM_SCALAR>
unsigned int gum::credal::LRSWrapper< GUM_SCALAR >::__vertices
private

The number of vertices of the polytope.

Definition at line 125 of file LrsWrapper.h.

template<typename GUM_SCALAR>
GUM_SCALAR gum::credal::LRSWrapper< GUM_SCALAR >::__volume
private

The volume of the polytope, if computed, 0 otherwise.

Definition at line 153 of file LrsWrapper.h.


The documentation for this class was generated from the following files: