Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions v1/ad_spend_allocation/runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ A marketing team wants to split an advertising budget across channels and campai
5 channels (min/max spend) · 3 campaigns (budget) · 15 channel-campaign conversion rates
/rai-prescriptive-problem-formulation + /rai-prescriptive-solver-management
/rai-prescriptive-problem
• decisions: spend per (channel-campaign, budget level) + binary "fund this pair?"
• constraints: spend within channel min/max when funded; per-campaign budget;
≥ 1 funded channel per campaign; total spend ≤ the scenario's budget level
• objective: maximize sum(spend x conversion rate)
• budget levels $35k / $45k / $55k in one solve · HiGHS -> OPTIMAL, 9,740 conversions
/rai-prescriptive-results-interpretation
/rai-prescriptive-results
• the two higher budget levels give the identical plan — extra budget buys no more conversions
• the real limits are per-channel max-spend and per-campaign budgets, not the total cap
```
Expand All @@ -25,25 +25,25 @@ Each prompt is pasted into a fresh agent session loaded with the named `/rai-*`

## 1. Build the ontology

**Prompt:** /rai-build-starter-ontology Build an ontology from `data/channels.csv` (each channel has a min and max spend), `data/campaigns.csv` (each campaign has a budget), and `data/effectiveness.csv` (the conversion rate — conversions per dollar — for each channel-campaign pair). Model effectiveness as a relationship linking a channel and a campaign to its conversion rate.
**Prompt:** /rai-ontology Build an ontology from `data/channels.csv` (each channel has a min and max spend), `data/campaigns.csv` (each campaign has a budget), and `data/effectiveness.csv` (the conversion rate — conversions per dollar — for each channel-campaign pair). Model effectiveness as a relationship linking a channel and a campaign to its conversion rate.

**Response:** Loads `Channel` (5: Search, Social, Display, Video, Email — each with `min_spend`, `max_spend`), `Campaign` (3: Brand_Awareness $15k, Product_Launch $20k, Seasonal_Sale $10k), and `Effectiveness` (15, every channel-campaign pair, with `conversion_rate` 0.03–0.12).

## 2. Examine the ontology

**Prompt:** /rai-querying What concepts and relationships does the ontology have, and how many of each?
**Prompt:** /rai-pyrel What concepts and relationships does the ontology have, and how many of each?

**Response:** Three concepts — 5 `Channel` (min/max spend), 3 `Campaign` (budget), and 15 `Effectiveness` (one conversion rate per channel-campaign pair).

## 3. Allocate spend across budget levels

**Prompt:** /rai-prescriptive-problem-formulation + /rai-prescriptive-solver-management How should we spend across each channel-campaign pair to maximize total expected conversions, at three total-budget levels — $35k, $45k, and $55k — solved together? Use a continuous spend per pair and a binary "fund this pair" decision: when a pair is funded its spend must sit within that channel's min and max, each campaign's spend across channels can't exceed its budget, every campaign needs at least one funded channel, and total spend can't exceed the budget level. Model the budget level as a first-class scenario concept with the spend indexed by (pair, level). Maximize conversions and persist the spend to the ontology.
**Prompt:** /rai-prescriptive-problem How should we spend across each channel-campaign pair to maximize total expected conversions, at three total-budget levels — $35k, $45k, and $55k — solved together? Use a continuous spend per pair and a binary "fund this pair" decision: when a pair is funded its spend must sit within that channel's min and max, each campaign's spend across channels can't exceed its budget, every campaign needs at least one funded channel, and total spend can't exceed the budget level. Model the budget level as a first-class scenario concept with the spend indexed by (pair, level). Maximize conversions and persist the spend to the ontology.

**Response:** OPTIMAL (HiGHS), combined **9,740 conversions** across the three budget levels (relative gap 0.0). 90 variables (45 continuous spend + 45 binary funding) and 111 constraints; spend and funding are written back as `Allocation.x_spend(Scenario)` and `Allocation.x_active(Scenario)`.

## 4. Read the allocation across budget levels

**Prompt:** /rai-prescriptive-results-interpretation How does the plan change as the total budget grows, and what does that say about diminishing returns?
**Prompt:** /rai-prescriptive-results How does the plan change as the total budget grows, and what does that say about diminishing returns?

**Response:** OPTIMAL, **9,740 combined conversions**. The tell is sharply diminishing returns: the **two higher budget levels ($45k and $55k) produce the identical allocation and conversions** — beyond a point, additional budget can't be profitably deployed because every remaining channel-campaign pair is already capped by its channel's max-spend or its campaign's budget. So the extra budget goes unused, and the **total-budget cap is not the binding limit** — the per-channel and per-campaign caps are. Raising the overall budget past that point buys zero marginal conversions.

Expand Down
6 changes: 3 additions & 3 deletions v1/bom-reachability/runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ Each prompt is pasted into a fresh agent session loaded with the named `/rai-*`

## 1. Build the ontology

**Prompt:** /rai-build-starter-ontology Build a RelationalAI ontology from `data/skus.csv` and `data/bill_of_materials.csv`. Each SKU has an id, name, type (`RAW_MATERIAL`, `COMPONENT`, or `FINISHED_GOOD`), and category. Each bill-of-materials entry links an output SKU (what is produced) to an input SKU (what it requires), and may be site-specific. Model `BillOfMaterials` as an edge between SKUs so we can trace what depends on what.
**Prompt:** /rai-ontology Build a RelationalAI ontology from `data/skus.csv` and `data/bill_of_materials.csv`. Each SKU has an id, name, type (`RAW_MATERIAL`, `COMPONENT`, or `FINISHED_GOOD`), and category. Each bill-of-materials entry links an output SKU (what is produced) to an input SKU (what it requires), and may be site-specific. Model `BillOfMaterials` as an edge between SKUs so we can trace what depends on what.

**Response:** Loads 9 `SKU` nodes (properties `name`, `type`, `category`) and a `BillOfMaterials` edge concept with `output_sku` / `input_sku` relationships from the 14 BOM rows. Several rows are site-specific duplicates (e.g. SKU001 is assembled at both S001 and S012), so the 14 entries collapse to 10 distinct output→input dependency edges; the duplicate-edge warning is informational.

## 2. Examine the ontology

**Prompt:** /rai-querying What concepts and relationships does the ontology have, and how is the product structure tiered?
**Prompt:** /rai-pyrel What concepts and relationships does the ontology have, and how is the product structure tiered?

**Response:** One concept, `SKU`, with properties `name`, `type`, and `category`, plus the `BillOfMaterials` edge carrying `output_sku` / `input_sku`. The 9 SKUs span three tiers — 4 raw materials (wafer, display glass, lithium cells, NAND die), 3 components (Mobile Processor A15, OLED Display Panel 6.1, Lithium Battery Pack 4500mAh), and 2 finished goods (ProPhone X1, ProTab T1) — joined by 10 "produces → requires" edges that always point a higher tier down to a lower one.

Expand All @@ -49,6 +49,6 @@ Each prompt is pasted into a fresh agent session loaded with the named `/rai-*`

## 6. Maximal chains and assembly depth

**Prompt:** /rai-graph-analysis The full path set repeats every sub-chain. Reduce it to just the maximal end-to-end chains — the longest routes not contained inside a longer one — and record each finished good's assembly depth, the length of the deepest chain that builds it.
**Prompt:** /rai-graph-analysis The full path set repeats every sub-chain. Reduce it to just the maximal end-to-end chains — the longest routes not contained inside a longer one — and persist each finished good's assembly depth as `SKU.assembly_depth` on the ontology (the length of the deepest chain that builds it).

**Response:** 8 of the 18 paths are maximal; the other 10 are shorter sub-chains contained inside them. All 8 maximal chains are 2-hop raw-material → component → finished-good routes (e.g. Silicon Wafer 300mm → Mobile Processor A15 → ProTab T1). Both finished goods have an assembly depth of 2, persisted back onto the ontology as `SKU.assembly_depth` so a later query can rank products by build complexity without re-enumerating paths.
8 changes: 4 additions & 4 deletions v1/book_slate_recommendation/runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ support — OPTIMAL, every user gets an ordered, subject-diverse, fully-explaine
**Prompt**

```
/rai-build-starter-ontology Build an ontology from the data/ CSVs: books, authors, subjects, users, the read history (which user read which book, with a rating), and the knowledge-graph edges — book_author (a book's authors), book_subject (a book's subjects), and book_similar (books similar to a book). Model these as relationships so a book connects to its authors, subjects, similar books, and readers.
/rai-ontology Build an ontology from the data/ CSVs: books, authors, subjects, users, the read history (which user read which book, with a rating), and the knowledge-graph edges — book_author (a book's authors), book_subject (a book's subjects), and book_similar (books similar to a book). Model these as relationships so a book connects to its authors, subjects, similar books, and readers.
```

**Response**
Expand All @@ -44,7 +44,7 @@ Loads `Book` (59), `Author` (52), `Subject` (12), `User` (25), a 150-row read hi
**Prompt**

```
/rai-querying What concepts and relationships does the ontology have, and how many rows are in each?
/rai-pyrel What concepts and relationships does the ontology have, and how many rows are in each?
```

**Response**
Expand Down Expand Up @@ -80,7 +80,7 @@ For every (user, unread book) candidate, the connecting paths are counted across
**Prompt**

```
/rai-prescriptive-problem-formulation + /rai-prescriptive-solver-management For each user, pick an ordered 3-book slate (slots 1–3) to maximize weighted explanation support — sum of (4 − slot) times the candidate's path count, so stronger picks go in higher slots — while keeping the slate subject-diverse and meeting a minimum total explanation floor. Persist each user's chosen books and slots.
/rai-prescriptive-problem For each user, pick an ordered 3-book slate (slots 1–3) to maximize weighted explanation support — sum of (4 − slot) times the candidate's path count, so stronger picks go in higher slots — while keeping the slate subject-diverse and meeting a minimum total explanation floor. Persist each user's chosen books and slots.
```

**Response**
Expand All @@ -92,7 +92,7 @@ OPTIMAL — all 25 users get an ordered 3-book slate (`Candidate.slot`) that max
**Prompt**

```
/rai-prescriptive-results-interpretation What does each user's slate look like, and how is each pick explained?
/rai-prescriptive-results What does each user's slate look like, and how is each pick explained?

