1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! # 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`](Sampler::resume) later.
//!
//! ## Pipeline
//!
//! ```mermaid
//! 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());
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! Repository: <https://github.com/sunsided/planning-qubo>
extern crate alloc;
pub use ;
pub use Coefficient;
pub use ;
pub use Qubo;
pub use ;
pub use ;
/// Doctests for the code examples in README.md (not part of the API).