aGrUM  0.21.0
a C++ library for (probabilistic) graphical models
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 Size &card)
 Sets up an H-representation. More...
 
void setUpV (const Size &card, const Size &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 Size &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 106 of file LrsWrapper.h.

Member Typedef Documentation

◆ matrix

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 109 of file LrsWrapper.h.

Member Enumeration Documentation

◆ _states_

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 143 of file LrsWrapper.h.

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

Constructor & Destructor Documentation

◆ LRSWrapper()

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

Default Constructor.

Definition at line 31 of file LrsWrapper_tpl.h.

31  {
33 
34  _vertices_ = 0;
35  _card_ = 0;
36 
37  _volume_ = 0;
38 
39  _getVolume_ = false;
40  _hull_ = false;
41  _polytope_ = false;
42 
43  GUM_CONSTRUCTOR(LRSWrapper);
44  }
unsigned int _vertices_
The number of vertices of the polytope.
Definition: LrsWrapper.h:127
_states_ _state_
The current state of the LrsWrapper.
Definition: LrsWrapper.h:153
unsigned int _card_
Cardinality of the variable.
Definition: LrsWrapper.h:120
LRSWrapper()
Default Constructor.
GUM_SCALAR _volume_
The volume of the polytope, if computed, 0 otherwise.
Definition: LrsWrapper.h:156

◆ ~LRSWrapper()

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

Default Destructor.

Definition at line 47 of file LrsWrapper_tpl.h.

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

Member Function Documentation

◆ _coutOff_()

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 702 of file LrsWrapper_tpl.h.

702  {
703  fflush(stdout);
704 #ifdef _MSC_VER
705  freopen("NUL", "w", stdout);
706 #else // _MSC_VER
707  _oldCout_ = dup(1);
708 
709  int new_cout = open("/dev/null", O_WRONLY);
710  dup2(new_cout, 1);
711  close(new_cout);
712 #endif // _MSC_VER
713  }
int _oldCout_
File descriptor of standard cout.
Definition: LrsWrapper.h:176

◆ _coutOn_()

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

The function that restores standard cout.

Definition at line 716 of file LrsWrapper_tpl.h.

716  {
717  fflush(stdout);
718 #ifdef _MSC_VER
719  freopen("CON", "w", stdout);
720 #else // _MSC_VER
721  dup2(_oldCout_, 1);
722  close(_oldCout_);
723 #endif // _MSC_VER
724  }
int _oldCout_
File descriptor of standard cout.
Definition: LrsWrapper.h:176

◆ _fill_()

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 549 of file LrsWrapper_tpl.h.

549  {
550  std::size_t cols = _input_[0].size();
551 
552  int64_t* num = new int64_t[cols]; // ISO C++ forbids variable length array,
553  // we need to do this instead
554  int64_t* den = new int64_t[cols];
555 
556  int64_t rows = int64_t(_input_.size());
557 
558  int64_t numerator, denominator;
559 
560  for (int64_t row = 0; row < rows; row++) {
561  for (std::size_t col = 0; col < cols; col++) {
563  denominator,
564  _input_[std::size_t(row)][col]);
565 
566  num[col] = numerator;
567  den[col] = denominator;
568  }
569 
570  /* GE is inequality, EQ is equation */
571  /* 1L, 0L respectively */
572  lrs_set_row(_dic_,
573  _dat_,
574  int64_t(row + 1),
575  num,
576  den,
577  1L); // do NOT forget this + 1 on row
578  }
579 
580  delete[] num;
581  delete[] den;
582  }
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:94
lrs_dat * _dat_
Structure for holding static problem data of lrs.
Definition: LrsWrapper.h:185
lrs_dic * _dic_
Structure for holding current dictionary and indices of lrs.
Definition: LrsWrapper.h:182
matrix _input_
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:113

◆ _freeLrs_()

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

Free lrs space.

Definition at line 674 of file LrsWrapper_tpl.h.

674  {
675  /* free space : do not change order of next lines! */
676 
677  lrs_clear_mp_vector(_lrsOutput_, _dat_->n);
678 
679  if (_dat_->nredundcol > 0) lrs_clear_mp_matrix(_Lin_, _dat_->nredundcol, _dat_->n);
680 
681  if (_dat_->runs > 0) {
682  free(_dat_->isave);
683  free(_dat_->jsave);
684  }
685 
686  auto savem = _dic_->m; /* need this to clear _dat_*/
687 
688  lrs_free_dic(_dic_, _dat_); /* deallocate lrs_dic */
689 
690  _dat_->m = savem;
691  lrs_free_dat(_dat_);
692 
693  std::string name = "LrsWrapper:";
694  std::vector< char > chars(name.c_str(), name.c_str() + name.size() + 1u);
695 
696  lrs_close(&chars[0]);
697 
698  // _coutOn_();
699  }
lrs_dat * _dat_
Structure for holding static problem data of lrs.
Definition: LrsWrapper.h:185
lrs_mp_matrix _Lin_
Holds lrs input linearities if any are found.
Definition: LrsWrapper.h:193
lrs_mp_vector _lrsOutput_
One line of output of lrs : aither a ray, a vertex, a facet or a linearity.
Definition: LrsWrapper.h:190
lrs_dic * _dic_
Structure for holding current dictionary and indices of lrs.
Definition: LrsWrapper.h:182

◆ _getLRSWrapperOutput_()

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 491 of file LrsWrapper_tpl.h.

494  {
495  int64_t Nsize = (Nin[0] > 0) ? Nin[0] : -Nin[0];
496  int64_t Dsize = (Din[0] > 0) ? Din[0] : -Din[0];
497 
498  int64_t num = 0L;
499  int64_t den = 0L;
500 
501  int64_t tmp;
502 
503  for (decltype(Nsize) i = Nsize - 1; i > 0; i--) {
504  tmp = Nin[i];
505 
506  for (decltype(i) j = 1; j < i; j++)
507  tmp *= BASE;
508 
509  num += tmp;
510  }
511 
512  if (!(Din[0] == 2L && Din[1] == 1L)) { /* rational */
513  for (decltype(Dsize) i = Dsize - 1; i > 0; i--) {
514  tmp = Din[i];
515 
516  for (decltype(i) j = 1; j < i; j++)
517  tmp *= BASE;
518 
519  den += tmp;
520  }
521  } else {
522  den = 1L;
523  }
524 
525  int64_t Nsign = ((Nin[0] < 0) ? -1L : 1L);
526  int64_t Dsign = ((Din[0] < 0) ? -1L : 1L);
527 
528  if ((Nsign * Dsign) == -1L) num = -num;
529 
530  Num.push_back(num);
531  Den.push_back(den);
532  }
#define BASE
Definition: LrsWrapper.h:73

◆ _initLrs_()

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

Initialize lrs structs and first basis according to flags.

Definition at line 585 of file LrsWrapper_tpl.h.

