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.
- 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.
Contains utility functions for generating ship parameters, lock types, calculating water costs, and printing results.
Main script to run the QUBO model instances, evaluate solutions, and plot results.
Implements the QAOA algorithm for solving the QUBO problem using quantum circuits.
Defines global tuning parameters used across the project.
Builds the QUBO matrix for the ship scheduling problem.
Evaluates candidate solutions for the QUBO problem, checking constraints and calculating penalties.
Processes input data to generate ship data for the QUBO model.
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- Generate Ship Parameters: Randomly generates benefits and lengths for a given number of ships.
- Generate Lock Types: Generates lock types for each time slot.
- Build QUBO Model: Constructs the QUBO model with constraints and objectives.
- Run Optimization: Uses simulated annealing to find the best feasible solution.
- Evaluate Solutions: Evaluates the solutions based on water cost, penalties, and other metrics.
- Plot Results: Plots the optimized water usage cost against the baseline cost for different instance sizes.
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.