Package: ccvm-simulators
Coherent Continous-Variable Machine SimulatorsThis 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 ContentsRequirementsQuickstartArchitecture and Workflow OverviewUsageDocumentationBoxQP Problem DefinitionccvmplotlibContributingReferencesLicenseRequirementsPython (supported version: 3.10)Supported operating systemsmacOS (Monterey, Big Sur)Ubuntu (20.04)QuickstartOnce you have cloned the repository, install the package usingpip.pip install ccvm-simulatorsGo intoexamples/and run the demo scripts.ccvm_boxqp_dl.py: Solve a BoxQP problem using a CCVM simulator, w/o plottingccvm_boxqp_plot.py: Solve a BoxQP problem using a CCVM simulator, w/ time-to-solution (TTS) plottingFor more demo scripts seeexamples/README.mdView the generated plot.Theccvm_boxqp_plot.pyscript solves a single problem instance, and will create an image of the resulting TTS plot in aplots/directory. The resulting output image,DL-CCVM_TTS_cpu_plot.png, will look something like this:Extending the ExamplePlotting larger datasetsTheccvm_boxqp_plot.pyscript 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:Other types of plotsccvmplotlibcan also plot the success probability data, for example:Architecture and Workflow OverviewExample WorkflowThe 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 DiagramThis diagram offers a concise visualization of the main classes and their interactions within theccvm_simulatorspackage.The solver hierarchyThe diagram portrays the relationships among different solvers and their
association with the abstracted CCVM solver class.Post processor hierarchyThe diagram delineates the relationships between various post processors and
their connection to the abstracted post processor class.Plotter class diagramThe diagram provides more details in how plotter library can be used and the asscoatiated
class relationship.UsageSolving a BoxQP Problem1. Import Modulesfromccvm_simulators.problem_classes.boxqpimportProblemInstancefromccvm_simulators.solversimportDLSolver2. Define a Solversolver=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 Instanceboxqp_instance=ProblemInstance(instance_type="test",file_path="./examples/test_instances/test020-100-10.in",device=solver.device,)4. Scale the CoefficientsThe 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'sget_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 Instancesolution=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.560976print(f"The best objective value found by the solver was{solution.best_objective_value}")# The best objective value found by the solver was 798.1630859375print(f"The solving process took{solution.solve_time}seconds")# The solving process took 8.949262142181396 secondsDocumentationThe package documentation can be foundhere.Additional links:Problem definition:BoxQP problem classPlotting library:ccvmplotlibContributingWe appreciate your pull requests and welcome opportunities to discuss new ideas. Check out ourcontribution guideand feel free to improve theccvm_simulatorspackage. 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.ReferencesThis 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.LicenseAPGLv3