585  {
587  GUM_ERROR(OperationNotAllowed,
588  "LRSWrapper< GUM_SCALAR >:: _initLrs_ : not ready, current state "
589  "is still : "
590  << _setUpStateNames_[static_cast< int >(_state_)]);
591 
592  // __coutOff();
593 
594  std::string name = "\n*LrsWrapper:";
595  std::vector< char > chars(name.c_str(), name.c_str() + name.size() + 1u);
596  // use &chars[0] as a char*
597 
598  if (!lrs_init(&chars[0])) {
599  // _coutOn_();
600  GUM_ERROR(FatalError, "LRSWrapper< GUM_SCALAR >:: _initLrs_ : failed lrs_init")
601  }
602 
603  name = "LRSWrapper globals";
604  chars = std::vector< char >(name.c_str(), name.c_str() + name.size() + 1u);
605 
606  _dat_ = lrs_alloc_dat(&chars[0]);
607 
608  if (_dat_ == nullptr) {
609  // _coutOn_();
610  GUM_ERROR(FatalError, "LRSWrapper< GUM_SCALAR >:: _initLrs_ : failed lrs_alloc_dat")
611  }
612 
613  _dat_->n = Size(_input_[0].size());
614  _dat_->m = Size(_input_.size());
615 
616  _dat_->getvolume = (_getVolume_) ? 1L : 0L;
617  _dat_->hull = (_hull_) ? 1L : 0L;
618  _dat_->polytope = (_polytope_) ? 1L : 0L;
619 
620  _lrsOutput_ = lrs_alloc_mp_vector(_dat_->n);
621 
622  _dic_ = lrs_alloc_dic(_dat_);
623 
624  if (_dic_ == nullptr) {
625  // _coutOn_();
626  GUM_ERROR(FatalError, "LRSWrapper< GUM_SCALAR >:: _initLrs_ : failed lrs_alloc_dic")
627  }
628 
629  _fill_();
630 
631  /* Pivot to a starting dictionary */
632  if (!lrs_getfirstbasis(&_dic_, _dat_, &_Lin_, 0L)) {
633  // _coutOn_();
634  GUM_ERROR(FatalError, "LRSWrapper< GUM_SCALAR >:: _initLrs_ : failed lrs_getfirstbasis");
635  }
636 
637  /* There may have been column redundancy */
638  /* If so the linearity space is obtained and redundant */
639  /* columns are removed. User can access linearity space */
640  /* from lrs_mp_matrix Lin dimensions nredundcol x d+1 */
641 
642  decltype(_dat_->nredundcol) startcol = 0;
643 
644  if (_dat_->homogeneous && _dat_->hull) {
645  startcol++; /* col zero not treated as redundant */
646 
647  if (!_dat_->restart) {
648  // _coutOn_();
649 
650  for (decltype(_dat_->nredundcol) col = startcol; col < _dat_->nredundcol; col++)
651  lrs_printoutput(_dat_, _Lin_[col]);
652 
653  GUM_ERROR(FatalError, "LRSWrapper< GUM_SCALAR >:: _initLrs_ : redundant columns !")
654  }
655  }
656  /*
657  if ( _dat_->nredundcol > 0 ) {
658  _coutOn_();
659 
660  for ( decltype( _dat_->nredundcol ) col = 0, end =
661  _dat_->nredundcol;
662  col < end;
663  col++ )
664  lrs_printoutput( _dat_, _Lin_[col] );
665 
666  GUM_ERROR(
667  FatalError,
668  "LRSWrapper< GUM_SCALAR >:: _initLrs_ : redundant columns !" );
669  }
670  */
671  }
_states_ _state_
The current state of the LrsWrapper.
Definition: LrsWrapper.h:153
const char * _setUpStateNames_[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:160
lrs_dat * _dat_
Structure for holding static problem data of lrs.
Definition: LrsWrapper.h:185
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:193
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:47
lrs_mp_vector _lrsOutput_
One line of output of lrs : aither a ray, a vertex, a facet or a linearity.
Definition: LrsWrapper.h:190
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
lrs_dic * _dic_
Structure for holding current dictionary and indices of lrs.
Definition: LrsWrapper.h:182
matrix _input_
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:113

◆ computeVolume()

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 364 of file LrsWrapper_tpl.h.

364  {
365  if (!_state_ == _states_::V2Hready)
366  GUM_ERROR(OperationNotAllowed,
367  "LRSWrapper< GUM_SCALAR >::computeVolume : "
368  "volume is only for V-representation or "
369  "fillV has not been called with all "
370  "vertices, current state is still : "
372 
373  // _coutOff_();
374 
375  _getVolume_ = true;
376 
377  _initLrs_();
378 
379  do {
380  for (decltype(_dic_->d) col = 0, end = _dic_->d; col <= end; col++)
381  lrs_getsolution(_dic_, _dat_, _lrsOutput_, col);
382  } while (lrs_getnextbasis(&_dic_, _dat_, 0L));
383 
384  int64_t Nsize = (_dat_->Nvolume[0] > 0) ? _dat_->Nvolume[0] : -_dat_->Nvolume[0];
385  int64_t Dsize = (_dat_->Dvolume[0] > 0) ? _dat_->Dvolume[0] : -_dat_->Dvolume[0];
386 
387  int64_t num = 0L, den = 0L;
388  int64_t tmp;
389 
390  for (decltype(Nsize) i = Nsize - 1; i > 0; i--) {
391  tmp = _dat_->Nvolume[i];
392 
393  for (decltype(i) j = 1; j < i; j++)
394  tmp *= BASE;
395 
396  num += tmp;
397  }
398 
399  for (decltype(Dsize) i = Dsize - 1; i > 0; i--) {
400  tmp = _dat_->Dvolume[i];
401 
402  for (decltype(i) j = 1; j < i; j++)
403  tmp *= BASE;
404 
405  den += tmp;
406  }
407 
408  _volume_ = num * 1.0 / den;
409 
410  _freeLrs_();
411 
412  // _coutOn_();
413  }
void _freeLrs_()
Free lrs space.
_states_ _state_
The current state of the LrsWrapper.
Definition: LrsWrapper.h:153
#define BASE
Definition: LrsWrapper.h:73
const char * _setUpStateNames_[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:160
lrs_dat * _dat_
Structure for holding static problem data of lrs.
Definition: LrsWrapper.h:185
void _initLrs_()
Initialize lrs structs and first basis according to flags.
GUM_SCALAR _volume_
The volume of the polytope, if computed, 0 otherwise.
Definition: LrsWrapper.h:156
lrs_mp_vector _lrsOutput_
One line of output of lrs : aither a ray, a vertex, a facet or a linearity.
Definition: LrsWrapper.h:190
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
lrs_dic * _dic_
Structure for holding current dictionary and indices of lrs.
Definition: LrsWrapper.h:182

◆ elimRedundVrep()

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 416 of file LrsWrapper_tpl.h.

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

◆ fillH()

template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::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.

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 182 of file LrsWrapper_tpl.h.

184  {
185  if (_state_ != _states_::Hup)
186  GUM_ERROR(OperationNotAllowed,
187  "LRSWrapper< GUM_SCALAR >::fillH : setUpH or nextInput has not "
188  "been called or H-representation is complete, current state is : "
189  << _setUpStateNames_[static_cast< int >(_state_)]);
190 
191  if (modal >= _card_)
192  GUM_ERROR(OutOfBounds,
193  "LRSWrapper< GUM_SCALAR >::fillH : modality is "
194  "greater or equal than cardinality : "
195  << modal << " >= " << _card_);
196 
197  _input_[modal * 2][0] = -min;
198  _input_[modal * 2][modal + 1] = 1;
199 
200  _input_[modal * 2 + 1][0] = max;
201  _input_[modal * 2 + 1][modal + 1] = -1;
202 
203  _vertex_[modal] = max;
204 
205  _insertedModals_.insert(int(modal));
206 
208  }
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:136
_states_ _state_
The current state of the LrsWrapper.
Definition: LrsWrapper.h:153
const char * _setUpStateNames_[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:160
std::unordered_set< int > _insertedModals_
To keep track of which constraints over modalities have been inserted.
Definition: LrsWrapper.h:124
unsigned int _card_
Cardinality of the variable.
Definition: LrsWrapper.h:120
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
matrix _input_
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:113

◆ fillMatrix()

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 211 of file LrsWrapper_tpl.h.

212  {
213  if (_state_ != _states_::Hup)
214  GUM_ERROR(OperationNotAllowed,
215  "LRSWrapper< GUM_SCALAR >::fillH : setUpH or nextInput has not "
216  "been called or H-representation is complete, current state is : "
217  << _setUpStateNames_[static_cast< int >(_state_)]);
218 
219  if (matrix[0].size() - 1 != _card_)
220  GUM_ERROR(OutOfBounds,
221  "LRSWrapper< GUM_SCALAR >::fillMatrix : size is "
222  "different than cardinality : "
223  << (matrix[0].size() - 1) << " != " << _card_);
224 
225  _input_ = matrix;
226 
227  for (unsigned int modal = 0; modal < _card_; modal++) {
228  _insertedModals_.insert(modal);
229  }
230 
232  }
_states_ _state_
The current state of the LrsWrapper.
Definition: LrsWrapper.h:153
typename std::vector< std::vector< GUM_SCALAR > > matrix
Shortcut for dynamic matrix using vectors.
Definition: LrsWrapper.h:109
const char * _setUpStateNames_[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:160
std::unordered_set< int > _insertedModals_
To keep track of which constraints over modalities have been inserted.
Definition: LrsWrapper.h:124
unsigned int _card_
Cardinality of the variable.
Definition: LrsWrapper.h:120
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
matrix _input_
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:113

◆ fillV()

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 235 of file LrsWrapper_tpl.h.

235  {
236  if (_state_ != _states_::Vup)
237  GUM_ERROR(OperationNotAllowed,
238  "LRSWrapper< GUM_SCALAR >::fillV : setUpV or nextInput has not "
239  "been called or V-representation is complete, current state is : "
240  << _setUpStateNames_[static_cast< int >(_state_)]);
241 
242  if (_insertedVertices_.size() == _vertices_)
243  GUM_ERROR(OutOfBounds,
244  "LRSWrapper< GUM_SCALAR >::fillV : input is already full with " << _vertices_
245  << " vertices.");
246 
247  bool eq = true;
248 
249  for (const auto& v: _insertedVertices_) {
250  eq = true;
251 
252  for (decltype(_card_) mod = 0; mod < _card_; mod++)
253  if (std::fabs(v[mod] - vertex[mod]) > 1e-6) {
254  eq = false;
255  break;
256  }
257 
258  if (eq) {
259  _vertices_--;
260  return;
261  // GUM_ERROR ( DuplicateElement, "LRSWrapper< GUM_SCALAR >::fillV :
262  // vertex
263  // already present : " << vertex );
264  }
265  }
266 
267  auto row = _insertedVertices_.size();
268 
269  for (decltype(_card_) mod = 0; mod < _card_; mod++)
270  _input_[row][mod + 1] = vertex[mod];
271 
272  _insertedVertices_.push_back(vertex);
273 
274  if (_insertedVertices_.size() == _vertices_) _state_ = _states_::V2Hready;
275  }
std::vector< std::vector< GUM_SCALAR > > _insertedVertices_
To keep track of inserted vertices and total.
Definition: LrsWrapper.h:132
unsigned int _vertices_
The number of vertices of the polytope.
Definition: LrsWrapper.h:127
_states_ _state_
The current state of the LrsWrapper.
Definition: LrsWrapper.h:153
const char * _setUpStateNames_[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:160
unsigned int _card_
Cardinality of the variable.
Definition: LrsWrapper.h:120
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
matrix _input_
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:113

◆ getInput()

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 52 of file LrsWrapper_tpl.h.

52  {
53  return _input_;
54  }
matrix _input_
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:113

◆ getOutput()

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 57 of file LrsWrapper_tpl.h.

57  {
58  return _output_;
59  }
matrix _output_
Output matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:117

◆ getVerticesNumber()

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 62 of file LrsWrapper_tpl.h.

62  {
63  return _vertices_;
64  }
unsigned int _vertices_
The number of vertices of the polytope.
Definition: LrsWrapper.h:127

◆ getVolume()

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 67 of file LrsWrapper_tpl.h.

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

◆ H2V()

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 278 of file LrsWrapper_tpl.h.

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

◆ nextHInput()

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 151 of file LrsWrapper_tpl.h.

151  {
152  _insertedModals_.clear();
153  _insertedVertices_.clear();
154  _output_.clear();
155  _vertex_.clear();
156  _vertex_.resize(_card_, 0);
157 
158  _volume_ = 0;
159  _vertices_ = 0;
160 
161  _getVolume_ = false;
162  _hull_ = false;
163  _polytope_ = false;
164 
167  else if (_state_ == _states_::V2Hready) {
169  GUM_ERROR(OperationNotAllowed,
170  "LRSWrapper< GUM_SCALAR >::nextHInput : only for H-representation "
171  "as input. Previous state was : "
172  << _setUpStateNames_[static_cast< int >(_state_)]);
173  } else {
174  _input_.clear();
176  _card_ = 0;
177  _vertex_.clear();
178  }
179  }
std::vector< std::vector< GUM_SCALAR > > _insertedVertices_
To keep track of inserted vertices and total.
Definition: LrsWrapper.h:132
unsigned int _vertices_
The number of vertices of the polytope.
Definition: LrsWrapper.h:127
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:136
_states_ _state_
The current state of the LrsWrapper.
Definition: LrsWrapper.h:153
const char * _setUpStateNames_[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:160
std::unordered_set< int > _insertedModals_
To keep track of which constraints over modalities have been inserted.
Definition: LrsWrapper.h:124
matrix _output_
Output matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:117
unsigned int _card_
Cardinality of the variable.
Definition: LrsWrapper.h:120
GUM_SCALAR _volume_
The volume of the polytope, if computed, 0 otherwise.
Definition: LrsWrapper.h:156
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
matrix _input_
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:113

◆ setUpH()

template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::setUpH ( const Size 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 79 of file LrsWrapper_tpl.h.

79  {
80  if (card < 2)
81  GUM_ERROR(OperationNotAllowed,
82  "LRSWrapper< GUM_SCALAR >::setUpH : "
83  "cardinality must be at least 2");
84 
85  tearDown();
86 
87  _input_ = std::vector< std::vector< GUM_SCALAR > >(card * 2 + 2,
88  std::vector< GUM_SCALAR >(card + 1, 0));
89 
90  _input_[card * 2] = std::vector< GUM_SCALAR >(card + 1, -1);
91  _input_[card * 2][0] = 1;
92 
93  _input_[card * 2 + 1] = std::vector< GUM_SCALAR >(card + 1, 1);
94  _input_[card * 2 + 1][0] = -1;
95 
96  _output_ = std::vector< std::vector< GUM_SCALAR > >();
97 
98  _vertex_ = std::vector< GUM_SCALAR >(card);
99 
101 
102  _card_ = (unsigned int)card;
103  }
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:136
_states_ _state_
The current state of the LrsWrapper.
Definition: LrsWrapper.h:153
void tearDown()
Reset the wrapper as if it was built.
matrix _output_
Output matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:117
unsigned int _card_
Cardinality of the variable.
Definition: LrsWrapper.h:120
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
matrix _input_
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:113

◆ setUpV()

template<typename GUM_SCALAR >
void gum::credal::LRSWrapper< GUM_SCALAR >::setUpV ( const Size card,
const Size 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 106 of file LrsWrapper_tpl.h.

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

◆ tearDown()

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 131 of file LrsWrapper_tpl.h.

131  {
132  _input_.clear();
133  _output_.clear();
134  _vertex_.clear();
135  _insertedModals_.clear();
136 
137  _insertedVertices_.clear();
138  _vertices_ = 0;
139 
140  _volume_ = 0;
141 
143  _card_ = 0;
144 
145  _getVolume_ = false;
146  _hull_ = false;
147  _polytope_ = false;
148  }
std::vector< std::vector< GUM_SCALAR > > _insertedVertices_
To keep track of inserted vertices and total.
Definition: LrsWrapper.h:132
unsigned int _vertices_
The number of vertices of the polytope.
Definition: LrsWrapper.h:127
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:136
_states_ _state_
The current state of the LrsWrapper.
Definition: LrsWrapper.h:153
std::unordered_set< int > _insertedModals_
To keep track of which constraints over modalities have been inserted.
Definition: LrsWrapper.h:124
matrix _output_
Output matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:117
unsigned int _card_
Cardinality of the variable.
Definition: LrsWrapper.h:120
GUM_SCALAR _volume_
The volume of the polytope, if computed, 0 otherwise.
Definition: LrsWrapper.h:156
matrix _input_
Input matrix - either a V-representation or an H-representation.
Definition: LrsWrapper.h:113

◆ V2H()

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 354 of file LrsWrapper_tpl.h.

354  {
355  if (!_state_ == _states_::V2Hready)
356  GUM_ERROR(OperationNotAllowed,
357  "LRSWrapper< GUM_SCALAR >::V2H : fillV has "
358  "not been called with all vertices, current "
359  "state is still : "
361  }
_states_ _state_
The current state of the LrsWrapper.
Definition: LrsWrapper.h:153
const char * _setUpStateNames_[5]
To print an enum field name instead of it&#39;s value.
Definition: LrsWrapper.h:160
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51

Member Data Documentation

◆ _card_

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

Cardinality of the variable.

Definition at line 120 of file LrsWrapper.h.

◆ _dat_

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

Structure for holding static problem data of lrs.

Definition at line 185 of file LrsWrapper.h.

◆ _dic_

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 182 of file LrsWrapper.h.

◆ _getVolume_

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

Definition at line 200 of file LrsWrapper.h.

◆ _hull_

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

Definition at line 202 of file LrsWrapper.h.

◆ _input_

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 113 of file LrsWrapper.h.

◆ _insertedModals_

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 124 of file LrsWrapper.h.

◆ _insertedVertices_

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 132 of file LrsWrapper.h.

◆ _Lin_

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 193 of file LrsWrapper.h.

◆ _lrsOutput_

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 190 of file LrsWrapper.h.

◆ _oldCout_

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 176 of file LrsWrapper.h.

◆ _output_

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 117 of file LrsWrapper.h.

◆ _polytope_

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

Definition at line 204 of file LrsWrapper.h.

◆ _setUpStateNames_

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 160 of file LrsWrapper.h.

◆ _state_

template<typename GUM_SCALAR >
_states_ gum::credal::LRSWrapper< GUM_SCALAR >::_state_
private

The current state of the LrsWrapper.

Definition at line 153 of file LrsWrapper.h.

◆ _vertex_

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 136 of file LrsWrapper.h.

◆ _vertices_

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

The number of vertices of the polytope.

Definition at line 127 of file LrsWrapper.h.

◆ _volume_

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 156 of file LrsWrapper.h.


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