|
anpcpp 0.4.0
Analytic Network Process computational library
|
Ratings table over named alternatives for one (wrt node, dest cluster). More...
#include <ratings.hpp>
Public Types | |
| enum class | Mode |
| How alternative ratings are stored. | |
Public Member Functions | |
| RatingsPrioritizer ()=default | |
| Default-constructs an empty numeric ratings table. | |
| RatingsPrioritizer (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 |
| 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 with a missing rating. | |
| void | remove_alternative (const std::string &name, bool ignore_missing=false) |
| Removes an alternative and its rating. | |
| void | rename_alternative (const std::string &old_name, const std::string &new_name) |
| Renames an alternative in place (keeps rating values). | |
| Mode | mode () const noexcept |
| void | set_mode (Mode mode) |
| Sets storage mode (does not clear the other mode's data). | |
| const std::vector< RatingCategory > & | categories () const noexcept |
| void | set_categories (std::vector< RatingCategory > categories) |
| Replaces the category list. | |
| const ScoreInterpreter & | interpreter () const noexcept |
| void | set_interpreter (ScoreInterpreter interpreter) |
| Sets the numeric score interpreter. | |
| void | set_rating (const std::string &alt, const std::string &category_id) |
Sets a categorical rating for alt. | |
| void | clear_rating (const std::string &alt) |
Clears the categorical rating for alt. | |
| std::optional< std::string > | rating (const std::string &alt) const |
| void | set_value (const std::string &alt, double raw) |
Sets a numeric raw value for alt. | |
| void | clear_value (const std::string &alt) |
Clears the numeric value for alt. | |
| std::optional< double > | value (const std::string &alt) const |
| Vector | scores () const |
| Intensity scores in [0, 1] (missing → 0). | |
| Vector | priorities () const |
| L1-normalized priorities over present (non-missing) scores. | |
Ratings table over named alternatives for one (wrt node, dest cluster).
Produces intensity scores and L1-normalized priorities for the unscaled supermatrix column (same contract as pairwise priorities).
|
explicit |
Constructs a table with the given alternative names.
| alternatives | Ordered alternative names. |
| void anpcpp::RatingsPrioritizer::add_alternative | ( | const std::string & | name, |
| bool | ignore_existing = false |
||
| ) |
Appends an alternative with a missing rating.
| name | Alternative name to append. |
| ignore_existing | If true, no-op when already present; else throws. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
| bool anpcpp::RatingsPrioritizer::has_alternative | ( | const std::string & | name | ) | const |
name is in the alternative list. | std::size_t anpcpp::RatingsPrioritizer::index_of | ( | const std::string & | name | ) | const |
name. | std::invalid_argument | if not found. |
|
inlinenoexcept |
|
inlinenoexcept |
| Vector anpcpp::RatingsPrioritizer::priorities | ( | ) | const |
L1-normalized priorities over present (non-missing) scores.
Missing alternatives contribute 0. Empty / all-missing → zero vector.
| std::optional< std::string > anpcpp::RatingsPrioritizer::rating | ( | const std::string & | alt | ) | const |
alt, if set. | void anpcpp::RatingsPrioritizer::remove_alternative | ( | const std::string & | name, |
| bool | ignore_missing = false |
||
| ) |
Removes an alternative and its rating.
| name | Alternative name to remove. |
| ignore_missing | If true, no-op when absent; else throws. |
| void anpcpp::RatingsPrioritizer::rename_alternative | ( | const std::string & | old_name, |
| const std::string & | new_name | ||
| ) |
Renames an alternative in place (keeps rating values).
| std::invalid_argument | if old_name is missing or new_name clashes. |
| Vector anpcpp::RatingsPrioritizer::scores | ( | ) | const |
Intensity scores in [0, 1] (missing → 0).
Categorical: category values. Numeric: interpreter applied to raw values.
| void anpcpp::RatingsPrioritizer::set_categories | ( | std::vector< RatingCategory > | categories | ) |
Replaces the category list.
| std::invalid_argument | if any value is outside [0, 1] or ids clash. |
| void anpcpp::RatingsPrioritizer::set_rating | ( | const std::string & | alt, |
| const std::string & | category_id | ||
| ) |
Sets a categorical rating for alt.
| alt | Alternative name. |
| category_id | Must match a category id, or empty to clear. |
| std::invalid_argument | if alt or category id is unknown. |
| void anpcpp::RatingsPrioritizer::set_value | ( | const std::string & | alt, |
| double | raw | ||
| ) |
Sets a numeric raw value for alt.
| std::invalid_argument | if alt is unknown. |
|
inlinenoexcept |
| std::optional< double > anpcpp::RatingsPrioritizer::value | ( | const std::string & | alt | ) | const |
alt, if set.