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

Dataset datastructure. More...

#include <AlternativesPerformance.h>

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

Public Member Functions

 AlternativesPerformance (std::vector< std::vector< Perf >> &perf_vect, std::unordered_map< std::string, Category > &alt_assignment=default_map)
 
 AlternativesPerformance (int nb_of_perfs, Criteria &crits, std::string prefix="alt", std::unordered_map< std::string, Category > &alt_assignment=default_map)
 
 AlternativesPerformance (const PerformanceTable &perf_table, std::unordered_map< std::string, Category > &alt_assignment=default_map)
 
 AlternativesPerformance (const AlternativesPerformance &alt)
 
std::unordered_map< std::string, CategorygetAlternativesAssignments () const
 
void setAlternativesAssignments (std::unordered_map< std::string, Category > &alt_assignment)
 
Category getAlternativeAssignment (std::string altName) const
 
void setAlternativeAssignment (std::string altName, Category &cat)
 
int getNumberCats ()
 
std::pair< float, float > getBoundaries ()
 
- 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 AlternativesPerformance &alt)
 

Additional Inherited Members

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

Detailed Description

Dataset datastructure.

The AlternativesPerformance class hold the datastructure that implement a complete dataset. An AlternativesPerformance object hold a PerformanceTable that represents the values of each alternative on each vriterion, and a hashmap that stores the ategory assignment for each alternatives. The hashmap is unordered and link the name of an alternative to the Category object to which it is assigned.

Constructor & Destructor Documentation

◆ AlternativesPerformance() [1/4]

AlternativesPerformance::AlternativesPerformance ( std::vector< std::vector< Perf >> &  perf_vect,
std::unordered_map< std::string, Category > &  alt_assignment = default_map 
)

AlternativesPerformance standard constructor (PerformanceTable surcharged)

Parameters
perf_vectVector of performance
alt_assignmentMap of alternative to the assigned category. Default alternatives assigned to empty categories, but good practice would be to create the AlternativePerformance object with an AlternativeAssignment map, otherwise we should use PerformanceTable instead

◆ AlternativesPerformance() [2/4]

AlternativesPerformance::AlternativesPerformance ( int  nb_of_perfs,
Criteria crits,
std::string  prefix = "alt",
std::unordered_map< std::string, Category > &  alt_assignment = default_map 
)

AlternativesPerformance constructor without perf values but set of criteria to evaluate performance over (PerformanceTable surcharged)

Parameters
nb_of_perfsNumber of performance
critsCriteria to evaluate performance over
prefixPrefix to use for the name of each Performance created. Default = "alt"
alt_assignmentMap of alternative to the assigned category. Default alternatives assigned to empty categories, but good practice would be to create the AlternativePerformance object with an AlternativeAssignment map, otherwise we should use PerformanceTable instead

◆ AlternativesPerformance() [3/4]

AlternativesPerformance::AlternativesPerformance ( const PerformanceTable perf_table,
std::unordered_map< std::string, Category > &  alt_assignment = default_map 
)

AlternativesPerformance constructor using an existing performance table

Parameters
perf_tablePerformance table to copy
alt_assignmentMap of alternative assignements to categories Default alternatives assigned to empty categories, but good practice would be to create the AlternativePerformance object with an AlternativeAssignment map, otherwise we should use PerformanceTable instead

◆ AlternativesPerformance() [4/4]

AlternativesPerformance::AlternativesPerformance ( const AlternativesPerformance alt)

AlternativesPerformance constructor by copy

Parameters
perfsBased performances to copy

Member Function Documentation

◆ getAlternativeAssignment()

Category AlternativesPerformance::getAlternativeAssignment ( std::string  altName) const

getAlternative getter of the assignment of one specified alternative

Parameters
altNamename of the alternative of which the assignment is requested
Returns
assignment of the alternative

◆ getAlternativesAssignments()

std::unordered_map<std::string, Category> AlternativesPerformance::getAlternativesAssignments ( ) const

getAlternativesPerformanceMap getter of the alternatives assignments

Returns
alt_assignment_

◆ getBoundaries()

std::pair<float, float> AlternativesPerformance::getBoundaries ( )

getBoundaries return the boundaries of the dataset: the minimal value and the maximal value found

Returns
boudary_pair with first the minimal value, and second the maximal value

◆ getNumberCats()

int AlternativesPerformance::getNumberCats ( )

getNumberCats compute the number of unique category in the dataset

Returns
n_cats

◆ setAlternativeAssignment()

void AlternativesPerformance::setAlternativeAssignment ( std::string  altName,
Category cat 
)

setAlternative getter of the assignment of one specified alternative

Parameters
altNamename of the alternative the category will be assigned to
catcategory to assign

◆ setAlternativesAssignments()

void AlternativesPerformance::setAlternativesAssignments ( std::unordered_map< std::string, Category > &  alt_assignment)

setAlternativesPerformanceMap getter of the alternatives assignments

Parameters
alt_assignmentassignment map

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