Skip to content

21jritz/quantum-multi-agent-scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quantum Multi-Agent Scheduling System

A multi-agent quantum-classical system where three autonomous agents submit domain constraints to a QAOA quantum optimizer, which resolves all cross-agent conflicts simultaneously and returns a valid schedule.

Built and tested on NVIDIA NGC using CUDA-Q cu12-0.9.0.


Demo

Three agents start up, each reporting their own constraints. The quantum coordinator receives all constraints and finds a globally optimal conflict-free schedule.

[System] Starting agents...
[System] All agents online.

[Teacher Agent] Detected 3 teacher conflict(s):
  - Teacher A teaches both Math and Science
  - Teacher B teaches both English and History
  - Teacher C teaches both Technology and French

[Room Agent] Detected 3 room conflict(s):
  - Room 1 is assigned to both Math and English
  - Room 2 is assigned to both Science and Technology
  - Room 3 is assigned to both History and French

[Class Agent] Detected 3 student conflict(s):
  - Group 1 attends both Math and History
  - Group 2 attends both English and Science
  - Group 3 attends both Technology and French

[Quantum Coordinator] Unique conflicts: 8
[Quantum Coordinator] Running QAOA optimization...

====================================================
   FINAL OPTIMIZED SCHEDULE
====================================================
Slot A:
  * Math         | Teacher A    | Room 1
  * Technology   | Teacher C    | Room 2
Slot B:
  * English      | Teacher B    | Room 1
  * French       | Teacher C    | Room 3
Slot C:
  * Science      | Teacher A    | Room 2
  * History      | Teacher B    | Room 3

CONFLICT CHECK:
  OK Math(Slot A) vs Science(Slot C) -- OK
  OK English(Slot B) vs History(Slot C) -- OK
  OK Technology(Slot A) vs French(Slot B) -- OK
  OK Math(Slot A) vs English(Slot B) -- OK
  OK Science(Slot C) vs Technology(Slot A) -- OK
  OK History(Slot C) vs French(Slot B) -- OK
  OK Math(Slot A) vs History(Slot C) -- OK
  OK English(Slot B) vs Science(Slot C) -- OK

  STATUS: VALID SCHEDULE - 0 CONFLICTS

What This Project Does

This is an extension of the single-agent quantum scheduler. Instead of one agent managing all constraints, three specialized agents each own a domain:

  • Teacher Agent — detects teacher double-booking conflicts
  • Room Agent — detects room assignment conflicts
  • Class Agent — detects student group overlap conflicts

No single agent can see the full picture. The quantum coordinator is the only component that sees all 8 constraints simultaneously and finds a globally valid solution using QAOA.

This mirrors real enterprise multi-agent architectures where departments submit constraints to a central optimizer — except the optimizer here runs on quantum hardware.


Architecture

Teacher Agent (teacher_agent.py)
       |
Room Agent (room_agent.py)       ---->  Quantum Coordinator (main.py)
       |                                      |
Class Agent (class_agent.py)            CUDA-Q QAOA Circuit
                                              |
                                    Conflict-Free Schedule
                                              |
                                       mas_log.txt (auto-logged)

Why Quantum?

The scheduling problem with 8 constraints across 6 classes is NP-hard. Classical brute-force approaches must evaluate every possible time slot combination. QAOA encodes all 8 constraints simultaneously into a Hamiltonian and uses quantum superposition to explore many combinations at once, amplifying conflict-free solutions through quantum interference.

When 2 time slots are insufficient (graph chromatic number > 2), the system automatically falls back to a classical 3-coloring resolver — demonstrating a real hybrid quantum-classical workflow.


File Structure

quantum-multi-agent-scheduler/
├── main.py            -- orchestrator, runs all agents + quantum coordinator
├── teacher_agent.py   -- owns teacher availability and conflict detection
├── room_agent.py      -- owns room assignments and conflict detection
├── class_agent.py     -- owns student groups and conflict detection
├── coordinator.py     -- standalone quantum QAOA engine
└── requirements.txt   -- dependencies

Tech Stack

Tool Role
NVIDIA CUDA-Q Quantum circuit simulation
QAOA Algorithm Multi-constraint quantum optimization
Python 3.10 Primary language
NVIDIA NGC Cloud container infrastructure
Docker Container runtime

How to Run

Prerequisites

  • Docker Desktop installed
  • NVIDIA NGC account (free at ngc.nvidia.com)

Pull the CUDA-Q container

docker pull nvcr.io/nvidia/quantum/cuda-quantum:cu12-0.9.0

Run the full multi-agent system

docker run --rm --entrypoint="" -v /your/local/path:/files \
  nvcr.io/nvidia/quantum/cuda-quantum:cu12-0.9.0 \
  python3 /files/main.py

Run individual agents

docker run --rm --entrypoint="" -v /your/local/path:/files \
  nvcr.io/nvidia/quantum/cuda-quantum:cu12-0.9.0 \
  python3 /files/teacher_agent.py

Key Concepts

Multi-Agent Constraint Aggregation: Each agent independently detects conflicts in its own domain and reports them to the coordinator. The coordinator deduplicates overlapping constraints before building the Hamiltonian, ensuring each conflict is counted exactly once.

Hybrid Quantum-Classical Fallback: When the problem requires more than 2 time slots (chromatic number > 2), QAOA's binary output is insufficient. The system detects this and switches to a classical greedy 3-coloring algorithm, demonstrating a production-ready hybrid workflow.

Hamiltonian Encoding: Each conflict edge (node_a, node_b) becomes a term 0.5 * Z(a) * Z(b) in the cost Hamiltonian. Minimizing the Hamiltonian energy is mathematically equivalent to maximizing satisfied scheduling constraints.


Comparison to Previous Project

Feature Quantum Scheduler v1 Quantum Multi-Agent System
Agents 1 3
Constraint types Teacher only Teacher + Room + Student
Time slots 2 2-3 (adaptive)
Conflict detection Manual Automatic per agent
Fallback strategy Multi-seed Hybrid quantum-classical

Results

The system resolves 8 cross-domain constraints across 3 agent types in a single QAOA run, producing a valid 3-slot schedule with zero conflicts. All sessions are automatically logged with timestamps to mas_log.txt.


Author

Joshua Ritz — github.com/21jritz

Built on NVIDIA NGC | CUDA-Q cu12-0.9.0 | Multi-Agent Architecture

About

A quantum multi-agent coordination system on NVIDIA NGC where three autonomous LangChain agents submit domain constraints to a QAOA optimizer, resolving cross-agent scheduling conflicts across teachers, rooms, and student groups simultaneously

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages