Square pairwise comparison table over a named list of alternatives.
More...
#include <pairwise.hpp>
|
|
| PairwiseJudgments ()=default |
| | Default-constructs an empty table.
|
| |
| | PairwiseJudgments (std::vector< std::string > alternatives) |
| | Constructs a table with the given alternative names.
|
| |
| std::size_t | size () const noexcept |
| |
| bool | empty () const noexcept |
| |
| const std::vector< std::string > & | alternatives () const noexcept |
| |
| const Matrix & | matrix () const noexcept |
| |
| bool | has_alternative (const std::string &name) const |
| |
| std::size_t | index_of (const std::string &name) const |
| |
| void | add_alternative (const std::string &name, bool ignore_existing=false) |
| | Appends an alternative (diagonal 1).
|
| |
| void | remove_alternative (const std::string &name, bool ignore_missing=false) |
| | Removes an alternative and its row/column.
|
| |
| void | rename_alternative (const std::string &old_name, const std::string &new_name) |
| | Renames an alternative in place (keeps matrix values).
|
| |
| void | set_comparison (std::size_t i, std::size_t j, double value) |
| | Sets comparison by index.
|
| |
| void | set_comparison (const std::string &a, const std::string &b, double value) |
| | Sets comparison by alternative name.
|
| |
| double | comparison (std::size_t i, std::size_t j) const |
| |
| double | comparison (const std::string &a, const std::string &b) const |
| |
| Vector | priorities (const EigenOptions &options={}) const |
| |
| double | consistency_ratio (ConsistencyOptions options={}) const |
| |
Square pairwise comparison table over a named list of alternatives.
◆ PairwiseJudgments()
| anpcpp::PairwiseJudgments::PairwiseJudgments |
( |
std::vector< std::string > |
alternatives | ) |
|
|
explicit |
Constructs a table with the given alternative names.
- Parameters
-
| alternatives | Ordered list of names (diagonal initialized to 1). |
◆ add_alternative()
| void anpcpp::PairwiseJudgments::add_alternative |
( |
const std::string & |
name, |
|
|
bool |
ignore_existing = false |
|
) |
| |
Appends an alternative (diagonal 1).
- Parameters
-
| name | Alternative name. |
| ignore_existing | If true, no-op when already present; else throws. |
◆ alternatives()
| const std::vector< std::string > & anpcpp::PairwiseJudgments::alternatives |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- Ordered alternative names.
◆ comparison() [1/2]
| double anpcpp::PairwiseJudgments::comparison |
( |
const std::string & |
a, |
|
|
const std::string & |
b |
|
) |
| const |
- Returns
- Comparison value for alternatives
a and b.
◆ comparison() [2/2]
| double anpcpp::PairwiseJudgments::comparison |
( |
std::size_t |
i, |
|
|
std::size_t |
j |
|
) |
| const |
- Returns
- Comparison value at (
i, j).
◆ consistency_ratio()
| double anpcpp::PairwiseJudgments::consistency_ratio |
( |
ConsistencyOptions |
options = {} | ) |
const |
- Returns
- Saaty consistency ratio.
◆ empty()
| bool anpcpp::PairwiseJudgments::empty |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- True if there are no alternatives.
◆ has_alternative()
| bool anpcpp::PairwiseJudgments::has_alternative |
( |
const std::string & |
name | ) |
const |
- Returns
- True if
name is in the alternative list.
◆ index_of()
| std::size_t anpcpp::PairwiseJudgments::index_of |
( |
const std::string & |
name | ) |
const |
- Returns
- Index of
name.
- Exceptions
-
| std::out_of_range | if not found. |
◆ matrix()
| const Matrix & anpcpp::PairwiseJudgments::matrix |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- Underlying comparison matrix.
◆ priorities()
- Returns
- Normalized priority vector from the comparison matrix.
◆ remove_alternative()
| void anpcpp::PairwiseJudgments::remove_alternative |
( |
const std::string & |
name, |
|
|
bool |
ignore_missing = false |
|
) |
| |
Removes an alternative and its row/column.
- Parameters
-
| name | Alternative to remove. |
| ignore_missing | If true, no-op when absent; else throws. |
◆ rename_alternative()
| void anpcpp::PairwiseJudgments::rename_alternative |
( |
const std::string & |
old_name, |
|
|
const std::string & |
new_name |
|
) |
| |
Renames an alternative in place (keeps matrix values).
- Exceptions
-
| std::invalid_argument | if old_name is missing or new_name clashes. |
◆ set_comparison() [1/2]
| void anpcpp::PairwiseJudgments::set_comparison |
( |
const std::string & |
a, |
|
|
const std::string & |
b, |
|
|
double |
value |
|
) |
| |
Sets comparison by alternative name.
- Parameters
-
| a | First alternative. |
| b | Second alternative. |
| value | Comparison value (reciprocal applied automatically). |
◆ set_comparison() [2/2]
| void anpcpp::PairwiseJudgments::set_comparison |
( |
std::size_t |
i, |
|
|
std::size_t |
j, |
|
|
double |
value |
|
) |
| |
Sets comparison by index.
- Parameters
-
| i | Row index. |
| j | Column index. |
| value | a_ij; reciprocal set for a_ji unless 0 (incomplete). |
◆ size()
| std::size_t anpcpp::PairwiseJudgments::size |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- Number of alternatives (matrix order).
The documentation for this class was generated from the following file: