Skip to content

pasqal-io/Pasqal_Hackathon_Feb25_Team_05

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QUBO_Panama

QUBO Panama Canal Ship Scheduling

This project implements a Quadratic Unconstrained Binary Optimization (QUBO) model to optimize the scheduling of ships through the Panama Canal. The goal is to minimize the water usage cost while adhering to various constraints such as ship scheduling, lock capacities, and tandem lockage lengths.

Features

  • Random Instance Generation: Generates random ship parameters (benefits, lengths) and lock types for each time slot.
  • QUBO Model Building: Constructs a QUBO model incorporating various constraints and objectives.
  • Solution Evaluation: Evaluates candidate solutions based on water cost, penalties, and other metrics.
  • Simulated Annealing: Uses simulated annealing to find feasible and optimized solutions.
  • Visualization: Plots the optimized water usage cost against the baseline cost for different instance sizes.

Code Overview

utils.py

Contains utility functions for generating ship parameters, lock types, calculating water costs, and printing results.

run.py

Main script to run the QUBO model instances, evaluate solutions, and plot results.

QAOA.py

Implements the QAOA algorithm for solving the QUBO problem using quantum circuits.

parameters.py

Defines global tuning parameters used across the project.

make_qubo.py

Builds the QUBO matrix for the ship scheduling problem.

evaluate.py

Evaluates candidate solutions for the QUBO problem, checking constraints and calculating penalties.

data_processing.py

Processes input data to generate ship data for the QUBO model.

Dependencies and Requirements

To run the code, you need the following dependencies:

  • Python 3.7 or higher
  • numpy
  • pandas
  • matplotlib
  • dimod
  • pulser
  • pulser_simulation
  • scipy

You can install the required packages using pip:

pip install numpy pandas matplotlib dimod pulser pulser_simulation scipy

Usage

  1. Generate Ship Parameters: Randomly generates benefits and lengths for a given number of ships.
  2. Generate Lock Types: Generates lock types for each time slot.
  3. Build QUBO Model: Constructs the QUBO model with constraints and objectives.
  4. Run Optimization: Uses simulated annealing to find the best feasible solution.
  5. Evaluate Solutions: Evaluates the solutions based on water cost, penalties, and other metrics.
  6. Plot Results: Plots the optimized water usage cost against the baseline cost for different instance sizes.

Example Usage Notebook

An example usage of the QUBO Panama model can be found in the Jupyter notebook example_usage.ipynb. This notebook demonstrates how to import the necessary modules, run the QUBO model, and visualize the results.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published