aGrUM  0.16.0
gum::credal::lp::LpCol Class Reference

Class representing a variable ( a column ) of a linear program, i.e. More...

#include <agrum/CN/LpInterface.h>

Public Member Functions

unsigned int id () const
 Variable id accessor. More...
 
std::string toString () const
 Get the string representation of a calling variable. More...
 
Constructor / Destructor
 LpCol (unsigned int id)
 Default constructor. More...
 
 LpCol (const LpCol &col)
 Default copy constructor. More...
 
 ~LpCol ()
 Default destructor. More...
 

Operators overload

bool operator< (const LpCol &col) const
 Test of ordering < between two variables. More...
 
bool operator== (const LpCol &col) const
 Test of equality == between two variables. More...
 
bool operator!= (const LpCol &col) const
 Opposite of equality != test between two variables. More...
 
LpColoperator= (const LpCol &col)
 Assignment operator = by copy. More...
 
std::ostream & operator<< (std::ostream &out, const LpCol &col)
 Overload of << to use with output streams ( such as std::cout << ). More...
 

Detailed Description

Class representing a variable ( a column ) of a linear program, i.e.

a dimension of the problem.

Author
Matthieu HOURBRACQ and Pierre-Henri WUILLEMIN

Definition at line 61 of file LpInterface.h.

Constructor & Destructor Documentation

◆ LpCol() [1/2]

gum::credal::lp::LpCol::LpCol ( unsigned int  id)
explicit

Default constructor.

class LpCol

Parameters
idThe id of the variable.

Definition at line 32 of file LpInterface_tpl.h.

32 : __id(id) { GUM_CONSTRUCTOR(LpCol); }
LpCol(unsigned int id)
Default constructor.
unsigned int __id
Variable id.
Definition: LpInterface.h:163

◆ LpCol() [2/2]

gum::credal::lp::LpCol::LpCol ( const LpCol col)

Default copy constructor.

Parameters
colThe constant reference to the variable to copy.

Definition at line 34 of file LpInterface_tpl.h.

34 : __id(col.__id) { GUM_CONS_CPY(LpCol); }
LpCol(unsigned int id)
Default constructor.
unsigned int __id
Variable id.
Definition: LpInterface.h:163

◆ ~LpCol()

gum::credal::lp::LpCol::~LpCol ( )

Default destructor.

Definition at line 36 of file LpInterface_tpl.h.

36 { GUM_DESTRUCTOR(LpCol); }
LpCol(unsigned int id)
Default constructor.

Member Function Documentation

◆ id()

unsigned int gum::credal::lp::LpCol::id ( ) const

Variable id accessor.

Returns
The id of the variable.

Definition at line 38 of file LpInterface_tpl.h.

References __id.

Referenced by operator!=(), operator<(), and operator==().

38 { return __id; }
unsigned int __id
Variable id.
Definition: LpInterface.h:163
+ Here is the caller graph for this function:

◆ operator!=()

bool gum::credal::lp::LpCol::operator!= ( const LpCol col) const

Opposite of equality != test between two variables.

For use with maps, hashTable etc

Parameters
colThe constant reference to the variable to compare to this ( the caller ).
Returns
True if this id is not the same than col id, false otherwise.

Definition at line 44 of file LpInterface_tpl.h.

References __id, and id().

44 { return (__id != col.id()); }
unsigned int __id
Variable id.
Definition: LpInterface.h:163
+ Here is the call graph for this function:

◆ operator<()

bool gum::credal::lp::LpCol::operator< ( const LpCol col) const

Test of ordering < between two variables.

For use with maps, hashTable etc

Parameters
colThe constant reference to the variable to compare to this ( the caller ).
Returns
True if this id is smaller than col id, false otherwise.

Definition at line 40 of file LpInterface_tpl.h.

References __id, and id().

40 { return (__id < col.id()); }
unsigned int __id
Variable id.
Definition: LpInterface.h:163
+ Here is the call graph for this function:

◆ operator=()

LpCol & gum::credal::lp::LpCol::operator= ( const LpCol col)

Assignment operator = by copy.

Parameters
colThe constant reference to the variable to copy in this ( the caller ).
Returns
The address of the caller.

Definition at line 46 of file LpInterface_tpl.h.

References __id.

46  {
47  __id = col.__id;
48 
49  return *this;
50  }
unsigned int __id
Variable id.
Definition: LpInterface.h:163

◆ operator==()

bool gum::credal::lp::LpCol::operator== ( const LpCol col) const

Test of equality == between two variables.

For use with maps, hashTable etc

Parameters
colThe constant reference to the variable to compare to this ( the caller ).
Returns
True if this id is equals to col id, false otherwise.

Definition at line 42 of file LpInterface_tpl.h.

References __id, and id().

42 { return (__id == col.id()); }
unsigned int __id
Variable id.
Definition: LpInterface.h:163
+ Here is the call graph for this function:

◆ toString()

std::string gum::credal::lp::LpCol::toString ( ) const

Get the string representation of a calling variable.

Returns
The string representation of the calling variable.

Definition at line 57 of file LpInterface_tpl.h.

References __id, and gum::to_string().

Referenced by gum::credal::lp::operator<<().

57 { return "V" + std::to_string(__id); }
std::string to_string(const Formula &f)
Definition: formula_inl.h:499
unsigned int __id
Variable id.
Definition: LpInterface.h:163
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const LpCol col 
)
friend

Overload of << to use with output streams ( such as std::cout << ).

Parameters
outThe reference to the caller, i.e. left side of <<.
colThe constant reference to the variable whose representation we want.
Returns
The address of the caller.

Definition at line 52 of file LpInterface_tpl.h.

52  {
53  out << col.toString();
54  return out;
55  }

Member Data Documentation

◆ __id

unsigned int gum::credal::lp::LpCol::__id
private

Variable id.

Definition at line 163 of file LpInterface.h.

Referenced by id(), operator!=(), operator<(), operator=(), operator==(), and toString().


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