/** * Reward Calculator Module * * Implements weighted objective scoring for governance metrics. * Calculates composite scores based on configurable weights across * multiple dimensions including customer value, code quality, * delivery speed, technical debt reduction, and documentation. */ /** * Weight configuration for each scoring dimension. * All weights should sum to 1.0 for normalized scoring. */ export interface RewardWeights { customer_value: number; code_quality: number; delivery_speed: number; technical_debt_reduction: number; documentation: number; } /** * Input metrics for reward calculation. * Each dimension accepts a value from 0-100. */ export interface RewardMetrics { customer_value: number; code_quality: number; delivery_speed: number; technical_debt_reduction: number; documentation: number; } /** * Calculated reward score with breakdown by dimension. */ export interface RewardScore { overall: number; byDimension: Record; timestamp: Date; } /** * Comparison between current and baseline scores. */ export interface ScoreComparison { overallDelta: number; overallPercentChange: number; dimensionDeltas: Record; improved: boolean; significantChanges: string[]; } /** * RewardCalculator class for weighted objective scoring. * * Provides methods to calculate, compare, and analyze scores * across multiple governance dimensions with configurable weights. * * @example * ```typescript * const calculator = new RewardCalculator(); * const score = calculator.calculateScore({ * customer_value: 85, * code_quality: 90, * delivery_speed: 75, * technical_debt_reduction: 60, * documentation: 80 * }); * console.log(score.overall); // Weighted average * ``` */ export declare class RewardCalculator { private weights; /** * Creates a new RewardCalculator instance. * * @param weights - Optional custom weights. Defaults to standard weights * prioritizing customer value (0.35) and code quality (0.25). */ constructor(weights?: Partial); /** * Calculates the overall reward score from provided metrics. * * @param metrics - Input metrics with values 0-100 for each dimension. * @returns RewardScore with overall weighted average and per-dimension scores. * @throws Error if any metric value is outside 0-100 range. */ calculateScore(metrics: RewardMetrics): RewardScore; /** * Calculates the weighted score for a single dimension. * * @param dimension - The dimension name (must be a valid weight key). * @param value - The raw value (0-100) for this dimension. * @returns The weighted score contribution. * @throws Error if dimension is not recognized. */ getWeightedScore(dimension: string, value: number): number; /** * Normalizes a set of scores to sum to 100. * * @param scores - Record of dimension names to raw scores. * @returns Normalized scores that sum to 100. */ normalizeScores(scores: Record): Record; /** * Updates the weight configuration. * * @param newWeights - Partial weights to merge with existing configuration. * @throws Error if resulting weights don't sum to approximately 1.0. */ updateWeights(newWeights: Partial): void; /** * Returns the current weight configuration. * * @returns A copy of the current weights. */ getWeights(): RewardWeights; /** * Compares current score against a baseline score. * * @param current - The current RewardScore to evaluate. * @param baseline - The baseline RewardScore to compare against. * @returns ScoreComparison with deltas and improvement indicators. */ compareToBaseline(current: RewardScore, baseline: RewardScore): ScoreComparison; /** * Identifies dimensions that need improvement based on their scores. * * @param score - The RewardScore to analyze. * @returns Array of dimension names that are below the improvement threshold. */ identifyImprovementAreas(score: RewardScore): string[]; /** * Gets the weight for a specific dimension. * * @param dimension - The dimension name. * @returns The weight value or 0 if not found. */ private getWeightForDimension; /** * Validates that weights sum to approximately 1.0. * * @throws Error if weights don't sum to 1.0 (within tolerance). */ private validateWeights; /** * Validates that all metric values are within 0-100 range. * * @param metrics - The metrics to validate. * @throws Error if any metric is outside valid range. */ private validateMetrics; } /** * Factory function to create a RewardCalculator instance. * * @param weights - Optional custom weights configuration. * @returns A new RewardCalculator instance. * * @example * ```typescript * // Create with default weights * const calculator = createRewardCalculator(); * * // Create with custom weights * const customCalculator = createRewardCalculator({ * customer_value: 0.40, * code_quality: 0.30, * delivery_speed: 0.15, * technical_debt_reduction: 0.10, * documentation: 0.05 * }); * ``` */ export declare function createRewardCalculator(weights?: Partial): RewardCalculator; //# sourceMappingURL=reward-calculator.d.ts.map