Skip to content

Quantum-enhanced workflow scheduling optimizes multi-processor resource allocation using DAGs and a hybrid quantum-classical approach, visualized via advanced tools. QUBO problem formulation ensures efficiency.

Notifications You must be signed in to change notification settings

manvith12/quantum-workflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quantum Workflow Optimizer

Workflow Example

Overview

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.

Core Components

1. Graph Construction

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

2. QUBO Formulation

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

3. Quantum Solver

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

Visualization Examples

Workflow Graph

DAG Visualization Directed Acyclic Graph representing task dependencies

Resource Usage

Resource Usage CPU and RAM usage across processors

Schedule Timeline

Schedule Timeline Task scheduling visualization across processors

STATS

Stats processor stats

Advanced Usage

Custom Resource Constraints

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

Installation

# 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

Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

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}
}

Contact

About

Quantum-enhanced workflow scheduling optimizes multi-processor resource allocation using DAGs and a hybrid quantum-classical approach, visualized via advanced tools. QUBO problem formulation ensures efficiency.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages