Rust · constraint programming · local search

Qayd

A Unified Semantic Architecture for Heterogeneous Constraint Solving.

Qayd is a constraint-solving system written in Rust. Its semantic model connects finite-domain, routing, packing, assignment, and scheduling models to exact search, selected LCG and SAT paths, and local-search engines through one orchestration layer. The same model is available from Rust, Python, and standard input formats.

use qayd::model::{Constraint, Model, ModelPackage, Relation};
use qayd::orchestrator::{IgnoreEvents, SolveRequest};
let mut model = Model::new();
let x = model.int_range(0, 9);
model.add_constraint(Constraint::Linear {
    terms: vec![(1, x)],
    relation: Relation::Ge,
    rhs: 4,
});
let result = qayd::solve(
    &ModelPackage::new(model),
    &SolveRequest::default(),
    &mut IgnoreEvents,
).unwrap();
println!("{}", result.status().as_str()); // SATISFIABLE
System overview

Architecture

Qayd separates semantic modeling, solve planning, engine execution, and shared resource control.

Semantic model

Model and ModelPackage represent supported variables, constraints, objectives, names, and source metadata.

Model · ModelPackage

Solve request and planning

SolveRequest records the mode, seed, workers, limits, search policy, and optional controls. The orchestrator derives an executable solve plan.

request · plan · execute

Solving engines

Available backends include finite-domain propagation and branch-and-bound, selected LCG search paths, and beta SAT support. Some model families expose experimental local-search portfolios.

CP · LCG · SAT · LS

Shared execution control

A common budget and stop signal cover preparation, compilation, worker startup, search, and persistent session epochs.

budget · cancellation · sessions

Domain-specific APIs

Typed helpers cover routing, packing, assignment, and interval scheduling. List and set models remain experimental.

routes · sets · intervals

Frontends and datasets

Interfaces include Rust, Python, and XCSP3. FlatZinc, DIMACS, and OPB frontends are beta. Dataset readers include CVRPLIB, JSPLIB, and PSPLIB.

CVRPLIB · JSPLIB · PSPLIB
Reproduction

Build and run locally

These commands build the workspace, install the Python extension, and run a tracked example.

Rust workspace cargo build --workspace
Python extension uv run maturin develop --profile pyext
Example uv run examples/python/optimization/search_policy.py