|
Project
|
PerformanceTable data structure. More...
#include <PerformanceTable.h>

Public Member Functions | |
| 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< Perf > | operator[] (std::string name) |
| Perf | getPerf (std::string name, std::string crit) |
| void | sort (std::string mode="crit") |
| void | changeMode (std::string mode) |
| std::vector< Perf > | getAltBetweenSorted (std::string critId, float inf, float sup) |
| std::vector< Perf > | getAltBetween (std::string critId, float inf, float sup) |
| std::vector< Perf > | getBestPerfByCrit (Criteria &crits) |
| std::vector< Perf > | getWorstPerfByCrit (Criteria &crits) |
| bool | isAltInTable (std::string altName) |
| int | getNumberCrit () |
| int | getNumberAlt () |
| void | display () |
| bool | operator== (const PerformanceTable &pt) const |
Protected Attributes | |
| std::vector< std::vector< Perf > > | pt_ |
| std::string | mode_ = "alt" |
| bool | sorted_ = false |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const PerformanceTable &perfs) |
PerformanceTable data structure.
PerformanceTable is a table of Perf objects. It is a Mathematical datastructure that can be interpreted as a Matrix if a few conditions are met, or a vector of vector if the column order cannot be guaranteed.
The PerformanceTable has to mode of representation: crit and alt.
The Perf table can be interpreted as a Matrix if the second dimension has the same order for all row.
This datastructure was designed to be itterated over easily, thus the access time of a certain element (like in a hashmap) is in O(n_crit * n_alt) which is absolutely inefficient and should be avoided.
| PerformanceTable::PerformanceTable | ( | std::vector< std::vector< Perf >> & | perf_vect, |
| std::string | mode = "alt" |
||
| ) |
PerformanceTable constructor with defined vector of performance that represents the PerformanceTable in a certain mode. All Vector of Perf objects should have the same criteria. Need to give the mode of the Performance table that is either "alt" or "crit".
| perf_vect | Vector of performance |
| PerformanceTable::PerformanceTable | ( | int | nb_of_perfs, |
| Criteria & | crits, | ||
| std::string | prefix = "alt" |
||
| ) |
PerformanceTable constructor without perf values but set of criteria to evaluate performance over. perf values will be set to 0.
| prefix | Prefix to use for the name of each Performance created |
| nb_of_perfs | Number of performance |
| crits | Criteria to evaluate performance over |
| PerformanceTable::PerformanceTable | ( | const PerformanceTable & | perfs | ) |
Performances constructor by copy
| perfs | Based performances to copy |
| void PerformanceTable::changeMode | ( | std::string | mode | ) |
changeMode Change the assigned mode to the performance table given the selected one: alt or crit. alt mode will assign the first dimension to alt and second to crit. crit mode will assign the first dimension to crit and the second dimension to alt.
| mode | selected pt mode (alt or crit) |
| void PerformanceTable::display | ( | ) |
Display PerformanceTable in a nice manner. Please be advised that this method might be counter intuitive since elements do not necessarly have a correct order depending on the mode
| void PerformanceTable::generateRandomPerfValues | ( | unsigned long int | seed = time(NULL), |
| int | lower_bound = 0, |
||
| int | upper_bound = 1 |
||
| ) |
| std::vector<Perf> PerformanceTable::getAltBetween | ( | std::string | critId, |
| float | inf, | ||
| float | sup | ||
| ) |
getAltBetween return all the alternatives / profiles that have a performance (value) between inf and sup on criterion crit. The performance table does not need to be sorted before calling this function.
| critId | crit Id to look for |
| inf | inferior boudary |
| sup | superior boundary |
| std::vector<Perf> PerformanceTable::getAltBetweenSorted | ( | std::string | critId, |
| float | inf, | ||
| float | sup | ||
| ) |
getAltBetween return all the alternatives / profiles that have a performance (value) between inf and sup on criterion crit. The performance table must have been sorted and in mode crit before calling this function.
| critId | crit Id to look for |
| inf | inferior boudary |
| sup | superior boundary |
getBestPerfByRow return a perf vector with the best performance of the alternatives on each criteria
| crits | Criteria to search in the performance table |
| std::string PerformanceTable::getMode | ( | ) | const |
getMode getter of the mode of the performance table
| int PerformanceTable::getNumberAlt | ( | ) |
getNumberAlt return the amount of alts in the table
| int PerformanceTable::getNumberCrit | ( | ) |
getNumberCrit return the amount of crits in the table
| Perf PerformanceTable::getPerf | ( | std::string | name, |
| std::string | crit | ||
| ) |
getPerf getter of a specific Perf in the performance table. This is highly inneficient and should not be used except for tests or exceptionnal checks.
| name | name of the alt or profile we want |
| crit | name of the crit we want |
| std::vector<std::vector<Perf> > PerformanceTable::getPerformanceTable | ( | ) | const |
getPerformanceTable getter of performance table parameter
getWorstPerfByRow return a perf vector with the worst performance of the alternatives on each criteria
| crits | Criteria to search in the performance table |
| bool PerformanceTable::isAltInTable | ( | std::string | altName | ) |
findAlt return true if the alternative is in the performance table
| altName | Alternative to lookup |
| bool PerformanceTable::isSorted | ( | ) | const |
isSorted getter of the sorted variable
| bool PerformanceTable::operator== | ( | const PerformanceTable & | pt | ) | const |
Overload of == operator for PerformanceTable object. It compares the name, criteria and values of the PerformanceTable.
| pt | PerformanceTable object to compare it with |
| std::vector<Perf> PerformanceTable::operator[] | ( | std::string | name | ) |
Overloading [] operator for PerformanceTable. If the current mode is crit, will search for the row with the crit name given. If current mode is alt, will search for the row with the alternative (or profile) name given.
| name | name of the row we want to search |
| void PerformanceTable::sort | ( | std::string | mode = "crit" | ) |
sort Sort the performance table given the selected mode: alt or crit. Sorted by alt will assign the first dimension to alt and sort the second by crit. Sorting by crit will assign the first dimension to crit and sort the second dimension by alt.
| mode | selected pt mode (alt or crit) |