```

Expand Down
12 changes: 6 additions & 6 deletions v1/campaign_roi/runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ A marketing team wants to rebalance a fixed quarterly budget across an existing
12 campaigns across 5 regions · current budget ($K) + conversion rate each · $1,130K total
/rai-prescriptive-problem-formulation + /rai-prescriptive-solver-management
/rai-prescriptive-problem
• decision: a new budget per campaign, ≥ 0
• constraints: each campaign within 10%–300% of its current budget;
total spend ≤ $1,130K (pure reallocation); paused WEST region ≤ 50% of total
• objective: maximize sum(budget x conversion rate)
• HiGHS linear program -> OPTIMAL, 3,151 conversions (+17.1%)
/rai-prescriptive-results-interpretation
/rai-prescriptive-results
• total budget binds at $1,130K; WEST binds at its $565K cap
• high-rate campaigns pushed to their 3x ceiling; low-rate ones cut toward their floor
```
Expand All @@ -25,25 +25,25 @@ Each prompt is pasted into a fresh agent session loaded with the named `/rai-*`

## 1. Build the ontology

**Prompt:** /rai-build-starter-ontology Build an ontology from `data/campaigns.csv` — each campaign has a name, a region, a current budget (in $K), and a conversion rate (conversions per $K).
**Prompt:** /rai-ontology Build an ontology from `data/campaigns.csv` — each campaign has a name, a region, a current budget (in $K), and a conversion rate (conversions per $K).

**Response:** Loads `Campaign` (12, with `region`, `current_budget`, `conversion_rate`) across 5 regions (CENTRAL 3, SOUTH 3, EAST 2, NORTH 2, WEST 2), totalling $1,130K of current budget; WEST holds the two highest-rate campaigns.

## 2. Examine the ontology

**Prompt:** /rai-querying What concepts and relationships does the ontology have, and how many rows are in each?
**Prompt:** /rai-pyrel What concepts and relationships does the ontology have, and how many rows are in each?

**Response:** One concept, `Campaign` (12 rows, with `region`, `current_budget`, `conversion_rate`), spanning 5 regions and $1,130K of total current budget.

## 3. Rebalance the portfolio

**Prompt:** /rai-prescriptive-problem-formulation + /rai-prescriptive-solver-management How should we reallocate the budget across campaigns to maximize total expected conversions, keeping total spend at today's $1,130K? Each campaign's new budget must stay between 10% and 300% of its current budget, and the paused WEST region can get at most 50% of the total. Maximize conversions (budget times conversion rate) and persist the new budgets to the ontology.
**Prompt:** /rai-prescriptive-problem How should we reallocate the budget across campaigns to maximize total expected conversions, keeping total spend at today's $1,130K? Each campaign's new budget must stay between 10% and 300% of its current budget, and the paused WEST region can get at most 50% of the total. Maximize conversions (budget times conversion rate) and persist the new budgets to the ontology.

**Response:** OPTIMAL (HiGHS), **3,151 expected conversions** — up from the current baseline of 2,691, a **+17.1% lift** — at unchanged total spend. One continuous budget variable per campaign; new budgets are written back as `Campaign.x_budget`. Both the total-budget constraint ($1,130K) and the WEST cap ($565K) bind exactly.

## 4. Read the reallocation

**Prompt:** /rai-prescriptive-results-interpretation Where does the money move, and which constraints decide the shape of the new plan?
**Prompt:** /rai-prescriptive-results Where does the money move, and which constraints decide the shape of the new plan?

**Response:** The optimizer concentrates spend on the highest-converting campaigns — three are pushed all the way to their **3x ceiling** — while the lowest-rate campaigns are cut toward their **10% floor**; every campaign keeps a nonzero budget (the floor guarantees it). The plan is shaped by two binding limits: total spend holds at **$1,130K**, and the paused **WEST region sits at its $565K (50%) cap** even though it holds the two best conversion rates — so WEST's headroom, not campaign quality, is what stops more money flowing there.

