Luna Use Cases
A collection of ready-to-use optimization problems built on a standardized interface. Each use case provides data models, mathematical formulations, and solution interpretation — so you can focus on solving, benchmarking, and extending.
How It Works
Every use case follows the same workflow:
graph LR
A[Data] --> C[Instance]
B[Formulation] --> C
C --> D[Model]
D --> E[Solver]
E --> F[Solution]
F --> G[Result]
You define problem data, pick a formulation, and combine them into an instance. The instance produces a solver-ready model, and after solving, the result is interpreted back into a structured solution.
from luna_usecases.traveling_salesman_problem import TspData, TspFormulation, TspInstance
data = TspData.from_distance_matrix(distances, city_names=cities)
instance = TspInstance(data=data, formulation=TspFormulation())
model = instance.formulate()
# solution = solver.solve(model)
# result = instance.interpret(solution)
Available Use Cases
| Use Case | Category | Documentation |
|---|---|---|
| Bin Packing | Combinatorial | Example · API |
| Integer Knapsack | Combinatorial | Example · API |
| Set Cover | Combinatorial | Example · API |
| Travelling Salesman | Combinatorial | Example · API |
| Uncapacitated Facility Location | Combinatorial | Example · API |
| MaxCut | Graph | Example · API |
| Max 2-SAT | Graph | Example · API |
| Portfolio Optimization | Finance | Example · API |
| Production Assignment | Scheduling | Example · API |
Where to Find What
-
Installation
Set up
uv, install the package, and configure your API key. -
Quick Start
Run your first benchmark end-to-end in a few minutes.
-
Your First Use Case
Step-by-step guide to creating a custom optimization problem from scratch.
-
Extending Formulations
Create alternative formulations for existing problems or add new constraints.
-
Custom Solvers
Integrate your own solver with the use case framework.
-
Architecture
Understand the core components: Data, Formulation, Instance, Solution, and Registry.