Configuring Combinations Under Set Bonuses: Rule Decomposition and Scoring Models

    This article explains how to evaluate team or loadout configurations when multiple combinable effects, set bonuses, and exclusive modifiers are involved. It breaks down the three core stacking rules (additive, threshold-triggered, and exclusive), introduces a scoring model that weights effects by scenario, and provides a complete Python framework for aggregating member effects, scoring teams, applying role constraints, and running sensitivity analysis to ensure decisions remain stable under weight perturbations. The code is reusable for any similar multi-dimensional selection problem.

    Why Configuration Choices Often Lead to Analysis Paralysis

    Many systems offer a large number of combinable options. Take team configuration as an example: each member can equip different gear, gear forms sets, and each set grants additional effects. The more options there are, the higher the cost of comparing them one by one. A common approach is to pick based on gut feeling, which often results in poor synergy between effects or noticeably weaker performance in certain scenarios.

    The underlying problem is ranking multi-dimensional benefits under finite constraints. If the benefits can be decomposed into a computable model, the decision becomes much clearer. This article uses team configuration as an example to show how to build such a model and provides a code framework that you can adapt and reuse directly.

    Three Rules for Decomposing Combination Effects

    Before analyzing set-based bonuses, you must first determine how they stack. They generally fall into one of three categories:

    1. Additive stacking: Each effect is added directly, and the benefit grows linearly with the count.
    2. Threshold triggering: An effect only activates when the number of pieces from the same set reaches a specified threshold.
    3. Exclusive replacement: Only one effect from the same category can apply. When multiple sources exist, the maximum value is taken, not the sum.
    Rule Type Typical Characteristic Modeling Focus Code Corresponding
    Additive Values are added directly Sum each item aggregate with sum
    Threshold Benefit only appears when item count is met Count pieces first, then call set_bonus set_bonus
    Exclusive Only one effect from a category applies Take the maximum value aggregate with max

    Ignoring threshold and exclusive rules is the most common source of evaluation errors. Directly summing all values will overestimate configurations that require a certain number of pieces to activate bonuses, and it will also overestimate configurations where the same type of effect appears multiple times.

    Consider a three-person team to illustrate the difference between the two rules. Suppose the “Gale” set grants +10 attack speed when three pieces are equipped. Member A has +5 attack speed as an additive effect. Members B and C have critical rates of 8 and 6 respectively, and critical rate is an exclusive effect.

    1. rule = SetRule("Gale", threshold=3, bonus={"attack_speed": 10})
    2. team = [
    3. Member("A", "dps", {"attack_speed": 5}, ["Gale"]),
    4. Member("B", "dps", {"crit_rate": 8}, ["Gale"]),
    5. Member("C", "support", {"crit_rate": 6}, ["Gale"]),
    6. ]
    7. print(dict(aggregate(team, [rule], exclusive={"crit_rate"})))
    8. # {'attack_speed': 15, 'crit_rate': 8}

    Attack speed is 15 because the additive effect and the threshold bonus are summed. Critical rate is 8, not 14, because the exclusive effect keeps only the maximum value. A simple sum would overestimate both values.

    Translating the Configuration Problem into a Scoring Model

    The overall value of the whole team can be expressed as:

    Score(team) = Σs (scenario_weight_s × Σ_e scenario_priority{s,e} × effect_value_e(team))

    Where:

    • Scenario: e.g., “fast-paced combat” vs. “long-duration sustained consumption”. Different scenarios have different demands on effects.
    • Scenario weight: Reflects the frequency or importance of the scenario in practice.
    • Scenario priority: Reflects the value of a given effect within that scenario.
    • Effect value: Derived by aggregating all members’ effects in the team. The aggregation rule is: independent effects are summed, threshold bonuses are added after counting pieces, and exclusive effects take the maximum.

    The following code provides a reusable implementation framework. The data is for illustration only; actual values should be filled in based on the corresponding scenario documentation or experimental results.

    1. from collections import Counter, defaultdict
    2. from dataclasses import dataclass
    3. from itertools import combinations
    4. @dataclass
    5. class Member:
    6. name: str
    7. role: str # role: dps / support / tank
    8. effects: dict # effect name -> value, treated as additive
    9. sets: list # names of sets this member's gear belongs to
    10. available: bool = True # whether this member is obtainable
    11. @dataclass
    12. class SetRule:
    13. name: str
    14. threshold: int # number of pieces required
    15. bonus: dict # additional effects when threshold is met
    16. @dataclass
    17. class Scenario:
    18. name: str
    19. weight: float # scenario weight
    20. priorities: dict # effect name -> priority in this scenario
    21. def set_bonus(pieces, threshold, bonus_effects):
    22. """Return bonus effects only if pieces >= threshold, otherwise empty dict."""
    23. return bonus_effects if pieces >= threshold else {}
    24. def aggregate(team, set_rules, exclusive):
    25. """Aggregate team effects. Effects in the exclusive set take max, others are summed."""
    26. values = defaultdict(list)
    27. for m in team:
    28. for effect, value in m.effects.items():
    29. values[effect].append(value)
    30. piece_count = Counter(s for m in team for s in m.sets)
    31. for rule in set_rules:
    32. bonus = set_bonus(piece_count[rule.name], rule.threshold, rule.bonus)
    33. for effect, value in bonus.items():
    34. values[effect].append(value)
    35. return {e: max(vs) if e in exclusive else sum(vs) for e, vs in values.items()}
    36. def score_team(team, scenarios, set_rules, exclusive):
    37. totals = aggregate(team, set_rules, exclusive)
    38. return sum(
    39. sc.weight * sc.priorities.get(effect, 0) * value
    40. for sc in scenarios
    41. for effect, value in totals.items()
    42. )
    43. def role_ok(team, role_limits):
    44. """role_limits: role -> (min, max). Roles not listed are unrestricted."""
    45. count = Counter(m.role for m in team)
    46. return all(lo <= count[role] <= hi for role, (lo, hi) in role_limits.items())
    47. def best_teams(pool, size, scenarios, set_rules, exclusive, role_limits, top_n=3):
    48. """Enumerate available members and return the top_n highest-scoring teams."""
    49. candidates = [m for m in pool if m.available]
    50. ranked = []
    51. for team in combinations(candidates, size):
    52. if role_ok(team, role_limits):
    53. ranked.append((score_team(team, scenarios, set_rules, exclusive),
    54. tuple(m.name for m in team)))
    55. ranked.sort(key=lambda item: item[0], reverse=True)
    56. return ranked[:top_n]

    The enumeration complexity is C(n, k), where n is the number of available members and k is the team size. This is acceptable when the candidate pool is small. For larger pools, you can use a greedy method to assign initial scores to each member and then enumerate combinations over the top-ranked members. Regardless of the method, always keep the top_n results instead of only the first place. If the top candidates are very close in score, the conclusion is not robust and should be interpreted together with sensitivity analysis.

    Scenario‑Based Role Fit

    The same member can have very different value in different scenarios. Evaluations should be performed per scenario rather than relying on a single aggregated number.

    • Fast‑paced scenarios: Short‑burst damage and immediate response are more important. Members with effects concentrated in the early phase have higher value; configurations that provide immediate returns are preferred.
    • Sustained scenarios: Endurance and stability matter more. Continuous buffs and damage mitigation decide late‑game performance; protective or sustained configurations are preferred.
    • Support members: Amplify overall team value by providing group‑wide buffs. Their personal damage may be low, so the evaluation must include the team‑level aggregated effects. aggregate combines all members’ effects at the team level, so support buffs automatically enter the scoring.
    • Tank members: Contribute to overall survivability through protective bonus effects. Their direct damage contribution is limited, so they suit teams that need stability over time.

    Role composition must be constrained separately. For example, a four‑person team might require 1‑2 DPS, 1 support, and 1‑2 tanks:

    1. role_limits = {"dps": (1, 2), "support": (1, 1), "tank": (1, 2)}

    role_ok filters out teams that do not satisfy these limits during enumeration, so the ranking never includes lineups with missing roles.

    A member performing well in a fast‑paced scenario is not necessarily the best choice in a sustained scenario. The two scenarios should be modeled separately and then weighted according to actual usage ratios.

    Handling Data Gaps and Acquisition Constraints

    In real decisions, data is often incomplete and acquisition conditions vary. Keep the following points in mind.

    1. Mark options with restricted availability separately. Members with available=False are excluded from ranking but are listed separately with a note such as “requires fulfillment of acquisition conditions”. This way the reader sees the recommended results and also knows which strong options were excluded.
    2. Do not fill missing data with guesses. If a value cannot be confirmed, mark it as unknown, skip it during aggregation, and document the affected members and effects in the analysis. When a priority is missing, priorities.get returns 0 by default, meaning that effect is not scored in that scenario. This assumption must be documented in the report.
    3. Perform sensitivity analysis. Perturb the scenario weights slightly and observe whether the optimal configuration changes. If the conclusion remains stable, the recommendation is reliable. If it flips frequently, more experimental data is needed.
    1. def is_stable(pool, size, scenarios, set_rules, exclusive, role_limits, delta=0.1):
    2. """Check if the top team remains unchanged when each scenario weight varies by ±delta."""
    3. base = best_teams(pool, size, scenarios, set_rules, exclusive, role_limits, top_n=1)
    4. if not base:
    5. return False
    6. best_names = base[0][1]
    7. for i in range(len(scenarios)):
    8. for sign in (1, -1):
    9. perturbed = [
    10. Scenario(s.name, s.weight * (1 + sign * delta) if j == i else s.weight, s.priorities)
    11. for j, s in enumerate(scenarios)
    12. ]
    13. top = best_teams(pool, size, perturbed, set_rules, exclusive, role_limits, top_n=1)
    14. if not top or top[0][1] != best_names:
    15. return False
    16. return True

    Practical Checklist

    1. First identify the threshold piece count and exclusive effects for each set, then decide whether to sum or take the maximum.
    2. Assign a weight to each scenario and document the rationale for the weight.
    3. For each member, record the role, availability, and data source, and set role count limits.
    4. Run enumeration or heuristic search, keeping the top several results for comparison.
    5. Perform sensitivity analysis to verify the stability of the conclusion.
    6. Recalculate whenever data is updated to avoid using outdated conclusions.

    Common Pitfalls

    • Looking only at single‑value performance and ignoring combination bonuses: A single item may look great but fail to be optimal in a full setup. This is handled by the threshold and exclusive logic in aggregate.
    • Treating scenario weights as fixed constants: Weights should be updated periodically based on actual usage. The weight perturbation check in is_stable addresses this.
    • Ignoring availability: Recommending a configuration that is currently unobtainable makes the decision useless. The available field filters such members and lists them separately.
    • Ignoring role composition: Sorting only by effect values may produce a team full of DPS slots. The role_ok function enforces the required role counts.
    • Using too few samples to set weights: Insufficient data leads to overfitting and non‑reproducible conclusions. If the weight basis is weak, expand experimental data first, then adjust weights.