In utility AI, why are scores from several considerations usually multiplied rather than summed, and what problem does multiplying create?
answer
- a missing requirement should veto
- a sum lets one need mask another
- more factors, smaller product
- compensate or take the n-th root
- rank first, then weigh
basics
~20 sMultiplying lets any consideration at zero veto an action, which a sum cannot; but every extra factor below 1 shrinks the product, so actions with many considerations lose unfairly unless a compensation factor or geometric mean corrects for the count.
solid answer
~40 sWith a **sum**, a starving villager's high hunger score can outweigh a zero for *food at hand*, so it walks to an empty pantry. A **product** makes that zero a veto: `0.9 x 0 = 0`. The price is **count bias**: four considerations at `0.9` multiply to `0.9^4`, about `0.66`, so an action with a single consideration at `0.7` wins although each input of the first is better. Fixes: a **compensation factor** that raises each score toward 1 according to how many considerations the action has, or the **geometric mean** (the n-th root of the product), which keeps the veto and scores four `0.9`s as `0.9`. Hard priorities, such as fleeing a fire before any chore, belong in priority **buckets** or ranks compared before scores, not in inflated numbers.
code
pseudocode · 14 lines// Product of considerations with a compensation factor.
function scoreAction(action, agent):
n = number of action.considerations
if n == 0: return 0 // nothing to score: never chosen
modification = 1 - 1 / n
score = 1
for each c in action.considerations:
raw = c.input(agent)
x = clamp((raw - c.min) / (c.max - c.min), 0, 1)
s = clamp(c.curve(x), 0, 1)
s = s + (1 - s) * modification * s
score = score * s
if score == 0: return 0 // one zero vetoes the action
return scorego deeper
Recall that an action's considerations are combined into one score, commonly by multiplying, so a zero on any one of them rules the action out.
Show with numbers why a sum lets one need mask a missing requirement and why a product penalises actions with many considerations, then apply a fix.
Diagnose an agent that never picks its richly modelled actions as count bias, and choose between compensation, a geometric mean or buckets as the fix.
Set the team rule for how considerations combine and how hard priorities are expressed, so designers tuning hundreds of curves get comparable, predictable scores.
## Considerations and the combine step In utility AI each action is scored from several **considerations**: separate factors, each normalised to `0..1` and shaped by a response curve. A villager's `Eat` action might use hunger, whether food is at hand and the distance to the food. The **combine step** turns those numbers into one score per action, and the rule it uses changes behaviour as much as any curve. ## Sum versus product | Combine rule | Does one zero veto the action? | Bias from the number of considerations | |---|---|---| | Weighted average | No | None | | Product | Yes | Strong: each factor below 1 shrinks the result | | Product with compensation factor | Yes | Reduced, not removed | | Geometric mean | Yes | None: it is a mean of the factors | A **sum** or weighted average lets considerations trade off against each other: a starving villager's hunger can outweigh a zero on *food at hand*, so it walks to an empty pantry. For requirements that is wrong. A **product** treats each consideration as a multiplier, so any zero makes the whole score zero, and the missing food vetoes eating outright. That property is why the product is the common default. ## Count bias, worked out A product has a cost: every factor below 1 lowers the result, so actions with more considerations score lower even when each consideration is favourable. - `Eat` with four considerations of `0.9` each: `0.9^4 = 0.6561`, about `0.66`. - `Wander` with one consideration of `0.7`: `0.7`. `Wander` wins although every input to `Eat` is better. Designers meet this as "the carefully modelled actions never get picked" and are tempted to delete considerations, which throws information away to fix arithmetic. ## Correcting for the number of considerations - **Compensation factor.** For an action with `n` considerations, compute `modification = 1 - 1/n`, raise each score `s` toward 1 with `s' = s + (1 - s) * modification * s`, then multiply. For four scores of `0.9`: `modification = 0.75`, each becomes `0.9675`, and the product is about `0.88`. The bias shrinks but does not vanish; with `n = 1` nothing changes, and a zero stays zero. - **Geometric mean.** Take the n-th root of the product: four `0.9`s give exactly `0.9`. A zero still gives zero, so the veto survives, and actions with different numbers of considerations compare like for like. - **Equal counts.** Some teams keep every action at the same number of considerations, padding with factors fixed at 1. It works, but it is fragile once people edit actions independently. ## Buckets and dual utility Combining fixes the arithmetic inside a score; it does not express hard priorities. Fleeing a fire should beat every chore however the curves are tuned, and pushing its score above 1 breaks the shared scale. Two related answers: 1. Put actions into priority **buckets** (emergency, needs, idle). Evaluate the highest bucket first, and fall through to the next only when none of its actions scores above a threshold. 2. In **dual utility**, each option carries a **rank** and a **weight**. Keep only the options of the highest rank whose weight is above zero, then choose among them, often by weighted random so behaviour varies. ## Choosing a rule - Use a **product**, with a compensation factor or a geometric mean, when an action's considerations include requirements that must be able to veto it, which covers most gameplay actions. - Use a **weighted average** only for considerations that are genuinely interchangeable preferences, such as two sources of comfort, where a strong one should make up for a weak one. - Many systems mix the two: average the preference considerations into one factor, then multiply that factor by the requirement gates. ## Debugging the combine step - Log each consideration's score and the combined result for the chosen action and its nearest rival. - Watch for actions that never win in play; count bias is the first suspect. - Check that every requirement, such as food at hand or a reachable target, is a multiplying gate and not a term in a sum. - Keep curve outputs clamped to `0..1`: a negative output flips the sign of a product, and an output above 1 lets one consideration inflate the whole score.
- What does the compensation factor do to four considerations scoring 0.9 each?With `n = 4` the modification is `1 - 1/4 = 0.75`. Each score becomes `0.9 + (1 - 0.9) x 0.75 x 0.9 = 0.9675`, and the product is `0.9675^4`, about `0.88`, instead of the raw `0.66`. The bias is reduced rather than removed, and an action with a single consideration is unchanged because its modification is zero.
- How does dual utility differ from choosing by a single utility score?Each option carries a rank and a weight. The agent first keeps only the options of the highest rank whose weight is above zero, then chooses among those, often by weighted random. Ranks give designers hard priorities, such as fleeing a fire before any chore, while weights keep the choice inside a rank graded and varied.
- A high enough score on one need should override a missing requirement.
- Adding considerations to an action does not change its typical score.
- The compensation factor fully cancels the bias of multiplying many factors.
- Hard priorities such as fleeing a fire are best set by scoring above 1.