Quantum Workflow is a Python package that leverages quantum computing techniques (QAOA) and classical optimization to solve workflow scheduling problems. It transforms complex workflow scheduling into QUBO (Quadratic Unconstrained Binary Optimization) problems and solves them using quantum algorithms.
def build_graph(workflow_data):
"""Constructs a directed acyclic graph from workflow data"""
G = nx.DiGraph()
for _, row in workflow_data.iterrows():
G.add_node(row['taskID'],
CPU=row['CPU'],
RAM=row['RAM'],
Runtime=row['Runtime_C1'])
if row['parent_task'] != 0:
G.add_edge(row['parent_task'], row['taskID'])
return G
def create_qubo_matrix(G, num_processors=3):
"""Creates QUBO matrix for workflow scheduling"""
num_tasks = len(G.nodes())
matrix_size = num_tasks * num_processors
Q = np.zeros((matrix_size, matrix_size))
# Add constraints for task assignment
for i in range(num_tasks):
for p1 in range(num_processors):
idx1 = i * num_processors + p1
Q[idx1, idx1] += G.nodes[i+1]['Runtime']
return Q
def solve_with_qaoa(qubo_matrix, p=1):
"""Solves scheduling problem using QAOA"""
qp = QuadraticProgram()
# Create binary variables
for i in range(qubo_matrix.shape[0]):
qp.binary_var(name=f'x_{i}')
# Set objective function
qp.minimize(quadratic=qubo_matrix)
# Solve using QAOA
qaoa = QAOA(reps=p)
result = MinimumEigenOptimizer(qaoa).solve(qp)
return result
Directed Acyclic Graph representing task dependencies
CPU and RAM usage across processors
Task scheduling visualization across processors
def add_resource_constraints(Q, G, processor_capacities):
"""Add resource capacity constraints to QUBO matrix"""
cpu_limit = processor_capacities['CPU']
ram_limit = processor_capacities['RAM']
penalty = 1000.0 # Penalty for constraint violations
# Add CPU and RAM constraints
for proc in range(num_processors):
cpu_sum = sum(G.nodes[t]['CPU'] for t in G.nodes())
if cpu_sum > cpu_limit:
Q += penalty * (cpu_sum - cpu_limit)**2
return Q
# Clone the repository
git clone https://github.com/manvith12/quantum-workflow.git
# Create virtual environment
python -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
We welcome contributions! Please see our Contributing Guidelines for details.
This project is licensed under the MIT License - see the LICENSE file for details.
If you use this package in your research, please cite:
@software{quantum_workflow,
title = {Quantum Workflow Optimizer},
author = {Manvith},
year = {2025},
url = {https://github.com/manvith12/quantum-workflow}
}
- Email: sanisettykumar24bcs0217@iiitkottayam.ac.in
- GitHub Issues: Create an issue