Skip to main content

Solve continuous non-convex optimization problems with CCVM architectures and simulators

Project description

Coherent Continous-Variable Machine Simulators

License: AGPL v3 Maintainer Paper Docs

This software package includes solvers for continuous optimization problems. The solvers are simulators of coherent continuous-variable machines (CCVM), which are novel coherent network computing architectures based on NTT Research’s coherent Ising machines (CIM). In CCVMs, the physical properties of optical pulses (e.g., mean-field quadrature amplitudes and phase) represent the continuous variables of a given optimization problem. Various features of CCVMs can be used along with programming techniques to implement the constraints imposed by such an optimization problem. Included are methods for solving box-constrained quadratic programming (BoxQP) problems using CCVM simulators by mapping the variables of the problems into the random variables of CCVMs.

Table of Contents

  1. Requirements
  2. Quickstart
  3. Architecture and Workflow Overview
  4. Usage
  5. Documentation
  6. Contributing
  7. References
  8. License

Requirements

  • Python (supported version: 3.10)

Supported operating systems

  • macOS (Monterey, Big Sur)
  • Ubuntu (20.04)

Quickstart

  1. Once you have cloned the repository, install the package using pip.
 pip install ccvm-simulators
  1. Go into examples/ and run the demo scripts.

    • ccvm_boxqp_dl.py: Solve a BoxQP problem using a CCVM simulator, w/o plotting
    • ccvm_boxqp_plot.py: Solve a BoxQP problem using a CCVM simulator, w/ time-to-solution (TTS) plotting
    • For more demo scripts see examples/README.md
  2. View the generated plot.

    • The ccvm_boxqp_plot.py script solves a single problem instance, and will create an image of the resulting TTS plot in a plots/ directory. The resulting output image, DL-CCVM_TTS_cpu_plot.png, will look something like this:

Extending the Example

  1. Plotting larger datasets
    • The ccvm_boxqp_plot.py script is a toy example that plots the TTS for only a single problem instance.
    • It can be extended to solve multiple problems over a range of problem sizes.
    • When solution metadata is saved for multiple problems, the graph becomes more informative, for example:

  1. Other types of plots
    • ccvmplotlib can also plot the success probability data, for example:

Architecture and Workflow Overview

Example Workflow

The workflow diagram showcases, step-by-step, how the CCVM simulators can be used to solve a problem. As users progress through the problem-solving steps, they are presented with two distinct options to conclude their process. They can choose to either visually plot the solution or to print the results.

High-Level Class Diagram

This diagram offers a concise visualization of the main classes and their interactions within the ccvm_simulators package.

The solver hierarchy

The diagram portrays the relationships among different solvers and their association with the abstracted CCVM solver class.

Post processor hierarchy

The diagram delineates the relationships between various post processors and their connection to the abstracted post processor class.

Plotter class diagram

The diagram provides more details in how plotter library can be used and the asscoatiated class relationship.

Usage

Solving a BoxQP Problem

1. Import Modules
from ccvm_simulators.problem_classes.boxqp import ProblemInstance
from ccvm_simulators.solvers import DLSolver
2. Define a Solver
solver = DLSolver(device="cpu", batch_size=100)  # or "cuda"
solver.parameter_key = {
    20: {"pump": 2.0, "dt": 0.005, "iterations": 15000, "noise_ratio": 10},
}
3. Load a Problem Instance
boxqp_instance = ProblemInstance(
    instance_type="test",
    file_path="./examples/test_instances/test020-100-10.in",
    device=solver.device,
)
4. Scale the Coefficients

The BoxQP problem matrix Q and vector V are normalized to obtain a uniform performance across different problem sizes and densities. The ideal range depends on the solver. For best results, Q should be passed to the solver's get_scaling_factor() method to determine the best scaling value for the problem–solver combination.

boxqp_instance.scale_coefs(solver.get_scaling_factor(boxqp_instance.q_matrix))
5. Solve the Problem Instance
solution = solver(
    instance=boxqp_instance,
    post_processor=None,
)

print(f"The best known solution to this problem is {solution.optimal_value}")
# The best known solution to this problem is 799.560976

print(f"The best objective value found by the solver was {solution.best_objective_value}")
# The best objective value found by the solver was 798.1630859375

print(f"The solving process took {solution.solve_time} seconds")
# The solving process took 8.949262142181396 seconds

Documentation

The package documentation can be found here.

Additional links:

Contributing

We appreciate your pull requests and welcome opportunities to discuss new ideas. Check out our contribution guide and feel free to improve the ccvm_simulators package. For major changes, please open an issue first to discuss any suggestions for changes you might have.

Thank you for considering making a contribution to our project! We appreciate your help and support.

References

This repository contains architectures and simulators presented in the paper "Non-convex Quadratic Programming Using Coherent Optical Networks" by Farhad Khosravi, Ugur Yildiz, Artur Scherer, and Pooya Ronagh.

License

APGLv3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccvm-simulators-1.0.1.tar.gz (57.8 kB view details)

Uploaded Source

Built Distribution

ccvm_simulators-1.0.1-py3-none-any.whl (85.2 kB view details)

Uploaded Python 3

File details

Details for the file ccvm-simulators-1.0.1.tar.gz.

File metadata

  • Download URL: ccvm-simulators-1.0.1.tar.gz
  • Upload date:
  • Size: 57.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for ccvm-simulators-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5c3ca42c1d581709fe4661596cc79943a442a6be8f87fbfdc5224f7f7a693642
MD5 9b1320b0921fcd44703a8aacae8b98ab
BLAKE2b-256 c230d0dc647823b56f10dedccbcbdd88f9e1897fac3bd89b992f3bb95e8975ac

See more details on using hashes here.

File details

Details for the file ccvm_simulators-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ccvm_simulators-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1e2192295ee3c07b92fdbe51ba889e993279800c7d6ff665eae394b73b4b7db5
MD5 684cf81b1298318386b772c95dcf2f28
BLAKE2b-256 ce0581e222209e743f430a3e90d0318fb0b4e9a6d22ca65654824932318bc89f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page