{"id":"rank-borda-aggregate","version":"1.0.0","description":"Aggregate weighted complete or partial rankings into exact Borda scores, rank groups, and audit contributions.","supported_operations":["aggregate weighted Borda rankings","calculate Borda count scores","combine partial preference rankings","audit weighted rank votes","group tied Borda results","score ranked choice ballots","deterministic ranking aggregation"],"unsupported_operations":["instant-runoff voting","Condorcet pairwise winners","rankings with tied positions","negative or fractional ballot weights"],"semantics":["For N candidates, a listed candidate at zero-based position p receives N - 1 - p base points, multiplied by the ranking weight.","unranked_policy \"zero\" gives omitted candidates 0 points; \"last_place\" gives each omitted candidate max(N - listed_count - 1, 0) points.","Candidate identifiers are exact, non-empty, well-formed strings; duplicates and ranked identifiers absent from candidates are invalid_input.","Scores, candidates within groups, and each contribution points array use Unicode code-point lexicographic order.","Rank groups use descending score and competition ranks: after a tie of two at rank 1, the next group has rank 3."],"limits":{"max_candidates":100,"max_rankings":100,"max_candidate_chars":64,"max_weight":1000},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["candidates","rankings","unranked_policy"],"properties":{"candidates":{"type":"array","minItems":1,"maxItems":100,"uniqueItems":true,"items":{"type":"string","minLength":1,"maxLength":64}},"rankings":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","additionalProperties":false,"required":["ranking","weight"],"properties":{"ranking":{"type":"array","minItems":1,"maxItems":100,"uniqueItems":true,"items":{"type":"string","minLength":1,"maxLength":64}},"weight":{"type":"integer","minimum":1,"maximum":1000}}}},"unranked_policy":{"type":"string","enum":["zero","last_place"]}}},"output_schema":{"type":"object","additionalProperties":false,"required":["scores","rank_groups","contributions"],"properties":{"scores":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","additionalProperties":false,"required":["candidate","score"],"properties":{"candidate":{"type":"string"},"score":{"type":"integer","minimum":0,"maximum":9900000}}}},"rank_groups":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","additionalProperties":false,"required":["rank","score","candidates"],"properties":{"rank":{"type":"integer","minimum":1,"maximum":100},"score":{"type":"integer","minimum":0,"maximum":9900000},"candidates":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string"}}}}},"contributions":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","additionalProperties":false,"required":["ranking_index","weight","points"],"properties":{"ranking_index":{"type":"integer","minimum":0,"maximum":99},"weight":{"type":"integer","minimum":1,"maximum":1000},"points":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","additionalProperties":false,"required":["candidate","points","weighted_points"],"properties":{"candidate":{"type":"string"},"points":{"type":"integer","minimum":0,"maximum":99},"weighted_points":{"type":"integer","minimum":0,"maximum":99000}}}}}}}}},"examples":[{"input":{"candidates":["alice","bob","carol"],"rankings":[{"ranking":["alice","bob","carol"],"weight":2},{"ranking":["carol","bob","alice"],"weight":1}],"unranked_policy":"zero"},"output":{"scores":[{"candidate":"alice","score":4},{"candidate":"bob","score":3},{"candidate":"carol","score":2}],"rank_groups":[{"rank":1,"score":4,"candidates":["alice"]},{"rank":2,"score":3,"candidates":["bob"]},{"rank":3,"score":2,"candidates":["carol"]}],"contributions":[{"ranking_index":0,"weight":2,"points":[{"candidate":"alice","points":2,"weighted_points":4},{"candidate":"bob","points":1,"weighted_points":2},{"candidate":"carol","points":0,"weighted_points":0}]},{"ranking_index":1,"weight":1,"points":[{"candidate":"alice","points":0,"weighted_points":0},{"candidate":"bob","points":1,"weighted_points":1},{"candidate":"carol","points":2,"weighted_points":2}]}]}},{"input":{"candidates":["z","a","m"],"rankings":[{"ranking":["z"],"weight":1}],"unranked_policy":"last_place"},"output":{"scores":[{"candidate":"a","score":1},{"candidate":"m","score":1},{"candidate":"z","score":2}],"rank_groups":[{"rank":1,"score":2,"candidates":["z"]},{"rank":2,"score":1,"candidates":["a","m"]}],"contributions":[{"ranking_index":0,"weight":1,"points":[{"candidate":"a","points":1,"weighted_points":1},{"candidate":"m","points":1,"weighted_points":1},{"candidate":"z","points":2,"weighted_points":2}]}]}}],"execute_url":"/v1/tools/rank-borda-aggregate/versions/1.0.0/execute"}