ShiftOpt is a high-performance resource allocation engine designed to solve the "Retail Rostering Problem."
It bridges the gap between Operational Constraints (Labor laws, availability, cost budgets) and Mathematical Optimization (Cost minimization, coverage maximization).
Project Status: Phase 1 (MVP - Greedy Algorithm & Simulation)
In Retail, Logistics, and Hospitality, managers spend 10-20 hours a week manually creating shift rosters. This leads to two critical failures:
- Overstaffing: Paying for staff during quiet hours (High Cost).
- Understaffing: Losing revenue during peak hours (Lost Opportunity).
The Challenge: Assigning 50 employees to 30 days of shifts is not a CRUD problem; it is a combinatorial optimization problem with millions of potential permutations.
The Solution: ShiftOpt automates this by treating the schedule as a math equation. It ingests "Demand Curves" (predicted foot traffic) and "Employee Constraints" to generate a mathematically optimal roster in milliseconds.
This project is designed as a Simulation & Optimization Pipeline.
Instead of relying on static data, ShiftOpt uses a Monte Carlo-style simulation to generate:
- Demand Curves: Uses Sine waves + Noise to simulate realistic retail traffic (Pe
- Current State (Baseline): A Greedy Algorithm that iteratively selects the lowest-cost available resource for every open slot.
- Future State: A Constraint Satisfaction Solver (or Genetic Algorithm) that optimizes for "Global Cost" rather than "Local Cost," taking into account fatigue, overtime rules, and skill mixing.
- Language: Go (Golang) - Chosen for raw performance and concurrency in calculation loops.
- Database: SQLite - Embedded, low-latency storage for rapid simulation resets.
- Build System: GNU Make.
We are following an evolutionary development path:
-
Phase 1: Foundation (Current)
- Domain Modeling (Employees, Demands).
- Simulation Engine (Generating realistic test data).
- Baseline "Greedy" Scheduler (Finding the minimum viable roster).
- Clean Architecture (
cmd/vsinternal/).
-
Phase 2: The "Real" World (Constraints)
- Implement hard constraints (e.g., "Max 8 hours/day", "Must have 1 Manager on site").
- Refactor algorithm to handle backtracking or penalty scoring.
-
Phase 3: AI Integration
- LLM-based parser: Convert unstructured texts ("I can't work Friday") into structured DB constraints.
- Demand Prediction: Use external factors (Weather/Holidays) to adjust demand curves.
-
Phase 4: Operational Dashboard
- HTML/CSS Visualization of the roster vs. the budget.
This project uses Make for build automation.
- Go 1.21+
- Make
- GCC (for SQLite CGO, though we use a pure-Go driver where possible)
# 1. Run the simulation and scheduler immediately
make run
# 2. Build the optimized binary to ./bin/shiftopt
make build
# 3. Clean up the database and binaries to start fresh
make clean
# 4. Run tests
make test
π Project Structure
We follow the standard Go project layout:
.
βββ bin
β βββ shiftopt
β βββ shiftsummary
βββ cmd
β βββ shiftopt
β β βββ main.go
β βββ shiftsummary
β βββ main.go
βββ doc
β βββ 001_genesis_and_stack.md
β βββ 002_the_greedy_baseline.md
β βββ 003_the_safety_constraint.md
β βββ 004_stochastic_simulation.md
β βββ 005_product_checkpoint.md
β βββ 006_visualization_and_fragmentation.md
β βββ 007tetris_and_edge_cases.md
β βββ 008_diagnostic_observability.md
β βββ 009_optimization_strategy.md
β βββ 010_availability_architecture.md
βββ go.mod
βββ go.sum
βββ internal
β βββ ai
β β βββ parser.go
β βββ database
β β βββ sqlite.go
β βββ models
β β βββ models.go
β βββ scheduler
β βββ export.go
β βββ greedy.go
β βββ max-hours.go
β βββ safe-shift.go
β βββ scored.go
β βββ tetris.go
βββ Makefile
βββ README.md
βββ roster.csv
βββ shiftopt.db
βββ tests
βββ integration_test.go
- Combinatorial Optimization Problem
- Monte Carlo-style simulation
- Operational Constraints
- The Roadmap.