|
anpcpp 0.4.0
Analytic Network Process computational library
|
Analytic Network Process computational library. More...
Classes | |
| class | AnpCluster |
| A group of nodes (and cluster-level pairwise comparisons). More... | |
| class | AnpNetwork |
| Root ANP model: structure, judgments, supermatrices, and priorities. More... | |
| class | AnpNode |
| A decision element within a cluster (may own a subnetwork). More... | |
| struct | ConsistencyOptions |
| Options for consistency. More... | |
| struct | ConsistencyResult |
| Full consistency analysis result. More... | |
| class | ConvergenceError |
| Thrown when power iteration fails to converge within max_iterations. More... | |
| class | DimensionError |
| Thrown when vector/matrix dimensions do not match an operation. More... | |
| struct | DivideByConstantInterpreter |
| Divide each raw value by a fixed positive constant. More... | |
| struct | DivideByMaxInterpreter |
| Divide each raw value by the max among present values. More... | |
| struct | EigenOptions |
| Options controlling principal eigen computation. More... | |
| struct | EigenResult |
| Result of principal_eigen. More... | |
| struct | IdentityInterpreter |
| Pass-through interpreter (values already in [0, 1]). More... | |
| struct | InfluenceMarginalEntry |
| Smart-(p_0) marginal influence for one row or alternative. More... | |
| struct | InfluenceRankEntry |
| Rank-influence result for one row (or one alternative under a fixed Wrt). More... | |
| struct | InfluenceRawEntry |
| One alternative's raw (fixed-distance) influence result. More... | |
| struct | InfluenceTotalEntry |
| Fixed-distance total influence for one row (pyanp influence_fixed Total). More... | |
| class | JsonIoError |
| Thrown on JSON parse, validation, or I/O errors. More... | |
| struct | JudgmentFillCounts |
| Filled vs needed judgment counts for coverage grids. More... | |
| struct | JudgmentGroup |
| Named subset of participants for group-scope analysis. More... | |
| struct | JudgmentParticipant |
| A judge on a model (model-scoped, not an app account). More... | |
| struct | JudgmentSession |
| Document session: which judgments are active for editing/calc. More... | |
| struct | LimitMatrixOptions |
| Options for limit-matrix calculation. More... | |
| class | Matrix |
| Dense row-major matrix stored in a flat buffer. More... | |
| struct | MinMaxNormalizeInterpreter |
| Map the column's [min, max] onto [0, 1]. More... | |
| struct | NodePrioritizerSlot |
| Stores either pairwise or ratings judgments for one dest cluster. More... | |
| struct | P0Mode |
| (p_0) selection for row_adjust. More... | |
| struct | PairwiseCellDisagreement |
| Disagreement stats for one pairwise upper-triangle cell. More... | |
| class | PairwiseJudgments |
| Square pairwise comparison table over a named list of alternatives. More... | |
| struct | PiecewiseLinearInterpreter |
| Piecewise-linear map from raw value to [0, 1] via sorted knots. More... | |
| struct | RatingCategory |
| A named rating category with an associated score in [0, 1]. More... | |
| struct | RatingsAltDisagreement |
| Disagreement stats for one ratings alternative. More... | |
| class | RatingsPrioritizer |
| Ratings table over named alternatives for one (wrt node, dest cluster). More... | |
| class | SynthesisError |
| Thrown when synthesis or expression evaluation fails. More... | |
| struct | SynthesisOptions |
| Synthesis configuration for networks with subnetworks. More... | |
| class | Vector |
| One-dimensional array of doubles with element-wise arithmetic. More... | |
| struct | VoteSpreadSummary |
| Summary of collected votes for one comparison / ratings alternative. More... | |
Typedefs | |
| using | ScoreInterpreter = std::variant< IdentityInterpreter, DivideByMaxInterpreter, DivideByConstantInterpreter, MinMaxNormalizeInterpreter, PiecewiseLinearInterpreter > |
| Declarative raw-value → [0, 1] interpreter (JSON-serializable). | |
Enumerations | |
| enum class | LimitMatrixMethod { Calculus , NewHierarchy , Sinks } |
| SuperDecisions / pyanp limit-matrix algorithm. More... | |
| enum class | JudgmentScopeKind { Average , Participant , Group } |
| Whose judgments feed the effective calc slot. More... | |
| enum class | NodePrioritizerKind |
| Active prioritizer kind for a node → destination-cluster link. | |
| enum class | P0ModeKind { Direct , Smart , OriginalWeight } |
| How resting parameter (p_0) is chosen for row sensitivity. More... | |
| enum class | SynthesisKind { Additive , Multiplicative , Custom } |
| How control-node subnetwork scores are combined. More... | |
Functions | |
| Matrix | harker_fix (const Matrix &mat) |
| Applies Harker's fix for incomplete pairwise matrices. | |
| EigenResult | principal_eigen (const Matrix &mat, const EigenOptions &options={}) |
| Power iteration with sum-normalization (pyanp pri_eigen compatible). | |
| Vector | principal_eigenvector (const Matrix &mat, const EigenOptions &options={}) |
| Returns the principal eigenvector only. | |
| double | principal_eigenvalue (const Matrix &mat, const EigenOptions &options={}) |
| Returns the principal eigenvalue only. | |
| double | random_index (std::size_t n) |
Saaty random index (RI) for matrix order n. | |
| double | consistency_index (double lambda_max, std::size_t n) |
| Consistency index CI = (lambda_max - n) / (n - 1). | |
| double | consistency_ratio (double lambda_max, std::size_t n) |
| Consistency ratio CR = CI / RI. | |
| ConsistencyResult | consistency (const Matrix &mat, ConsistencyOptions options={}) |
| Computes Saaty CI and CR for a pairwise comparison matrix. | |
| double | consistency_index (const Matrix &mat, ConsistencyOptions options={}) |
| Consistency index from a matrix (throws on non-convergence). | |
| double | consistency_ratio (const Matrix &mat, ConsistencyOptions options={}) |
| Consistency ratio from a matrix (throws on non-convergence). | |
| std::string | network_to_json (const AnpNetwork &network) |
| Serializes a network (including subnetworks and layout hints) to JSON. | |
| std::unique_ptr< AnpNetwork > | network_from_json (const std::string &json_text) |
| Parses JSON produced by network_to_json. | |
| void | save_network_file (const AnpNetwork &network, const std::string &path) |
| Writes a network to a file. | |
| std::unique_ptr< AnpNetwork > | load_network_file (const std::string &path) |
| Loads a network from a file. | |
| Matrix | column_normalize (const Matrix &mat) |
| Column-normalizes each column by its sum (pyanp normalize). | |
| void | column_normalize_inplace (Matrix &mat) |
| In-place column_normalize. | |
| Matrix | hierarchy_formula (const Matrix &mat) |
| Hierarchy limit formula: normalize(sum of W^k for k=1..n-1). | |
| std::vector< std::size_t > | hierarchy_nodes (const Matrix &mat) |
| Indices of hierarchical nodes (zero columns of W^n); pyanp hierarchy_nodes. | |
| Matrix | calculus_limit (const Matrix &mat, const LimitMatrixOptions &options={}) |
| SuperDecisions / pyanp calculus limit matrix. | |
| Matrix | limit_sinks (const Matrix &mat, const LimitMatrixOptions &options={}) |
| Limit-with-sinks calculation (pyanp limit_sinks). | |
| Matrix | limit_newhierarchy (const Matrix &mat, const LimitMatrixOptions &options={}) |
| New Hierarchy limit calculation (pyanp limit_newhierarchy). | |
| Matrix | compute_limit_matrix (const Matrix &mat, const LimitMatrixOptions &options={}) |
Dispatch to the algorithm selected by options.method. | |
| Vector | priority_from_limit (const Matrix &limit_matrix) |
| Row sums of the limit matrix, L1-normalized (pyanp priority_from_limit). | |
| void | aggregate_pairwise_geometric (const std::vector< const PairwiseJudgments * > &inputs, PairwiseJudgments &out) |
Geometric mean of pairwise ratios into out (same alternatives). | |
| void | aggregate_ratings_arithmetic (const std::vector< const RatingsPrioritizer * > &inputs, const RatingsPrioritizer &scale_template, RatingsPrioritizer &out) |
Arithmetic mean of rating intensity scores into out. | |
| void | copy_pairwise_into (const PairwiseJudgments &src, PairwiseJudgments &out) |
Copy src pairwise into out (alternatives aligned to out). | |
| void | copy_ratings_votes_into (const RatingsPrioritizer &src, RatingsPrioritizer &out) |
Copy votes from src into out, syncing mode/scale from src. | |
| std::vector< std::vector< PairwiseCellDisagreement > > | pairwise_disagreement (const std::vector< const PairwiseJudgments * > &inputs) |
Per upper-triangle cell max/min ratio across inputs. | |
| std::vector< RatingsAltDisagreement > | ratings_disagreement (const std::vector< const RatingsPrioritizer * > &inputs, const std::vector< std::string > &alt_order={}) |
Per-alternative intensity range across inputs. | |
| JudgmentFillCounts | pairwise_fill_counts (const PairwiseJudgments &pw) |
| Count filled upper-triangle cells (comparison != 0) vs needed. | |
| JudgmentFillCounts | ratings_fill_counts (const RatingsPrioritizer &rt) |
| Count present ratings votes vs number of alternatives. | |
| double | pairwise_alignment_pct (double min_v, double max_v) |
| Pairwise alignment from min/max ratios. | |
| double | ratings_alignment_pct (double range, double full_scale) |
Ratings alignment from intensity range vs full_scale. | |
| VoteSpreadSummary | summarize_pairwise_votes (const std::vector< double > &values) |
| Geometric mean / SD spread for positive pairwise ratios. | |
| VoteSpreadSummary | summarize_ratings_votes (const std::vector< double > &values, double full_scale=1.0) |
| Arithmetic mean / SD spread for ratings intensities. | |
| std::vector< std::optional< double > > | apply_score_interpreter (const ScoreInterpreter &interpreter, const std::vector< std::optional< double > > &raw) |
Apply interpreter to a column of optional raw values. | |
| Matrix | row_adjust (const Matrix &mat, std::size_t row, double p, const P0Mode &p0mode=P0Mode::Direct(0.5), const std::vector< std::size_t > &cluster_nodes={}) |
Adjusts row row of scaled supermatrix mat to parameter p. | |
| double | smart_p0 (const Matrix &mat, std::size_t row, std::size_t cont_alt, const std::vector< std::size_t > &cluster_nodes={}, const LimitMatrixOptions &options={}) |
Smart resting (p_0) making score of cont_alt continuous at (p_0). | |
| Vector | priority_after_row_adjust (const Matrix &mat, std::size_t row, double p, const P0Mode &p0mode=P0Mode::Direct(0.5), const std::vector< std::size_t > &cluster_nodes={}, const LimitMatrixOptions &options={}, bool normalize_to_orig=true) |
| Priorities after row adjust (pyanp row_adjust_priority, normalize_to_orig). | |
| Vector | influence_marginal (const Matrix &mat, std::size_t row, double p0, int left_or_right=0, double delta=1e-6, const std::vector< std::size_t > &influence_nodes={}, const std::vector< std::size_t > &cluster_nodes={}, const LimitMatrixOptions &options={}) |
| Marginal influence (finite difference) at a direct (p_0). | |
| std::vector< InfluenceMarginalEntry > | influence_marginal_smart (const Matrix &mat, std::size_t row, const std::vector< std::size_t > &influence_nodes, const std::vector< std::string > &names, const std::vector< std::size_t > &cluster_nodes={}, double delta=1e-6, const LimitMatrixOptions &options={}) |
| Per-alternative smart-(p_0) marginal influence (single value each). | |
| std::vector< InfluenceRawEntry > | influence_raw (const Matrix &mat, std::size_t row, const std::vector< std::size_t > &influence_nodes, const std::vector< std::string > &names, double delta_up=0.1, double delta_down=0.1, double p0=0.5, const std::vector< std::size_t > &cluster_nodes={}, const LimitMatrixOptions &options={}) |
| Raw fixed-distance influence table (original / up / down scores). | |
| std::vector< InfluenceRankEntry > | influence_rank (const Matrix &mat, std::size_t row, const std::vector< std::size_t > &influence_nodes, const std::vector< std::string > &names, const std::vector< std::size_t > &cluster_nodes={}, double error=1e-5, int round_to_decimal=5, const LimitMatrixOptions &options={}) |
| Rank influence score per alternative (max of upper/lower searches). | |
| InfluenceTotalEntry | influence_total_row (const Matrix &mat, std::size_t row, const std::vector< std::size_t > &influence_nodes, double delta=0.25, double p0=0.5, const std::vector< std::size_t > &cluster_nodes={}, const LimitMatrixOptions &options={}) |
| Fixed-distance total influence for one row (L1 and max of abs diffs). | |
| std::vector< InfluenceTotalEntry > | influence_total (const Matrix &mat, const std::vector< std::size_t > &rows, const std::vector< std::string > &row_names, const std::vector< std::size_t > &influence_nodes, double delta=0.25, double p0=0.5, const std::vector< std::size_t > &cluster_nodes={}, const LimitMatrixOptions &options={}) |
Per-row total influence (pyanp multi-row influence_fixed Totals). | |
| Vector | perspective (const Matrix &mat, std::size_t row, const P0Mode &p0mode=P0Mode::Direct(0.5), const std::vector< std::size_t > &cluster_nodes={}, const LimitMatrixOptions &options={}, bool normalize_to_orig=true) |
| Perspective of one row: limit as p approaches 1 of row sensitivity. | |
| Matrix | perspective_matrix (const Matrix &mat, const std::vector< std::size_t > &rows={}, const P0Mode &p0mode=P0Mode::Direct(0.5), const std::vector< std::size_t > &cluster_nodes={}, const LimitMatrixOptions &options={}, bool normalize_to_orig=true) |
Perspective matrix: column j is perspective for rows[j]. | |
| std::map< std::string, double > | synthesize_additive (const std::map< std::string, double > &subnet_weights, const std::map< std::string, std::map< std::string, double > > &alt_scores) |
| Weighted average synthesis (matches AnpNetwork::sum_subnetwork_formula). | |
| std::map< std::string, double > | synthesize_multiplicative (const std::map< std::string, double > &subnet_weights, const std::map< std::string, std::map< std::string, double > > &alt_scores) |
| Multiplicative synthesis: product of score^weight per alt, then L1-normalize. | |
| std::map< std::string, double > | synthesize_custom (const std::string &expression, const std::map< std::string, std::map< std::string, double > > &alt_scores, const std::vector< std::string > &alt_order, const std::map< std::string, double > &subnet_weights={}) |
| Custom expression synthesis per alternative. | |
| std::map< std::string, double > | synthesize (const SynthesisOptions &options, const std::map< std::string, double > &subnet_weights, const std::map< std::string, std::map< std::string, double > > &alt_scores, const std::vector< std::string > &alt_order) |
| Dispatches on SynthesisOptions::kind. | |
| double | eval_expression (const std::string &expression, const std::map< std::string, double > &variables) |
| Evaluates a numeric expression with named variables. | |
Analytic Network Process computational library.
|
strong |
|
strong |
|
strong |
|
strong |
| void anpcpp::aggregate_pairwise_geometric | ( | const std::vector< const PairwiseJudgments * > & | inputs, |
| PairwiseJudgments & | out | ||
| ) |
Geometric mean of pairwise ratios into out (same alternatives).
For each upper-triangle cell, averages only inputs with a positive finite ratio. Incomplete cells (0) are skipped. If no contributor, leaves 0.
| void anpcpp::aggregate_ratings_arithmetic | ( | const std::vector< const RatingsPrioritizer * > & | inputs, |
| const RatingsPrioritizer & | scale_template, | ||
| RatingsPrioritizer & | out | ||
| ) |
Arithmetic mean of rating intensity scores into out.
out is set to Numeric + Identity; values are the mean of each contributor's RatingsPrioritizer::scores for that alternative (missing scores skipped). Shared categories/interpreter from scale_template are copied onto out for reference but mode is Numeric for exact means.
| std::vector< std::optional< double > > anpcpp::apply_score_interpreter | ( | const ScoreInterpreter & | interpreter, |
| const std::vector< std::optional< double > > & | raw | ||
| ) |
Apply interpreter to a column of optional raw values.
Missing entries stay nullopt. Present entries become scores in [0, 1] (clamped). Interpreters that need column statistics ignore missing cells.
| Matrix anpcpp::calculus_limit | ( | const Matrix & | mat, |
| const LimitMatrixOptions & | options = {} |
||
| ) |
SuperDecisions / pyanp calculus limit matrix.
| mat | Column-stochastic supermatrix. |
| options | Iteration and hierarchy options. |
Column-normalizes each column by its sum (pyanp normalize).
| void anpcpp::column_normalize_inplace | ( | Matrix & | mat | ) |
In-place column_normalize.
| mat | Matrix to normalize. |
| ConsistencyResult anpcpp::consistency | ( | const Matrix & | mat, |
| ConsistencyOptions | options = {} |
||
| ) |
Computes Saaty CI and CR for a pairwise comparison matrix.
| mat | Square comparison matrix. |
| options | Harker and eigen options. |
| double anpcpp::consistency_index | ( | const Matrix & | mat, |
| ConsistencyOptions | options = {} |
||
| ) |
Consistency index from a matrix (throws on non-convergence).
| mat | Square comparison matrix. |
| options | Harker and eigen options. |
| double anpcpp::consistency_index | ( | double | lambda_max, |
| std::size_t | n | ||
| ) |
Consistency index CI = (lambda_max - n) / (n - 1).
| double anpcpp::consistency_ratio | ( | const Matrix & | mat, |
| ConsistencyOptions | options = {} |
||
| ) |
Consistency ratio from a matrix (throws on non-convergence).
| mat | Square comparison matrix. |
| options | Harker and eigen options. |
| double anpcpp::consistency_ratio | ( | double | lambda_max, |
| std::size_t | n | ||
| ) |
Consistency ratio CR = CI / RI.
| double anpcpp::eval_expression | ( | const std::string & | expression, |
| const std::map< std::string, double > & | variables | ||
| ) |
Evaluates a numeric expression with named variables.
| expression | Infix expression (+ - * / parentheses). |
| variables | Name -> value substitutions. |
Applies Harker's fix for incomplete pairwise matrices.
Each row diagonal becomes 1 + (number of zero off-diagonal entries in that row), enabling power iteration on incomplete comparisons.
| mat | Square pairwise matrix. |
Hierarchy limit formula: normalize(sum of W^k for k=1..n-1).
mat is not a hierarchy. | Vector anpcpp::influence_marginal | ( | const Matrix & | mat, |
| std::size_t | row, | ||
| double | p0, | ||
| int | left_or_right = 0, |
||
| double | delta = 1e-6, |
||
| const std::vector< std::size_t > & | influence_nodes = {}, |
||
| const std::vector< std::size_t > & | cluster_nodes = {}, |
||
| const LimitMatrixOptions & | options = {} |
||
| ) |
Marginal influence (finite difference) at a direct (p_0).
| mat | Scaled (column-stochastic) supermatrix. |
| row | Row index (Wrt node). |
| p0 | Direct resting parameter. |
| left_or_right | <0 LHS, >0 RHS, 0 average. |
| delta | Finite-difference step. |
| influence_nodes | Nodes whose scores are reported (empty = all but row). |
| cluster_nodes | Cluster row indices (empty = full matrix). |
| options | Limit-matrix options. |
| std::vector< InfluenceMarginalEntry > anpcpp::influence_marginal_smart | ( | const Matrix & | mat, |
| std::size_t | row, | ||
| const std::vector< std::size_t > & | influence_nodes, | ||
| const std::vector< std::string > & | names, | ||
| const std::vector< std::size_t > & | cluster_nodes = {}, |
||
| double | delta = 1e-6, |
||
| const LimitMatrixOptions & | options = {} |
||
| ) |
Per-alternative smart-(p_0) marginal influence (single value each).
| mat | Scaled (column-stochastic) supermatrix. |
| row | Row index (Wrt node). |
| influence_nodes | Alternative indices to score. |
| names | Display names aligned with influence_nodes. |
| cluster_nodes | Cluster row indices (empty = full matrix). |
| delta | Finite-difference step. |
| options | Limit-matrix options. |
| std::vector< InfluenceRankEntry > anpcpp::influence_rank | ( | const Matrix & | mat, |
| std::size_t | row, | ||
| const std::vector< std::size_t > & | influence_nodes, | ||
| const std::vector< std::string > & | names, | ||
| const std::vector< std::size_t > & | cluster_nodes = {}, |
||
| double | error = 1e-5, |
||
| int | round_to_decimal = 5, |
||
| const LimitMatrixOptions & | options = {} |
||
| ) |
Rank influence score per alternative (max of upper/lower searches).
| mat | Scaled (column-stochastic) supermatrix. |
| row | Row index (Wrt node). |
| influence_nodes | Alternative indices to score. |
| names | Display names aligned with influence_nodes. |
| cluster_nodes | Cluster row indices (empty = full matrix). |
| error | Binary-search tolerance on (p). |
| round_to_decimal | Decimals used when comparing ranks. |
| options | Limit-matrix options. |
| std::vector< InfluenceRawEntry > anpcpp::influence_raw | ( | const Matrix & | mat, |
| std::size_t | row, | ||
| const std::vector< std::size_t > & | influence_nodes, | ||
| const std::vector< std::string > & | names, | ||
| double | delta_up = 0.1, |
||
| double | delta_down = 0.1, |
||
| double | p0 = 0.5, |
||
| const std::vector< std::size_t > & | cluster_nodes = {}, |
||
| const LimitMatrixOptions & | options = {} |
||
| ) |
Raw fixed-distance influence table (original / up / down scores).
| mat | Scaled (column-stochastic) supermatrix. |
| row | Row index (Wrt node). |
| influence_nodes | Alternative indices to score. |
| names | Display names aligned with influence_nodes. |
| delta_up | Upward change from p0. |
| delta_down | Downward change from p0. |
| p0 | Resting parameter (typically 0.5). |
| cluster_nodes | Cluster row indices (empty = full matrix). |
| options | Limit-matrix options. |
| std::vector< InfluenceTotalEntry > anpcpp::influence_total | ( | const Matrix & | mat, |
| const std::vector< std::size_t > & | rows, | ||
| const std::vector< std::string > & | row_names, | ||
| const std::vector< std::size_t > & | influence_nodes, | ||
| double | delta = 0.25, |
||
| double | p0 = 0.5, |
||
| const std::vector< std::size_t > & | cluster_nodes = {}, |
||
| const LimitMatrixOptions & | options = {} |
||
| ) |
Per-row total influence (pyanp multi-row influence_fixed Totals).
| mat | Scaled (column-stochastic) supermatrix. |
| rows | Row indices to score. |
| row_names | Display names aligned with rows. |
| influence_nodes | Alternative indices used for each row's diffs. |
| delta | Fixed upward change from p0. |
| p0 | Resting parameter (typically 0.5). |
| cluster_nodes | Cluster row indices (empty = full matrix). |
| options | Limit-matrix options. |
| InfluenceTotalEntry anpcpp::influence_total_row | ( | const Matrix & | mat, |
| std::size_t | row, | ||
| const std::vector< std::size_t > & | influence_nodes, | ||
| double | delta = 0.25, |
||
| double | p0 = 0.5, |
||
| const std::vector< std::size_t > & | cluster_nodes = {}, |
||
| const LimitMatrixOptions & | options = {} |
||
| ) |
Fixed-distance total influence for one row (L1 and max of abs diffs).
Matches pyanp influence_fixed for a single row, then aggregates to Total / Max Alt Change as in the multi-row case.
| mat | Scaled (column-stochastic) supermatrix. |
| row | Row index (Wrt node). |
| influence_nodes | Alternative indices to score. |
| delta | Fixed upward change from p0. |
| p0 | Resting parameter (typically 0.5). |
| cluster_nodes | Cluster row indices (empty = full matrix). |
| options | Limit-matrix options. |
| Matrix anpcpp::limit_newhierarchy | ( | const Matrix & | mat, |
| const LimitMatrixOptions & | options = {} |
||
| ) |
New Hierarchy limit calculation (pyanp limit_newhierarchy).
Splits hierarchical vs network nodes, limits each block, and reassembles.
| Matrix anpcpp::limit_sinks | ( | const Matrix & | mat, |
| const LimitMatrixOptions & | options = {} |
||
| ) |
Limit-with-sinks calculation (pyanp limit_sinks).
Splits sinks (zero columns) from nonsinks, applies calculus on the nonsink block, and reassembles.
| std::unique_ptr< AnpNetwork > anpcpp::load_network_file | ( | const std::string & | path | ) |
Loads a network from a file.
| path | Input file path. |
| JsonIoError | on read or parse failure. |
| std::unique_ptr< AnpNetwork > anpcpp::network_from_json | ( | const std::string & | json_text | ) |
Parses JSON produced by network_to_json.
| json_text | JSON document. |
| JsonIoError | on invalid or unsupported documents. |
| std::string anpcpp::network_to_json | ( | const AnpNetwork & | network | ) |
Serializes a network (including subnetworks and layout hints) to JSON.
| network | Network to serialize. |
| double anpcpp::pairwise_alignment_pct | ( | double | min_v, |
| double | max_v | ||
| ) |
Pairwise alignment from min/max ratios.
clamped to [0, 100]. Returns 100 when max/min <= 1 or count would be identical; 0 at full span.
| std::vector< std::vector< PairwiseCellDisagreement > > anpcpp::pairwise_disagreement | ( | const std::vector< const PairwiseJudgments * > & | inputs | ) |
Per upper-triangle cell max/min ratio across inputs.
Alternatives are taken from the first non-null input with size > 0. Inputs with a different size are skipped. Cells with fewer than two positive finite votes get ratio 0.
| Vector anpcpp::perspective | ( | const Matrix & | mat, |
| std::size_t | row, | ||
| const P0Mode & | p0mode = P0Mode::Direct(0.5), |
||
| const std::vector< std::size_t > & | cluster_nodes = {}, |
||
| const LimitMatrixOptions & | options = {}, |
||
| bool | normalize_to_orig = true |
||
| ) |
Perspective of one row: limit as p approaches 1 of row sensitivity.
Evaluates row sensitivity near p = 1 (never at exactly 1, which degenerates row_adjust). Compares p = 1-1e-5 and p = 1-1e-6; if they disagree beyond 1e-6 (L-inf), refines at p = 1-1e-7.
| mat | Scaled (column-stochastic) supermatrix. |
| row | Row index (Wrt node). |
| p0mode | Resting-value mode. |
| cluster_nodes | Cluster row indices (empty = full matrix). |
| options | Limit-matrix options. |
| normalize_to_orig | If true, rescale like priority_after_row_adjust. |
| Matrix anpcpp::perspective_matrix | ( | const Matrix & | mat, |
| const std::vector< std::size_t > & | rows = {}, |
||
| const P0Mode & | p0mode = P0Mode::Direct(0.5), |
||
| const std::vector< std::size_t > & | cluster_nodes = {}, |
||
| const LimitMatrixOptions & | options = {}, |
||
| bool | normalize_to_orig = true |
||
| ) |
Perspective matrix: column j is perspective for rows[j].
Empty rows means every row index 0 .. n-1.
| mat | Scaled (column-stochastic) supermatrix. |
| rows | Row indices used as columns (empty = all rows). |
| p0mode | Resting-value mode. |
| cluster_nodes | Cluster row indices (empty = full matrix). |
| options | Limit-matrix options. |
| normalize_to_orig | If true, rescale like priority_after_row_adjust. |
| EigenResult anpcpp::principal_eigen | ( | const Matrix & | mat, |
| const EigenOptions & | options = {} |
||
| ) |
Power iteration with sum-normalization (pyanp pri_eigen compatible).
Non-convergence is reported via converged == false rather than throwing.
| mat | Square matrix. |
| options | Iteration and Harker options. |
| double anpcpp::principal_eigenvalue | ( | const Matrix & | mat, |
| const EigenOptions & | options = {} |
||
| ) |
Returns the principal eigenvalue only.
| ConvergenceError | if iteration does not converge. |
| Vector anpcpp::principal_eigenvector | ( | const Matrix & | mat, |
| const EigenOptions & | options = {} |
||
| ) |
Returns the principal eigenvector only.
| ConvergenceError | if iteration does not converge. |
| Vector anpcpp::priority_after_row_adjust | ( | const Matrix & | mat, |
| std::size_t | row, | ||
| double | p, | ||
| const P0Mode & | p0mode = P0Mode::Direct(0.5), |
||
| const std::vector< std::size_t > & | cluster_nodes = {}, |
||
| const LimitMatrixOptions & | options = {}, |
||
| bool | normalize_to_orig = true |
||
| ) |
Priorities after row adjust (pyanp row_adjust_priority, normalize_to_orig).
| mat | Scaled (column-stochastic) supermatrix. |
| row | Row index (Wrt node). |
| p | Sensitivity parameter in ([0,1]). |
| p0mode | Resting-value mode. |
| cluster_nodes | Cluster row indices (empty = full matrix). |
| options | Limit-matrix options. |
| normalize_to_orig | If true, rescale so the Wrt entry matches the original. |
| double anpcpp::random_index | ( | std::size_t | n | ) |
Saaty random index (RI) for matrix order n.
n = 1,2: 0 (CR defined as 0). n = 3..15: Saaty table. n > 15: Alonso-Lamata approximation RI ≈ 1.98 * (n - 2) / n.
| double anpcpp::ratings_alignment_pct | ( | double | range, |
| double | full_scale | ||
| ) |
Ratings alignment from intensity range vs full_scale.
clamped to [0, 100].
| std::vector< RatingsAltDisagreement > anpcpp::ratings_disagreement | ( | const std::vector< const RatingsPrioritizer * > & | inputs, |
| const std::vector< std::string > & | alt_order = {} |
||
| ) |
Per-alternative intensity range across inputs.
Uses scores() for present votes (categorical rating or numeric value). Alternatives come from alt_order when non-empty; otherwise from the first non-null input.
| Matrix anpcpp::row_adjust | ( | const Matrix & | mat, |
| std::size_t | row, | ||
| double | p, | ||
| const P0Mode & | p0mode = P0Mode::Direct(0.5), |
||
| const std::vector< std::size_t > & | cluster_nodes = {} |
||
| ) |
Adjusts row row of scaled supermatrix mat to parameter p.
| mat | Scaled (column-stochastic) supermatrix. |
| row | Row index (Wrt node). |
| p | Sensitivity parameter in ([0,1]). |
| p0mode | Resting-value mode. |
| cluster_nodes | Indices in the Wrt node's cluster (including row); empty means the full matrix (all rows). |
| void anpcpp::save_network_file | ( | const AnpNetwork & | network, |
| const std::string & | path | ||
| ) |
Writes a network to a file.
| network | Network to save. |
| path | Output file path. |
| JsonIoError | on write failure. |
| double anpcpp::smart_p0 | ( | const Matrix & | mat, |
| std::size_t | row, | ||
| std::size_t | cont_alt, | ||
| const std::vector< std::size_t > & | cluster_nodes = {}, |
||
| const LimitMatrixOptions & | options = {} |
||
| ) |
Smart resting (p_0) making score of cont_alt continuous at (p_0).
| mat | Scaled (column-stochastic) supermatrix. |
| row | Row index (Wrt node). |
| cont_alt | Alternative/node index made continuous. |
| cluster_nodes | Cluster row indices (empty = full matrix). |
| options | Limit-matrix options. |
| std::map< std::string, double > anpcpp::synthesize_additive | ( | const std::map< std::string, double > & | subnet_weights, |
| const std::map< std::string, std::map< std::string, double > > & | alt_scores | ||
| ) |
Weighted average synthesis (matches AnpNetwork::sum_subnetwork_formula).
| subnet_weights | Weight per control subnet (host node name -> weight). |
| alt_scores | Per-subnet alternative scores (subnet -> alt -> score). |
| std::map< std::string, double > anpcpp::synthesize_custom | ( | const std::string & | expression, |
| const std::map< std::string, std::map< std::string, double > > & | alt_scores, | ||
| const std::vector< std::string > & | alt_order, | ||
| const std::map< std::string, double > & | subnet_weights = {} |
||
| ) |
Custom expression synthesis per alternative.
When subnet_weights has positive mass over the subnet hosts used in alt_scores, each host variable is bound to score^w (normalized weight). That is the SuperDecisions Ideal / weighted-BOCR form: for "Benefits * Opportunities / (Costs * Risks)" it evaluates B^wB * O^wO / (C^wC * R^wR). Plain weight*score would cancel in multiplicative formulas after normalization, so row sensitivity could not change rankings.
When weights are empty or all zero, variables bind to the raw scores (legacy unweighted custom formulas).
| expression | Arithmetic expression with subnet-host names as variables. |
| alt_scores | Per-subnet alternative scores. |
| alt_order | Output ordering of alternatives. |
| subnet_weights | Weight per control subnet (host node name -> weight). |