Skip to content

Advanced Usage

Marcus Ackre Medina edited this page Sep 13, 2026 · 1 revision

Advanced Usage

Aggregation strategies

Set with .WithAggregation(AggregationType.X). Controls how the weighted per-criterion scores combine into one final score per option:

Strategy Behavior Use it when
WeightedAverage Σ(score × weight) The default, balanced choice for most decisions
GeometricMean Weighted geometric mean You want to prevent one great criterion from compensating for a terrible one
HarmonicMean Weighted harmonic mean You want to punish very low scores on any single criterion even more strongly than GeometricMean
MinScore Only the worst criterion counts Conservative decisions — an option is only as good as its weakest point
MaxScore Only the best criterion counts Optimistic decisions — you're looking for standout strengths

See DemonstrateAggregationMethods() in the demo project for all five run against the same data.

Sensitivity analysis

PerformSensitivityAnalysis (extension method on a computed Decision) answers: "if I'm not fully sure about a criterion's weight, does the recommendation change?"

SensitivityAnalysis PerformSensitivityAnalysis(
    this Decision decision,
    string criterionName,
    (double min, double max) weightRange,
    int steps = 10)

It re-runs the computation steps times, sweeping the named criterion's weight linearly from weightRange.min to weightRange.max, and returns a SensitivityAnalysis record with the winner and score at each step. If the winning option changes partway through the sweep, your recommendation is not stable with respect to that weight — worth flagging before you commit to it.

var analysis = decision.PerformSensitivityAnalysis("Performance", (0.1, 0.6), steps: 10);
var stable = analysis.Results.Select(r => r.winner).Distinct().Count() == 1;

Validation

GetValidationErrors() on a Decision checks for structural problems — missing scores for a criterion/option pair, weights that don't sum to 1.0, and similar. Check it before trusting a recommendation in an automated pipeline:

var errors = decision.GetValidationErrors().ToList();
if (errors.Any())
{
    // handle or surface the issues instead of trusting the ranking
}

Reports

GenerateReport(includeDetails: true) produces a human-readable multi-line summary — useful for logging a decision's reasoning alongside the numeric result, not just the winner's name.

Clone this wiki locally