← Meal builder

How meal scoring works

Budgets & gaps

The meal score is absolute: nutrients fill prorated targets, energy is rewarded toward a calorie target (a tent), optional macronutrient targets use that same tent, and stomach volume is a one-sided capacity hinge. Charts and the playground below import the real engine and your live config from the side panel — change weights, RNI cap, target, macros, or capacity and this page updates.

1 · The formula (your live weights)

MealScore = 100 × clamp( upf × ( 2·V + 2·M + 1.25·P + 1·N3 + 0.75·F + 0.75·tent + 2.25·NR ) / 10 − hinge , 0, 1 ) cap = 1 · target = 600 kcal · daily = 2000 kcal · capacity = 1000 ml · P is a saturating RNI ramp (× DIAAS) · model on

Component fills are saturating ramps against RNI × (target ÷ daily), except an enabled protein target which swaps that ramp for a tent. Carbohydrate and fat tents are extra terms when those targets are on. The calories weight is the energy-tent weight (clamped ≥ 0). UPF multiplies when ultra-processed foods supply ≥50% of meal energy.

2 · The three shapes

Nutrients — saturating ramp

reward = min(amount / target, cap=1)

00.510target

Energy — tent at the target

reward = max(0, 1 − |E − T| / T)

00.510target

Volume — hinge at capacity

penalty = max(0, V / C − 1)

00.510target
Table view — the three shapes
x (% of target)saturating rampenergy tentvolume hinge
0%0.000.000.00
25%0.250.250.00
50%0.500.500.00
75%0.750.750.00
100%1.001.000.00
125%1.000.750.25
150%1.000.500.50
175%1.000.250.75
200%1.000.001.00

User-set macronutrient targets reuse the energy tent. Grams versus % of the meal calorie target is one setting for protein, carbohydrate, and fat together (4 / 4 / 9 kcal per gram). Reward is 1 at the target and 0 at 0 and at 2×.

3 · Playground

Loading food composition…

4 · Where mass still lives

As the intrinsic quality lens

The paper's per-mass NVS remains the context-free “how good is this stuff” ranking. Search results still show it alongside the contextual marginal value.

As the limit case of the new model

With no scarce budgets, the tent and hinge vanish and the marginal of 100 g into an empty meal is nutrient density — the current score. Budgets & gaps generalises the density model.

5 · Constants audit (shipped)

Constant / mechanismStatusWhy
±20% calorie bandremovedthe tent's slope replaces the ramp-in band
EMR sign flip under targetremovedthe tent is naturally two-sided
kcal/100 g share attributionremovedmarginal contribution attributes automatically
Calorie target + daily energyshippedtent peak + RNI prorating
Stomach capacity + food densitiesshippedvolume hinge kink
Macronutrient targets (g or % of meal kcal)shippedsame tent as energy; optional; protein replaces the RNI ramp
RNI cap, weights, UPF/NRshippedcap is the saturating ramp; weights apply to meal totals

Design history: docs/nvs-budgets-and-gaps.html (static prototype). This page is the first-class, engine-backed reference.