Project
Public Member Functions | Friends | List of all members
Profiles Class Reference

Profiles data structure. More...

#include <Profiles.h>

Inheritance diagram for Profiles:
Inheritance graph
[legend]
Collaboration diagram for Profiles:
Collaboration graph
[legend]

Public Member Functions

 Profiles (std::vector< std::vector< Perf >> &perf_vect, std::string mode="crit")
 
 Profiles (int nb_of_prof, Criteria &crits, std::string mode="crit", std::string prefix="prof")
 
 Profiles (const Profiles &profiles)
 
bool isProfileOrdered ()
 
void generateRandomPerfValues (unsigned long int seed=time(NULL), int lower_bound=0, int upper_bound=1)
 
std::pair< std::vector< Perf >, std::vector< Perf > > getBelowAndAboveProfile (std::string profName, float worst_value, float best_value)
 
void setPerf (std::string name, std::string crit, float value)
 
- Public Member Functions inherited from PerformanceTable
 PerformanceTable (std::vector< std::vector< Perf >> &perf_vect, std::string mode="alt")
 
 PerformanceTable (int nb_of_perfs, Criteria &crits, std::string prefix="alt")
 
 PerformanceTable (const PerformanceTable &perfs)
 
void generateRandomPerfValues (unsigned long int seed=time(NULL), int lower_bound=0, int upper_bound=1)
 
std::vector< std::vector< Perf > > getPerformanceTable () const
 
std::string getMode () const
 
bool isSorted () const
 
std::vector< Perfoperator[] (std::string name)
 
Perf getPerf (std::string name, std::string crit)
 
void sort (std::string mode="crit")
 
void changeMode (std::string mode)
 
std::vector< PerfgetAltBetweenSorted (std::string critId, float inf, float sup)
 
std::vector< PerfgetAltBetween (std::string critId, float inf, float sup)
 
std::vector< PerfgetBestPerfByCrit (Criteria &crits)
 
std::vector< PerfgetWorstPerfByCrit (Criteria &crits)
 
bool isAltInTable (std::string altName)
 
int getNumberCrit ()
 
int getNumberAlt ()
 
void display ()
 
bool operator== (const PerformanceTable &pt) const
 

Friends

std::ostream & operator<< (std::ostream &out, const Profiles &profs)
 

Additional Inherited Members

- Protected Attributes inherited from PerformanceTable
std::vector< std::vector< Perf > > pt_
 
std::string mode_ = "alt"
 
bool sorted_ = false
 

Detailed Description

Profiles data structure.

The Profiles class hold the datastructure that implement the theoretical definition of a "profile": the values that delimit two categories. A Profiles object is represented as a PerformanceTable that guarantee the right order of the values. In order to have a correct representation of a set of profile (to delimit all the category of our problem), each profile must be dominated by the one above and must demonate the one below.

Example:

crit0 crit1
category 2
0.6 0.8 – profile 1
category 1
0.4 0.5 – profile 0
category 0

Constructor & Destructor Documentation

◆ Profiles() [1/3]

Profiles::Profiles ( std::vector< std::vector< Perf >> &  perf_vect,
std::string  mode = "crit" 
)

Profiles standard constructor (PerformanceTable surcharged). Default mode is "crit"

Parameters
perf_vectVector of performance that models category limits or a PerformanceTable Profiles in "alt"
moderefers the mode of the Profiles

◆ Profiles() [2/3]

Profiles::Profiles ( int  nb_of_prof,
Criteria crits,
std::string  mode = "crit",
std::string  prefix = "prof" 
)

Profiles constructor without perf values but set of criteria to evaluate performance over (PerformanceTable surcharged) Default mode is "crit".

Parameters
nb_of_profNumber of profile
critsCriteria to evaluate performance over
prefixPrefix to use for the name of each Performance created.
moderefers the mode of the Profiles

◆ Profiles() [3/3]

Profiles::Profiles ( const Profiles profiles)

Profiles constructor by copy

Parameters
perfsBased performances to copy

Member Function Documentation

◆ generateRandomPerfValues()

void Profiles::generateRandomPerfValues ( unsigned long int  seed = time(NULL),
int  lower_bound = 0,
int  upper_bound = 1 
)

generateRandomPerfValues set all the Perf values to random according to profile mode

Parameters
seed(optional) Random seed to use in the random generator
lower_bound(optional) lower bound of the generated Perf values
upper_bound(optional) upper bound of the generated Perf values

◆ getBelowAndAboveProfile()

std::pair<std::vector<Perf>, std::vector<Perf> > Profiles::getBelowAndAboveProfile ( std::string  profName,
float  worst_value,
float  best_value 
)

getBelowAndAboveProfile gets the profiles below and above the given profile. If given profile is the first or last, it will return itself

Parameters
profIdid of the profile to get the above and below profiles
worst_valueworst value found in the dataset used to create the lower bound
best_valuebest value found in the dataset used to create the higher bound
Returns
profiles performances (below and above)

◆ isProfileOrdered()

bool Profiles::isProfileOrdered ( )

isProfileOrdered checks if the profile performance table is ordered.

  • "alt" mode : each row of the performance table denotes a profile. The first row is profile b0 refering to category of rank 0. Hence, each criterion must be ordered in descending order. ie : for all i,j : b_i+1_j > b_i_j
  • "crit" mode : each row of the performance table denotes a criteria modeled by its category limits. Hence, each criterion is independant to one another but for one criterion each category limit (ie column) must be ordered in descending order. The first column is cat0 refering to category of rank 0. ie : for all criterion (row) and i : cat_limit_i+1 > cat_limit_i
Returns
isOrdered

◆ setPerf()

void Profiles::setPerf ( std::string  name,
std::string  crit,
float  value 
)

setPerf set a Perf given the alt name, crit and value. Unefficient since using [] operator... and should be avoided.

Parameters
namename of the alt or profile we want to update
critname of the crit we want to update
valuenew perf value

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const Profiles profs 
)
friend

Overloading << operator for Profile class

Parameters
outostream
profsProfile object

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