Calculation methodology
How the planner does the math
ValleyMath compares processing with shipping the same inputs raw, then fits profitable batches into the machines and mornings you selected. Here is the exact scope and where the model stops.
Last updated August 27, 2026The objective
The optimizer maximizes the extra gold created by processing non-reserved inventory before the chosen deadline. It does not maximize the visually larger gross value of the chest.
incremental profit = finished product value − raw-sale value of the consumed inputsFinal sale value is reported separately as processed-goods revenue plus the raw value of unprocessed leftovers. Keep quantities sit outside both the processing baseline and the backlog because the player explicitly reserved them.
Production rules in the current model
| Product | Machine | Input | Price before Artisan | Planning cycle |
|---|---|---|---|---|
| Wine | Keg | 1 fruit | 3 × base price | 7 mornings |
| Juice | Keg | 1 vegetable | 2.25 × base price | 4 mornings |
| Jelly | Preserves Jar | 1 fruit | 2 × base price + 50g | 3 mornings |
| Pickles | Preserves Jar | 1 vegetable or mushroom | 2 × base price + 50g | 3 mornings |
| Dried Fruit | Dehydrator | 5 matching fruit | 7.5 × base price + 25g | 1 morning |
| Dried Mushrooms | Dehydrator | 5 matching mushrooms | 7.5 × base price + 25g | 1 morning |
| Raisins | Dehydrator | 5 Grapes | 600g | 1 morning |
| Pale Ale | Keg | 1 Hops | 300g | 2 mornings |
| Beer | Keg | 1 Wheat | 200g | 2 mornings |
| Coffee | Keg | 5 Coffee Beans | 150g | 1 morning |
| Green Tea | Keg | 1 Tea Leaves | 100g | 1 morning |
| Mead | Keg | 1 Honey | 300g | 1 morning |
| Caviar | Preserves Jar | 1 Sturgeon Roe | 500g | 4 mornings |
Planning cycles use a morning-check assumption. ValleyMath assumes the player checks the workshop once each in-game morning, and that every entered machine is empty on Day 0. The model rounds an awkward partial-day completion to the next practical morning load instead of promising a mid-day refill.
Quality and professions
Normal, Silver, Gold, and Iridium quality multiply an eligible raw input by 1, 1.25, 1.5, and 2 respectively before integer-price rounding. Tiller adds 10% to eligible raw crop value. Artisan is the level-10 branch reached through Tiller, so selecting Artisan keeps that inherited 10% raw-crop bonus and also adds 40% to eligible artisan goods. Raw Honey receives the Artisan bonus because Honey is already an artisan good. Inputs that do not carry quality in-game keep their normal base value.
Artisan goods in this model do not inherit input quality. Coffee is the one current route that is deliberately excluded from the Artisan multiplier. That is why a normal-quality and an Iridium-quality crop can produce the same finished item while sacrificing different raw values. Separate inventory rows preserve that distinction.
How the Wine aging calculator works
The standalone Wine aging calculator starts with Wine that has already left a Keg. It does not add seven more mornings of Keg production or place Casks into the shared production optimizer.
normal Wine value = floor(fruit base price × 3 × Artisan multiplier)quality value = floor(fruit base price × 3 × Artisan multiplier × quality multiplier)Artisan is 1.4 when selected and 1 otherwise. Normal, Silver, Gold, and Iridium Wine use quality multipliers of 1, 1.25, 1.5, and 2. The calculator floors the final per-bottle value to whole gold, matching the integer sale prices used in the game.
| Target quality | Total Cask days from Normal | Remaining days from Silver | Remaining days from Gold |
|---|---|---|---|
| Silver | 14 | — | — |
| Gold | 28 | 14 | — |
| Iridium | 56 | 42 | 28 |
The finish date converts the loading date to a position in a 112-day Stardew year, adds the remaining Cask days, then converts it back through four 28-day seasons. Capacity uses min(Wine bottles, empty Casks); bottles above that number remain visible as a waiting stack. Each missing Cask adds 20 Wood and 1 Hardwood to the material estimate.
The 112-day projection assumes a steady supply of Wine at the selected current quality and that every entered Cask is reloaded immediately after each full run. It is a capacity benchmark, not a promise that the entered one-time bottle stack repeats on its own.
How the schedule is made executable
- Every profitable route gets a separate integer decision for each legal start morning.
- Shared-inventory constraints prevent one crop unit from appearing in two routes.
- Each machine type and each morning receive their own capacity constraint, so a job occupies a real slot from its load morning through the morning before collection.
- A deterministic pass assigns accepted jobs to numbered machines and groups identical jobs into the Morning action list.
This time-indexed model avoids an important aggregate-machine-days error: three four-morning Juice jobs use twelve machine-days in total, but two Kegs still cannot finish all three jobs inside a seven-morning horizon. The legal start slots show that only two batches fit.
ValleyMath labels a result Optimal for these inputs only when the solver proves the maximum for this model and every chosen batch is assigned to an executable slot. If the solver reaches its limit with a usable solution but without proof, the page saysFeasible plan · not proven optimal instead.
How the Greenhouse sprinkler planner works
The standalone Greenhouse sprinkler planner models the fixed 10 × 12 tillable floor: 120 crop tiles before a sprinkler or another object occupies a tile. A placed sprinkler uses one tile, so coverage is reported against the remaining plantable tiles rather than against all 120 squares.
coverage = unique in-bounds watered crop tiles ÷ (120 − occupied sprinkler tiles)Basic Sprinklers use the four cardinal neighbors. Quality Sprinklers use the surrounding 3 × 3 ring (8 tiles), and Iridium Sprinklers use the surrounding 5 × 5 ring (24 tiles). A Pressure Nozzle expands the footprint by one tile on each side: Basic becomes the 3 × 3 ring, Quality becomes the 5 × 5 ring, and Iridium becomes the 7 × 7 ring. Tiles outside the greenhouse are clipped, and a tile covered twice still counts once as watered; the extra hits are shown as overlap so a player can decide whether the space is worth keeping.
“Suggest a layout” is a deterministic greedy search over this small grid. It maximizes unique watered tiles at each placement and then prefers fewer overlaps. That makes it a practical starting point, not a proof of a global optimum once paths, Junimo Chests, fruit trees, or custom farm maps enter the plan. Every suggested tile remains editable.
How the crop growth calculator works
The standalone crop growth calculator treats planting day as Day 0. A crop advances after a watered night, so a four-day Parsnip planted on Spring 1 is ready on Spring 5. Each entered missed watering day delays maturity by one day.
days removed = ceil(base growth days × (fertilizer rate + Agriculturist rate))Fertilizer rates are 10% for Speed-Gro, 25% for Deluxe Speed-Gro, and 33% for Hyper Speed-Gro. Agriculturist adds 10 percentage points. The result is not subtracted from a single total with a second rounding shortcut: removable days are applied across the crop’s actual growth stages, matching the game’s stage-based behavior. The first growth stage is never reduced below one day.
Growth bonuses change only the first maturity cycle. Blueberry, Strawberry, Corn, and other repeat crops keep their published regrow interval. For non-regrowing crops, the optional same-day replant schedule puts the next seed down on harvest morning and applies the same watering assumption to each new planting.
Outdoor planning stops after the crop’s last consecutive legal season. Corn can continue from Summer into Fall, while Pumpkin cannot continue from Fall into Winter. Greenhouse and Ginger Island mode removes that seasonal deadline and displays the next 28 growing days. Rice Shoots and Taro Tubers are excluded because nearby water changes their growth time; presenting either crop without an irrigation input would create a false date.
How to verify a result
The public validation page publishes concrete inputs, hand-worked formulas, expected values, and boundary cases for profession inheritance, quality, five-item batches, remainders, reserves, future arrivals, shared inventory, and machine-slot packing. Those expected values are asserted in the automated test suite against the same calculation functions used by the visible tools.
Current limitations
- Only unmodded Stardew Valley 1.6.x rules are in scope.
- The standalone Cask tool covers Wine only. Cheese, Beer, Pale Ale, Mead, and other aging goods are not included.
- The Greenhouse planner models sprinkler reach on the standard 10 × 12 tillable floor; it does not place crops, paths, fruit trees, Junimo Chests, or modded map objects.
- The shared Keg, Jar, and Dehydrator optimizer does not schedule Casks or treat Cellar slots as part of its machine capacity.
- Fish Smokers, animal processing, and modded machines are not modeled.
- The catalog covers the major crop routes and high-use Keg, Jar, and Dehydrator specials; it is not a complete item encyclopedia.
- Machines already running at Day 0 cannot yet be entered as work in progress.
- The rough capacity note assigns each remaining stack to its strongest gold-per-morning route; it is not a second global optimization and does not model crafting resources.
- The production planner’s future inventory rows are still user estimates; its machine scheduler does not automatically import dates from the separate crop growth calculator.
Return to the production planner to test these rules with your own inventory.
Data review
Item prices, machine recipes, profession effects, and processing times are checked against the public Stardew Valley Wiki artisan-goods referenceand the Farming professions reference. Wine quality multipliers, Cask timing, recipe materials, and Cellar limits are checked against the Cask reference; the implementation was also cross-checked against the MIT-licensed Stardew Profits source. Crop seasons, stages, regrow intervals, and growth bonuses are checked against the public Crops reference and Speed-Gro reference; the stage-reduction implementation was cross-checked against the MIT-licensed crop_planner source. ValleyMath uses the numbers as game data; it does not copy wiki descriptions or artwork. When the game changes, the data version in the footer and this page will be updated together.