Technical Deep Dive

How the AI works

A plain-English explanation of the math and AI behind the Life-Value Optimizer — written for hiring managers, not just engineers.

The app uses mathematical optimization to find the combination of spending that maximizes your life quality — not just the cheapest option.

3 AI layers working together

Each layer handles a different part of the problem. Together they form a system no single technology could achieve alone.

🧮

Layer 1

Mathematical Optimization — OR-Tools CP-SAT

Google's CP-SAT (Constraint Programming Satisfiability) solver finds the provably optimal combination of spending within your budget and constraints. It's not trial-and-error or heuristic—it's a mathematical proof. It guarantees "this is the best possible answer." The same technology powers airline scheduling, supply chain logistics, and autonomous vehicle routing.

Provably optimal—mathematically guaranteed
⚖️

Layer 2

Utility Theory — 6-Axis Life Quality Model

Utility Theory (from behavioral economics) lets us assign a numeric "life value" score to any spending choice. Each item is rated across 6 dimensions: Health, Connections, Freedom, Growth, Food quality, and Savings. Your input weights determine how much each dimension matters to you. The optimizer balances these to maximize total life quality, not just minimize costs.

Rooted in well-being economics and PERMA theory
🤖

Layer 3

LLM Intelligence — Value-Aware Profiling & Recommendations

Google's Gemini LLM serves two critical roles: (1) Analyzes your passion text + lifestyle survey to infer which of the 6 dimensions matter most to you, then auto-adjust your value weights. (2) Proposes 10–15 custom spending items tailored to your budget and inferred values—avoiding duplicates of sensible defaults. This turns sliders + open-ended input into a personalized optimization.

LLM as a values analyst, not just a data lookup

9-step user journey to optimal spending

Here's exactly what happens from clicking in to getting your result.

1–2

Financial foundation: Budget + Household + Goals

You input monthly available income, fixed costs, household size, and a savings target. The app calculates your monthly discretionary budget and optionally models realistic risk costs (medical, housing repair, emergency fund) based on your age and family structure.

3

Passion & lifestyle context: Free-form input + 5 questions

You write 2–3 sentences about your passions and interests. You answer 5 questions about health priorities, social preferences, work-life balance, learning, and meal style. The app also asks about dining-out frequency and food quality preferences.

4–5

AI value profiling: LLM infers your priorities

Gemini analyzes your passion text + lifestyle answers to infer how much you care about each of 6 life dimensions (Health, Connections, Freedom, Growth, Food, Savings). It auto-adjusts your value weights. You can manually edit these sliders. Based on your values + budget, Gemini also proposes 10–15 custom spending items.

# AI inferred weights
values = {
  "health":     8,  # AI detected fitness importance
  "connections"7,# social themes in passion text
  "freedom":   6,
  "growth":    9,
  "food":      5,  # from meal preferences
  "savings":   6,
}
6

Item review & curation: Refine the proposal

The app shows you curated default items (gym, transport options, time-saving appliances, etc.) and the 10+ AI-proposed items. You adjust priorities, costs, or remove items you don't want. You can also add your own custom spending idea.

7–8

Utility scoring & constraint resolution

For each candidate item, the app calculates a "utility score" = (value weights × item axes scores) × priority bonus. Transport is treated as a mandatory single-choice category (pick exactly one: car, e-bike, transit, etc.). Constraints like "pet insurance only if pet selected" are enforced. Food is modeled as 3 flexible tiers: minimalist floor, your estimated preference, and a luxury band.

# Utility combines all 6 dimensions
item_utility = (
  w[health] × item.health × 100
  + w[connections] × item.connections × 100
  + w[freedom] × item.freedom × 100
  + w[growth] × item.growth × 100
  + w[food] × item.food_score × 40
) × priority_bonus  # 1.0×–2.0×
9

CP-SAT solver: Find the global optimum

The optimizer simultaneously evaluates all valid combinations and returns the selection that maximizes total utility + savings, subject to your budget cap and all constraints. The result is a spending plan where every item earned its place mathematically.

# Maximize: total utility + savings benefit
model.Maximize(
  Σ(x[i] × utility[i]) + savings_value
)
# Subject to constraints
model.Add(Σ monthly_costs ≤ budget)
model.Add(transport_items == 1)

Young professional: Optimize for health & growth

Monthly budget=$2500 · Savings goal=$300/month · Weights: Health=9, Growth=8, Connections=6, Freedom=5, Food=5, Savings=7.

Scenario: What gets selected?

Personal trainer (£200/mo) vs. Online course (£60/mo) vs. Dining-out budget (£150/mo)

💪 Personal Trainer
Health
9
Growth
7
Connect
6
✓ Selected
📚 Online Course
Health
2
Growth
9
Connect
3
🍽️ Dining Out
Health
4
Growth
5
Connect
8

Why Personal Trainer won

Trainer: (9×19 + 8×17 + 6×16 + 5×10) × 1.0 = (171 + 136 + 96 + 50) = 453
Course: (9×12 + 8×19 + 6×13 + 5×10) × 0.8 = (108 + 152 + 78 + 50) × 0.8 = 283
Dining: (9×14 + 8×15 + 6×18 + 5×10) × 1.2 = (126 + 120 + 108 + 50) × 1.2 = 538 but costs £150/mo vs £200/mo

→ Trainer selected because Health weight=9 heavily amplifies its 9/10 health score. Course & Dining both included but Trainer dominates utility-per-dollar.

How this translates to your business

The same mathematical logic ("knapsack problem" & CP-SAT solver) used here to optimize personal budget can directly solve complex operational challenges.

🚚

Logistics & Route Optimization

Maximize delivery value while strictly adhering to vehicle capacity, time windows, and driver shift constraints.

👥

Staff Scheduling

Automatically generate optimal shift schedules that minimize labor costs while satisfying employee preferences and legal requirements.

📈

Marketing Budget Allocation

Distribute limited ad spend across multiple channels to maximize total ROI based on predicted performance models.

What this demonstrates

🎯

Problem Formulation

Translating "what makes life better" into a precise mathematical model is the core skill of an AI engineer. This project does exactly that.

Production-Ready Engineering

OR-Tools, Gemini API, Streamlit, Docker — every component is a real production technology. Live and deployed, not a notebook demo.

🧭

PM × DS Thinking

Designing what questions to ask, how to structure the model, and what output is actually useful — product management applied to data science.

🔬

Grounded in Research

The 5-axis value model is derived from PERMA theory and well-being economics — not arbitrary design choices.

See it in action

The app is live. About 2 minutes to get your first result.