← All examples
24

Canonical Grid model

Goal-Seek And Optimization

Lamp-works pricing desk: SOLVE goal-seek to a profit target, bounded SOLVE MAXIMIZE, and lambda optimizers GOALSEEK and MINIMIZE.

Scale
Small
Source
24-goal-seek-optimization.grid
Length
40 lines
Collection
Forecasting & decisions
Level
Intermediate
Runtime
Portable
Version
1.0.0

Watch it in Grid

See this model in motion.

Watch the model respond in the product, then inspect the exact source and checkpoints on this page.

Companion film

Dispatch the battery

Change the evening price spike and watch hourly charge and discharge choices roll into a new daily P&L.

19 secGrid 0.61.0
Open film page

What this model gives you

A reactive pricing desk with target-price, maximum-profit, and minimum-batch-cost recommendations.

20 min to study · Source reviewed 2026-08-24

Continue with guided practice

What to notice

  • Bounded goal seek
  • Objective maximization
  • Objective minimization
  • Reactive re-solving

Requirements

  • Solver functions
  • Portable model
  • No connector

Expected checkpoint

A known state for this walkthrough.

After loading the canonical source with its authored candidate values.

Target price
≈ 72.996C1
Best price
≈ 141.22C2
Best profit
≈ 71,893.44D2
Run size
≈ 2,490.60C3
01 · Target

A bounded solve finds an actionable root

The chosen interval selects the intended price region when the equation has multiple mathematical answers.

02 · Optimize

Recommendations do not mutate assumptions

SOLVE writes answers to result cells while candidate price and run-size inputs remain available for comparison.

03 · React

Market changes produce new answers

Unit cost, fixed cost, demand, and sensitivity remain upstream dependencies of every recommendation.

24-goal-seek-optimization.grid
Get Grid
MODEL "Goal-Seek And Optimization"
DESCRIPTION "Lamp-works pricing desk: SOLVE goal-seek to a profit target, bounded SOLVE MAXIMIZE, and lambda optimizers GOALSEEK and MINIMIZE."
VERSION "1.0.0"
AUTHOR "Grid Team"
TAGS "canonical", "solve", "goalseek", "optimization"

# Inputs — monthly economics for one desk-lamp line
A1 IS currency = 38
A2 IS currency = 24000
A3 = 2200
A4 = 9
A5 IS currency = 120
A6 = 900

# Candidate-price economics (linear demand: units fall A4 per currency of price)
B1 = MAX(A3 - A4 * A5, 0)
B2 IS currency = A5 * B1
B3 IS currency = B2 - (A1 * B1 + A2)
B4 IS currency = (B1 / A6) * 1800 + 0.65 * A6 / 2

# SOLVE statements — variable cells A5/A6 are never mutated; each result
# cell receives the solved value, and edits upstream re-solve reactively.
SOLVE C1 = A5 IN [40, 140] GOAL B3 = 30000
SOLVE C2 = A5 IN [40, 240] MAXIMIZE B3
SOLVE C3 = A6 IN [100, 4000] MINIMIZE B4

# Economics at the profit-maximizing price
D1 = MAX(A3 - A4 * C2, 0)
D2 IS currency = (C2 - A1) * D1 - A2

# Function-form optimizers over lambdas rather than cells
E1 = GOALSEEK(p => (p - A1) * MAX(A3 - A4 * p, 0) - A2, 0, 40, 140, 0.0001, 200)
E2 = MINIMIZE(q => (D1 / q) * 1800 + 0.65 * q / 2, 100, 4000, 0.001, 200)
E3 IS currency = (D1 / E2) * 1800 + 0.65 * E2 / 2

# Readout
F1 = B3 >= 0.9 * D2 THEN "near-optimal" ELSE "reprice"
F2 = `breakeven={E1} target_price={C1} best_price={C2} run_size={C3} batch={E2}`

END MODEL