Skip to content

Cross-pollination: new templates, recipes, solver variety, dedup#35

Open
cafzal wants to merge 5 commits intomainfrom
cross-pollination-additions
Open

Cross-pollination: new templates, recipes, solver variety, dedup#35
cafzal wants to merge 5 commits intomainfrom
cross-pollination-additions

Conversation

@cafzal
Copy link
Copy Markdown
Contributor

@cafzal cafzal commented Mar 31, 2026

Summary

Cross-pollination pass between templates/ and rai-agent-skills/ to ensure MECE coverage across reasoner types, domains, and solver variety.

Consolidation (commit 1)

  • Removed network_flow — redundant with inventory_rebalancing (same min-cost flow pattern)
  • Removed vehicle_scheduling — redundant with order_fulfillment (same fixed-charge big-M pattern)
  • Enhanced inventory_rebalancing — added transit hub sites and flow conservation constraint, absorbing the unique dual-ref balance pattern from network_flow

New templates (commit 2)

Five new templates adapted from demos/ counterparts, filling coverage gaps:

  • shipment_compliance (rules) — late shipments, at-risk, single-sourced BOMs, escalated demand
  • manufacturing_compliance (rules) — overdue maintenance, parts reorder, high-risk machines, expiring certs
  • machine_dependencies (graph) — shared-technician dependency clusters via WCC + betweenness centrality
  • portfolio_compliance (rules) — position concentration, sector overweight, high-risk traders
  • warehouse_allocation (chained graph+prescriptive) — centrality-weighted inventory allocation

Recipes (commit 3)

New recipes/ folder with multi-reasoner chain walkthroughs referencing existing templates:

  • supply_chain_resilience.md — graph (site-centrality) → rules (shipment-compliance) → prescriptive (supplier-reliability)
  • manufacturing_maintenance.md — graph (machine-dependencies) → rules (manufacturing-compliance) → prescriptive (machine-maintenance)
  • portfolio_risk_management.md — graph (fraud-detection) → rules (portfolio-compliance) → prescriptive (portfolio-balancing)

Standards and solver variety (commit 4)

  • Solver variety: water_allocation now uses Ipopt (nonlinear losses), portfolio_balancing now uses Ipopt (quadratic objective). All 4 open-source solvers represented (HiGHS, Ipopt, MiniZinc).
  • Code standards: DATA_DIR, docstring format, concept comments, section separators — all 8 scripts
  • README standards: bold reasoning types, private.relational.ai ZIP URLs, Troubleshooting <details> blocks, code snippet accuracy — all 8 READMEs

Test plan

  • All 5 new templates executed successfully against RAI cloud (rules, graph, prescriptive)
  • water_allocation Ipopt solve: LOCALLY_SOLVED, cost=$853.39
  • portfolio_balancing Ipopt solve: LOCALLY_SOLVED, risk=5119.24
  • warehouse_allocation chained solve: graph centrality → OPTIMAL allocation, cost=$13,713.29
  • traveling_salesman HiGHS: OPTIMAL, distance=8.5
  • inventory_rebalancing with flow conservation: OPTIMAL
  • All .py files pass py_compile syntax checks
  • All CSV column references verified against code
  • README frontmatter, Quickstart URLs, code snippets audited against .github/prompts standards

cafzal added 4 commits March 31, 2026 09:54
…ling

- Remove network_flow (same min-cost flow pattern as inventory_rebalancing)
- Remove vehicle_scheduling (same fixed-charge big-M pattern as order_fulfillment)
- Add flow conservation constraint + transit hub sites to inventory_rebalancing,
  absorbing the unique dual-ref flow balance pattern from network_flow
New templates adapted from demos/ counterparts:
- shipment_compliance: rules template (late shipments, at-risk, single-sourced BOMs, escalated demand)
- manufacturing_compliance: rules template (overdue maintenance, parts reorder, high-risk machines, expiring certs)
- machine_dependencies: graph template (shared-technician dependency clusters, betweenness centrality)
- portfolio_compliance: rules template (position concentration, sector overweight, high-risk traders)
- warehouse_allocation: chained graph+prescriptive template (centrality-weighted inventory allocation)
Recipes show how single-reasoner templates combine into staged workflows:
- supply_chain_resilience: graph (site-centrality) -> rules (shipment-compliance) -> prescriptive (supplier-reliability)
- manufacturing_maintenance: graph (machine-dependencies) -> rules (manufacturing-compliance) -> prescriptive (machine-maintenance)
- portfolio_risk_management: graph (fraud-detection) -> rules (portfolio-compliance) -> prescriptive (portfolio-balancing)
Code standards (all 8 new/changed scripts):
- Rename data_dir to DATA_DIR per template conventions
- Fix module docstrings: indented Run/Output blocks, standard bullet format
- Fix concept comments to use "ConceptName concept: description." form
- Normalize section comment style to dashed separators
- Remove trailing commas in where() blocks (manufacturing_compliance)

Solver variety:
- water_allocation: switch from HiGHS to Ipopt with nonlinear loss model
  (effective_flow = flow * (1 - loss_rate * flow / max_flow))
- portfolio_balancing: switch from HiGHS to Ipopt for quadratic objective
- traveling_salesman: revert to HiGHS-only (MiniZinc incompatible with MTZ)

README compliance (all 8 READMEs):
- Fix Quickstart ZIP URLs to private.relational.ai
- Add bold reasoning type in "What this template is for" sections
- Add featured: false to frontmatter where missing
- Add Troubleshooting sections with <details>/<summary> blocks
- Fix <code> tags in existing Troubleshooting summaries
- Update code snippets to match actual code (portfolio_balancing)
- Add How it works lead-in lines where missing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant