Expand description
§Planning QUBO
Planning, scheduling and constraint problems as QUBO and Ising models: encoders, decoders, penalty tuning, classical samplers and export for quantum annealers and QAOA.
§Scope
- QUBO and Ising models with named binary variables and a penalty builder (exactly-one, at-most-one, linear constraints with slack bits, objective terms)
- Encoders for constraint satisfaction, time-indexed scheduling, assignment and allocation, time-expanded multi-agent path finding and routing
- Decoders that map samples back to plans and report violated constraints, plus penalty-weight tuning
- A sampler interface with classical baselines (exhaustive, simulated annealing, tabu search, parallel tempering)
- Export to annealer formats and adapters for quantum frameworks
Available now: Qubo and Ising models with exact conversion in both directions,
the penalty Builder, the assignment encoder and decoder, and the Exhaustive
and SimulatedAnnealing samplers. Samplers reuse their workspace, stop on a
Budget and resume later.
§Pipeline
graph LR
problem[Assignment problem] -->|encode| builder[Builder]
builder -->|build| encoded[Problem: QUBO + constraints]
encoded -->|Sampler| sample[Sample]
sample -->|decode| plan[Assignment + violations]
encoded -.->|to_ising| ising[Ising]§Example
use planning_qubo::{Exhaustive, Sampler, Unlimited, assignment};
// Two tasks, two agents, one task per agent. The penalty weight exceeds the sum of all costs.
let costs = [vec![4, 1], vec![2, 3]];
let encoding = assignment::encode(&costs, &[1, 1], 11)?;
let mut sampler = Exhaustive::new();
let run = sampler.sample(encoding.problem().qubo(), Unlimited)?;
let decoded = encoding.decode(run.sample.bits);
assert_eq!(decoded.agents, [Some(1), Some(0)]);
assert_eq!(decoded.cost, 3);
assert!(decoded.violations.is_empty());Repository: https://github.com/sunsided/planning-qubo
Modules§
- assignment
- The assignment problem: each task goes to one agent, and each agent has a capacity.
Structs§
- Annealing
Stats - The work counters of one
SimulatedAnnealingcall. - Builder
- Builds a QUBO model over named variables from objective terms and penalized constraints.
- Constraint
- A named constraint, kept next to the model so that decoders can check samples.
- Exhaustive
- Tries every assignment and returns one with the lowest energy.
- Exhaustive
Stats - The work counters of one
Exhaustivecall. - Inexact
Scale - The error when
Ising::to_qubocannot divide a coefficient by the scale exactly. - Invalid
Schedule - The error when a
Schedulehas aβthat is not finite and positive. - Ising
- A sparse Ising model over spins
sᵢ ∈ {−1, +1}. - Problem
- A QUBO model built by a
Builder, with its variable names and constraints. - Qubo
- A sparse quadratic unconstrained binary optimization (QUBO) model.
- Run
- The result of one
Sampler::sampleorSampler::resumecall. - Sample
- An assignment of a QUBO model’s variables and its energy, borrowed from a sampler.
- Schedule
- The annealing schedule: the number of sweeps and the range of the inverse temperature.
- Simulated
Annealing - Simulated annealing with single-bit Metropolis flips and a geometric schedule.
- Unlimited
- A budget that is never exhausted: the search runs until it finishes.
- Var
- A binary variable of a
BuilderorProblem: the index into the QUBO model.
Enums§
- Constraint
Kind - What a
Constraintrequires of the original variables. Slack variables are not part of it. - Sample
Error - The error when a sampler cannot handle a model or a call.
- Status
- How one call of a time-sliced search ended: it finished, or its
Budgetstopped it.
Traits§
- Budget
- Decides when a search must stop before it finishes, given its counters so far.
- Coefficient
- A coefficient type for QUBO and Ising models.
- Sampler
- A source of low-energy samples for a model, classical or quantum.