Expand Down
12 changes: 6 additions & 6 deletions v1/cell_tower_coverage/runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ A network planner wants to know which new cell tower sites to build, and which d
6 candidate sites (build cost, capacity) · 10 demand zones (population) · 19 feasible coverage links
/rai-prescriptive-problem-formulation + /rai-prescriptive-solver-management
/rai-prescriptive-problem
• decisions: build site? · zone covered? · tower serves zone? (all binary)
• constraints: ≤ 3 towers; total build cost ≤ $650k; each covered zone served by exactly
one built tower; each tower's served population ≤ its capacity
• objective: maximize covered population
• HiGHS mixed-integer program -> OPTIMAL, 90,000 covered
/rai-prescriptive-results-interpretation
/rai-prescriptive-results
• build T02, T04, T06 ($610k of $650k) → 8 of 10 zones, 87.5% of population
• the 3-tower cap binds (budget has $40k slack); Riverfront + Lakeside stay uncovered
```
Expand All @@ -25,25 +25,25 @@ Each prompt is pasted into a fresh agent session loaded with the named `/rai-*`

## 1. Build the ontology

**Prompt:** /rai-build-starter-ontology Build an ontology from `data/tower_sites.csv` (each candidate site has a build cost and a serving capacity), `data/demand_zones.csv` (each zone has a population), and `data/coverage_pairs.csv` (the feasible site-to-zone links a tower could serve). Model the coverage pair as a relationship linking a tower site to a demand zone.
**Prompt:** /rai-ontology Build an ontology from `data/tower_sites.csv` (each candidate site has a build cost and a serving capacity), `data/demand_zones.csv` (each zone has a population), and `data/coverage_pairs.csv` (the feasible site-to-zone links a tower could serve). Model the coverage pair as a relationship linking a tower site to a demand zone.

**Response:** Loads `TowerSite` (6, with `build_cost` and `capacity`), `DemandZone` (10, with `population` — 102,900 total), and `CoveragePair` (19 feasible site-zone links, each with `distance_km` and `signal_score`), linked back to their site and zone.

## 2. Examine the ontology

**Prompt:** /rai-querying What concepts and relationships does the ontology have, and how many of each?
**Prompt:** /rai-pyrel What concepts and relationships does the ontology have, and how many of each?

**Response:** Three concepts — 6 `TowerSite` (build cost, capacity), 10 `DemandZone` (population, 102,900 total), and 19 `CoveragePair` (the only allowed site-to-zone service links) — so not every zone can be served by every tower.

## 3. Maximize covered population

**Prompt:** /rai-prescriptive-problem-formulation + /rai-prescriptive-solver-management Which sites should we build and which tower should serve each zone to cover the most people, building at most 3 towers within a $650,000 budget? Use a binary build decision per site, a binary covered decision per zone, and a binary serve decision per feasible site-zone pair. A zone counts as covered only if it's assigned to exactly one built tower, a tower can only serve zones if it's built, and the population a tower serves can't exceed its capacity. Maximize total covered population and persist the decisions to the ontology.
**Prompt:** /rai-prescriptive-problem Which sites should we build and which tower should serve each zone to cover the most people, building at most 3 towers within a $650,000 budget? Use a binary build decision per site, a binary covered decision per zone, and a binary serve decision per feasible site-zone pair. A zone counts as covered only if it's assigned to exactly one built tower, a tower can only serve zones if it's built, and the population a tower serves can't exceed its capacity. Maximize total covered population and persist the decisions to the ontology.

**Response:** OPTIMAL (HiGHS), covered population **90,000 of 102,900** (relative gap 0.0). The model has 3 binary decision families and 5 constraint families; build, cover, and serve decisions are written back as `TowerSite.x_selected`, `DemandZone.y_covered`, and `CoveragePair.z_assigned`.

## 4. Read the build plan

**Prompt:** /rai-prescriptive-results-interpretation Which towers get built, which zones do they serve, and what's the coverage rate — and is the budget or the tower count the binding limit?
**Prompt:** /rai-prescriptive-results Which towers get built, which zones do they serve, and what's the coverage rate — and is the budget or the tower count the binding limit?

**Response:** Build **T02 (North Water Tank), T04 (Campus Microcell), and T06 (Airport Perimeter)** for **$610,000 of the $650,000 budget**, covering **8 of 10 zones — 90,000 people, an 87.5% coverage rate**. All three towers run above 90% of capacity. The **3-tower cap is the binding limit** in this solve — 0 towers to spare, versus $40k of budget headroom; Riverfront (7,200) and Lakeside (5,700) are left uncovered. Reaching them would take both another tower and more budget: the only sites that can serve those two zones push the cheapest fully-covering plan to a 4th tower at about $850k, past both the count cap and the budget.

Expand Down
Loading
Loading