49 : std::runtime_error(message) {}
59 const std::map<std::string, double>& subnet_weights,
60 const std::map<std::string, std::map<std::string, double>>& alt_scores);
66 const std::map<std::string, double>& subnet_weights,
67 const std::map<std::string, std::map<std::string, double>>& alt_scores);
77 const std::string& expression,
78 const std::map<std::string, std::map<std::string, double>>& alt_scores,
79 const std::vector<std::string>& alt_order);
86 const std::map<std::string, double>& subnet_weights,
87 const std::map<std::string, std::map<std::string, double>>& alt_scores,
88 const std::vector<std::string>& alt_order);
96 const std::string& expression,
97 const std::map<std::string, double>& variables);
Thrown when synthesis or expression evaluation fails.
Definition synthesis.hpp:43
SynthesisError(const std::string &message)
Definition synthesis.hpp:48
Analytic Network Process computational library.
Definition eigen.hpp:14
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)
Custom expression synthesis per alternative.
double eval_expression(const std::string &expression, const std::map< std::string, double > &variables)
Evaluates a numeric expression with named variables.
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.
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.
SynthesisKind
How control-node subnetwork scores are combined.
Definition synthesis.hpp:18
@ Multiplicative
Product of subnet scores across control nodes, then normalize.
@ Additive
Weighted average of subnet scores (pyanp default).
@ Custom
Custom expression over subnet-host node names.
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).
Synthesis configuration for networks with subnetworks.
Definition synthesis.hpp:30
SynthesisKind kind
Selected synthesis method.
Definition synthesis.hpp:32
std::string custom_expr
Expression when kind == Custom.
Definition synthesis.hpp:37