Manual

Quick Start Guide

Using the Exact Sampler

using JuMP
using ToQUBO
using QUBODrivers

model = Model(() -> ToQUBO.Optimizer(ExactSampler.Optimizer))

@variable(model, x[1:3], Bin)

@objective(model, Max, 1.0 * x[1] + 2.0 * x[2] + 3.0 * x[3])

@constraint(model, 0.3 * x[1] + 0.5 * x[2] + 1.0 * x[3] <= 1.6)

optimize!(model)

solution_summary(model)
solution_summary(; result = 1, verbose = false)
├ solver_name          : Virtual QUBO Model
├ Termination
│ ├ termination_status : OPTIMAL
│ ├ result_count       : 256
│ └ raw_status         : optimal
├ Solution (result = 1)
│ ├ primal_status        : FEASIBLE_POINT
│ ├ dual_status          : NO_SOLUTION
│ └ objective_value      : 5.00000e+00
└ Work counters
  └ solve_time (sec)   : 6.76020e-05

Using PySA (Simulated Annealing)

PySA follows the same optimizer wrapper pattern when it is available in your project environment:

using JuMP
using ToQUBO
using PySA

model = Model(() -> ToQUBO.Optimizer(PySA.Optimizer))

@variable(model, x[1:3], Bin)

@objective(model, Max, 1.0 * x[1] + 2.0 * x[2] + 3.0 * x[3])

@constraint(model, 0.3 * x[1] + 0.5 * x[2] + 1.0 * x[3] <= 1.6)

optimize!(model)

solution_summary(model)

Table of Contents