moonbit_constraint

Finite-domain constraint programming library for MoonBit

constraint-programming
finite-domain
scheduling
optimization
moon add mjfmjf879/moonbit_constraint@0.1.0
Download zip
Author
Version
0.1.0
License
Apache-2.0
Last updated
7 hours ago
Downloads
2
README

#moonbit-constraint

面向组合配置、排班、资源分配与组合优化的纯 MoonBit 有限域约束求解库。

#项目定位

moonbit-constraint 提供有限整数域、可组合约束、确定性搜索、诊断统计和应用级建模组件,不依赖外部求解器运行时。

#核心能力

  • 区间域、离散值域、域运算和边界操作。
  • 等式/不等式、线性、AllDifferent、表约束、计数、极值、区间资源约束。
  • MRV 等变量启发式、解枚举、节点预算、增量假设、诊断统计和确定性基准。
  • 排班、序列配额、轮班、资源日程、日历任务、数独、N 皇后、图着色、背包、分配、覆盖和装箱模型。
  • 路由、项目依赖、容量网络、时间线、制造调度、离散事件、风险情景、质量门禁和运行台账。

#快速开始

///|
test {
let model = @moonbit_constraint.new_solver()
let left = model.add_variable(@moonbit_constraint.variable("left", 1, 9))
let right = model.add_variable(@moonbit_constraint.variable("right", 1, 9))
model.add_constraint(@moonbit_constraint.sum([left, right], 10))
match model.solve() {
Some(solution) => debug_inspect(solution.values, content="[1, 9]")
None => fail("the model should be satisfiable")
}
}

#CLI、架构与质量门禁

moon run cmd/main moon run --target native cmd/benchmark moon check --target all --deny-warn moon test --target all --deny-warn moon fmt moon info

求解流程为“有限域与模型 → 约束传播 → 启发式分支 → 完整赋值校验”;应用模块负责领域模型、结果渲染、校验报告和运行指标。基准原始结果见 BENCHMARKS.md,CI 工作流见 .github/workflows/test.yml

#许可证

本项目采用 Apache License 2.0

#
AllocationInstance

pub struct AllocationInstance {
items : Array[AllocationItem]
capacities : Array[Int]
group_limits : Array[(Int, Int, Int, Int)]
}

A validated collection of item and bin data.

#
AllocationInstance::add_group_limit

fn AllocationInstance::add_group_limit(self : AllocationInstance, bin : Int, group : Int, minimum : Int, maximum : Int) -> Bool

Add a lower and upper count for a group on one bin.

#
AllocationInstance::bin_count

fn AllocationInstance::bin_count(self : AllocationInstance) -> Int

Return the number of bins.

#
AllocationInstance::capacity

fn AllocationInstance::capacity(self : AllocationInstance, bin : Int) -> Int

Read a bin capacity.

#
AllocationInstance::item

Read an item.

#
AllocationInstance::item_count

fn AllocationInstance::item_count(self : AllocationInstance) -> Int

Return the number of items.

#
AllocationItem

pub struct AllocationItem {
id : Int
weight : Int
value : Int
group : Int
}

Capacity-aware allocation models for packing and resource assignment.

The model separates item data from a mutable candidate plan. This makes it suitable for greedy seed construction, neighborhood improvement, and validation before the assignment is handed to a finite-domain Solver.

#
AllocationItem::group

fn AllocationItem::group(self : AllocationItem) -> Int

Read the group identifier.

#
AllocationItem::id

fn AllocationItem::id(self : AllocationItem) -> Int

Read the item identifier.

#
AllocationItem::value

fn AllocationItem::value(self : AllocationItem) -> Int

Read the item value.

#
AllocationItem::weight

fn AllocationItem::weight(self : AllocationItem) -> Int

Read the item weight.

#
AllocationPlan

pub struct AllocationPlan {
assignments : Array[Int]
}

A partial or complete item-to-bin assignment.

#
AllocationPlan::assign

fn AllocationPlan::assign(self : AllocationPlan, item : Int, bin : Int) -> Bool

Assign an item to a bin without checking capacity.

#
AllocationPlan::assigned_bin

fn AllocationPlan::assigned_bin(self : AllocationPlan, item : Int) -> Int

Read the assigned bin, or -1 when unassigned.

#
AllocationPlan::assignments

fn AllocationPlan::assignments(self : AllocationPlan) -> Array[Int]

Return copied assignments.

#
AllocationPlan::csv

fn AllocationPlan::csv(self : AllocationPlan) -> String

Render assignments as comma-separated bin ids.

#
AllocationPlan::items_in_bin

fn AllocationPlan::items_in_bin(self : AllocationPlan, bin : Int) -> Array[Int]

Return items in a bin.

#
AllocationPlan::unassign

fn AllocationPlan::unassign(self : AllocationPlan, item : Int) -> Bool

Remove an assignment.

#
ArtifactBenchmark

pub struct ArtifactBenchmark {
name : String
work : Int
solved : Bool
signature : Int
}

Benchmark artifact aggregation and reproducibility checks.

The core benchmark command emits deterministic solver counters. This layer packages several runs into a suite, checks repeat consistency, and produces machine-readable evidence for local acceptance and CI summaries.

#
ArtifactBenchmark::describe

fn ArtifactBenchmark::describe(self : ArtifactBenchmark) -> String

Return a stable line.

#
ArtifactBenchmark::solved

fn ArtifactBenchmark::solved(self : ArtifactBenchmark) -> Bool

Return solved state.

#
ArtifactBenchmark::work

fn ArtifactBenchmark::work(self : ArtifactBenchmark) -> Int

Return artifact work.

#
AssignmentMetrics

pub struct AssignmentMetrics {
count : Int
categories : Int
minimum : Int
maximum : Int
spread : Int
transitions : Int
changes : Int
}

Analytics for categorical assignments and roster stability.

These functions operate on integer labels and are intentionally independent of a particular schedule representation. They can score worker rosters, machine labels, cluster assignments, or any finite categorical plan.

#
AssignmentMetrics::categories

fn AssignmentMetrics::categories(self : AssignmentMetrics) -> Int

Read category count.

#
AssignmentMetrics::changes

fn AssignmentMetrics::changes(self : AssignmentMetrics) -> Int

Read change count.

#
AssignmentMetrics::count

fn AssignmentMetrics::count(self : AssignmentMetrics) -> Int

Read assignment count.

#
AssignmentMetrics::describe

fn AssignmentMetrics::describe(self : AssignmentMetrics) -> String

Return a stable metric line.

#
AssignmentMetrics::transitions

fn AssignmentMetrics::transitions(self : AssignmentMetrics) -> Int

Read transition count.

#
AssignmentProblem

pub struct AssignmentProblem {
solver : Solver
workers : Int
jobs : Int
assignments : Array[Int]
costs : Array[Int]
total_cost : Int
}

A small assignment problem with one worker per job and a cost objective.

#
AssignmentProblem::assignments

fn AssignmentProblem::assignments(self : AssignmentProblem, solution : Solution) -> Array[Int]

Return all job-to-worker assignments.

#
AssignmentProblem::cost

fn AssignmentProblem::cost(self : AssignmentProblem, solution : Solution) -> Int

Return the total assignment cost.

#
AssignmentProblem::is_valid

fn AssignmentProblem::is_valid(self : AssignmentProblem, solution : Solution) -> Bool

Validate an assignment solution.

#
AssignmentProblem::render

fn AssignmentProblem::render(self : AssignmentProblem, solution : Solution) -> String

Return a compact assignment report.

#
AssignmentProblem::solve

Solve for minimum total assignment cost.

#
AssignmentProblem::stats

Return solver statistics.

#
AssignmentProblem::worker

fn AssignmentProblem::worker(self : AssignmentProblem, solution : Solution, job : Int) -> Int

Return assigned worker for a job.

#
Assumption

pub struct Assumption {
variable : Int
value : Int
} derive(Eq,
Debug
)

A value decision that can be applied to an existing model without rebuilding its constraints.

#
Assumption::describe

fn Assumption::describe(self : Assumption) -> String

Render a decision in a stable diagnostic form.

#
Assumption::value

fn Assumption::value(self : Assumption) -> Int

Return the value required by a decision.

#
Assumption::variable

fn Assumption::variable(self : Assumption) -> Int

Return the variable referenced by a decision.

#
AssumptionResult

pub struct AssumptionResult {
satisfiable : Bool
solution : Solution?
stats : SearchStats
assumptions : AssumptionSet
}

The result of a satisfiability probe under temporary decisions.

#
AssumptionResult::assumptions

Return the decisions used by the probe.

#
AssumptionResult::describe

fn AssumptionResult::describe(self : AssumptionResult) -> String

Render a compact probe result.

#
AssumptionResult::satisfiable

fn AssumptionResult::satisfiable(self : AssumptionResult) -> Bool

Whether the probe found a solution.

#
AssumptionResult::solution

fn AssumptionResult::solution(self : AssumptionResult) -> Solution?

Return the first solution found by the probe.

#
AssumptionResult::stats

Return search counters for the probe.

#
AssumptionSet

pub struct AssumptionSet {
items : Array[Assumption]
}

An ordered set of decisions used for incremental probes.

#
AssumptionSet::add

fn AssumptionSet::add(self : AssumptionSet, item : Assumption) -> Bool

Add a decision when its variable is not already present.

#
AssumptionSet::add_value

fn AssumptionSet::add_value(self : AssumptionSet, variable : Int, value : Int) -> Bool

Add a variable/value pair when its variable is not already present.

#
AssumptionSet::contains

fn AssumptionSet::contains(self : AssumptionSet, variable : Int, value : Int) -> Bool

Test whether the set contains a variable/value pair.

#
AssumptionSet::describe

fn AssumptionSet::describe(self : AssumptionSet) -> String

Render decisions in insertion order.

#
AssumptionSet::get

fn AssumptionSet::get(self : AssumptionSet, variable : Int) -> Assumption?

Find a decision for a variable.

#
AssumptionSet::is_empty

fn AssumptionSet::is_empty(self : AssumptionSet) -> Bool

Whether the set has no decisions.

#
AssumptionSet::length

fn AssumptionSet::length(self : AssumptionSet) -> Int

Number of decisions in the set.

#
AssumptionSet::values

Return a copy of the decisions.

#
BenchmarkArtifactSuite

pub struct BenchmarkArtifactSuite {
name : String
cases : Array[ArtifactBenchmark]
}

A benchmark suite.

#
BenchmarkArtifactSuite::add

Add a case with a unique name.

#
BenchmarkArtifactSuite::all_solved

fn BenchmarkArtifactSuite::all_solved(self : BenchmarkArtifactSuite) -> Bool

Return whether all cases are solved.

#
BenchmarkArtifactSuite::describe

fn BenchmarkArtifactSuite::describe(self : BenchmarkArtifactSuite) -> String

Return a stable suite report.

#
BenchmarkArtifactSuite::heaviest

Return the heaviest case.

#
BenchmarkArtifactSuite::length

Return case count.

#
BenchmarkArtifactSuite::markdown

fn BenchmarkArtifactSuite::markdown(self : BenchmarkArtifactSuite) -> String

Render a suite as markdown.

#
BenchmarkArtifactSuite::signature

fn BenchmarkArtifactSuite::signature(self : BenchmarkArtifactSuite) -> Int

Return a suite signature.

#
BenchmarkArtifactSuite::summary

Return a summary statistic.

#
BenchmarkArtifactSuite::total_work

fn BenchmarkArtifactSuite::total_work(self : BenchmarkArtifactSuite) -> Int

Return total work.

#
BenchmarkArtifactSuite::unique_signatures

fn BenchmarkArtifactSuite::unique_signatures(self : BenchmarkArtifactSuite) -> Bool

Return whether signatures are unique.

#
BenchmarkArtifactSuite::unsolved

Return unsolved case count.

#
BenchmarkArtifactSuite::work_values

fn BenchmarkArtifactSuite::work_values(self : BenchmarkArtifactSuite) -> Array[Int]

Return the work values in case order.

#
BenchmarkResult

pub struct BenchmarkResult {
name : String
solved : Bool
solutions : Int
nodes : Int
propagations : Int
checks : Int
pruned : Int
depth : Int
repeat_count : Int
}

A deterministic solver benchmark result.

#
BenchmarkResult::checks

fn BenchmarkResult::checks(self : BenchmarkResult) -> Int

Return constraint-check count.

#
BenchmarkResult::depth

fn BenchmarkResult::depth(self : BenchmarkResult) -> Int

Return maximum depth.

#
BenchmarkResult::describe

fn BenchmarkResult::describe(self : BenchmarkResult) -> String

Return a stable one-line benchmark record.

#
BenchmarkResult::name

fn BenchmarkResult::name(self : BenchmarkResult) -> String

Return the benchmark name.

#
BenchmarkResult::nodes

fn BenchmarkResult::nodes(self : BenchmarkResult) -> Int

Return visited node count.

#
BenchmarkResult::propagations

fn BenchmarkResult::propagations(self : BenchmarkResult) -> Int

Return propagation count.

#
BenchmarkResult::pruned

fn BenchmarkResult::pruned(self : BenchmarkResult) -> Int

Return pruned-value count.

#
BenchmarkResult::repeat_count

fn BenchmarkResult::repeat_count(self : BenchmarkResult) -> Int

Return number of repetitions.

#
BenchmarkResult::solutions

fn BenchmarkResult::solutions(self : BenchmarkResult) -> Int

Return the number of collected solutions.

#
BenchmarkResult::solved

fn BenchmarkResult::solved(self : BenchmarkResult) -> Bool

Return whether the case produced the expected satisfiability result.

#
BenchmarkResult::work

fn BenchmarkResult::work(self : BenchmarkResult) -> Int

Return the deterministic work score used when wall-clock noise is high.

#
BinPacking

pub struct BinPacking {
solver : Solver
assignments : Array[Array[Int]]
items : Int
bins : Int
weights : Array[Int]
capacity : Int
}

A bin-packing assignment model using one-hot item/bin variables.

#
BinPacking::bin_of

fn BinPacking::bin_of(self : BinPacking, solution : Solution, item : Int) -> Int?

Return the selected bin for an item.

#
BinPacking::is_valid

fn BinPacking::is_valid(self : BinPacking, solution : Solution) -> Bool

Validate a packing solution.

#
BinPacking::loads

fn BinPacking::loads(self : BinPacking, solution : Solution) -> Array[Int]

Return the bin load vector.

#
BinPacking::render

fn BinPacking::render(self : BinPacking, solution : Solution) -> String

Render bin loads and item assignments.

#
BinPacking::solve

fn BinPacking::solve(self : BinPacking) -> Solution?

Solve the packing model.

#
BinPacking::stats

fn BinPacking::stats(self : BinPacking) -> SearchStats

Return solver statistics.

#
BooleanCircuit

pub struct BooleanCircuit {
solver : Solver
outputs : Array[Int]
}

A small Boolean circuit builder that exposes intermediate variables.

#
BooleanCircuit::and_gate

fn BooleanCircuit::and_gate(self : BooleanCircuit, left : Int, right : Int) -> Int

Add an AND gate and return its result variable.

#
BooleanCircuit::constant

fn BooleanCircuit::constant(self : BooleanCircuit, name : String, value : Int) -> Int

Add a constant Boolean variable.

#
BooleanCircuit::input

fn BooleanCircuit::input(self : BooleanCircuit, name : String) -> Int

Add a named input to a circuit.

#
BooleanCircuit::not_gate

fn BooleanCircuit::not_gate(self : BooleanCircuit, input : Int) -> Int

Add a NOT gate.

#
BooleanCircuit::or_gate

fn BooleanCircuit::or_gate(self : BooleanCircuit, left : Int, right : Int) -> Int

Add an OR gate.

#
BooleanCircuit::output_values

fn BooleanCircuit::output_values(self : BooleanCircuit, solution : Solution) -> Array[Int]

Return output values from a solution.

#
BooleanCircuit::outputs

fn BooleanCircuit::outputs(self : BooleanCircuit) -> Array[Int]

Return circuit output identifiers.

#
BooleanCircuit::solve

fn BooleanCircuit::solve(self : BooleanCircuit) -> Solution?

Solve the circuit.

#
BooleanCircuit::solve_all

fn BooleanCircuit::solve_all(self : BooleanCircuit, limit : Int) -> Array[Solution]

Enumerate circuit assignments.

#
BooleanCircuit::solver

fn BooleanCircuit::solver(self : BooleanCircuit) -> Solver

Return the circuit solver.

#
BooleanCircuit::xor_gate

fn BooleanCircuit::xor_gate(self : BooleanCircuit, left : Int, right : Int) -> Int

Add an XOR gate.

#
CalendarModel

pub struct CalendarModel {
solver : Solver
tasks : Array[CalendarTask]
horizon : Int
resources : Int
}

A mutable interval calendar model.

#
CalendarModel::add_task

fn CalendarModel::add_task(self : CalendarModel, name : String, duration : Int, resource : Int) -> Int?

Add an interval task and return its task id.

#
CalendarModel::all_tasks_fit

fn CalendarModel::all_tasks_fit(self : CalendarModel) -> Bool

Check that every task metadata record fits the configured horizon.

#
CalendarModel::configure

fn CalendarModel::configure(self : CalendarModel, config : SearchConfig) -> Unit

Configure search.

#
CalendarModel::earliest_start

fn CalendarModel::earliest_start(self : CalendarModel, solution : Solution) -> Int

Return the earliest start time in a solution.

#
CalendarModel::end_domains

fn CalendarModel::end_domains(self : CalendarModel) -> Array[Domain]

Return the current end domains for every task.

#
CalendarModel::end_of

fn CalendarModel::end_of(self : CalendarModel, solution : Solution, task_id : Int) -> Int

Read a task's end in a solution.

#
CalendarModel::fingerprint

fn CalendarModel::fingerprint(self : CalendarModel, solution : Solution) -> String

Return a stable schedule fingerprint.

#
CalendarModel::fix_start

fn CalendarModel::fix_start(self : CalendarModel, task_id : Int, start : Int) -> Bool

Fix a task at one start time.

#
CalendarModel::horizon

fn CalendarModel::horizon(self : CalendarModel) -> Int

Return the planning horizon.

#
CalendarModel::idle_time

fn CalendarModel::idle_time(self : CalendarModel, solution : Solution) -> Int

Return idle horizon time after accounting for total task duration.

#
CalendarModel::intervals

fn CalendarModel::intervals(self : CalendarModel, solution : Solution) -> Array[(String, Int, Int, Int)]

Return task intervals for a solution.

#
CalendarModel::is_valid

fn CalendarModel::is_valid(self : CalendarModel, solution : Solution) -> Bool

Validate a complete calendar solution.

#
CalendarModel::latest_end

fn CalendarModel::latest_end(self : CalendarModel, solution : Solution) -> Int

Return the latest end time in a solution.

#
CalendarModel::makespan

fn CalendarModel::makespan(self : CalendarModel, solution : Solution) -> Int

Return the latest end time in a solution.

#
CalendarModel::post_all_resources_non_overlap

fn CalendarModel::post_all_resources_non_overlap(self : CalendarModel) -> Unit

Require every resource to execute non-overlapping tasks.

#
CalendarModel::post_allowed_starts

fn CalendarModel::post_allowed_starts(self : CalendarModel, task_id : Int, starts : Array[Int]) -> Unit

Restrict all task starts to one of a finite set of slots.

#
CalendarModel::post_deadline

fn CalendarModel::post_deadline(self : CalendarModel, task_id : Int, deadline : Int) -> Unit

Require a task to finish no later than a deadline.

#
CalendarModel::post_precedence

fn CalendarModel::post_precedence(self : CalendarModel, first : Int, second : Int, gap : Int) -> Unit

Require the second task to begin after the first task ends.

#
CalendarModel::post_resource_capacity

fn CalendarModel::post_resource_capacity(self : CalendarModel, resource : Int, capacity : Int) -> Unit

Limit simultaneous demand on one resource group.

#
CalendarModel::post_resource_non_overlap

fn CalendarModel::post_resource_non_overlap(self : CalendarModel, resource : Int) -> Unit

Require tasks on one resource not to overlap.

#
CalendarModel::post_start_window

fn CalendarModel::post_start_window(self : CalendarModel, task_id : Int, lower : Int, upper : Int) -> Unit

Restrict a task to a start-time window.

#
CalendarModel::render

fn CalendarModel::render(self : CalendarModel, solution : Solution) -> String

Render tasks by start time and resource id.

#
CalendarModel::resource_count

fn CalendarModel::resource_count(self : CalendarModel) -> Int

Return the resource count.

#
CalendarModel::resource_load

fn CalendarModel::resource_load(self : CalendarModel, resource : Int) -> Int

Sum task durations assigned to one resource.

#
CalendarModel::resource_task_count

fn CalendarModel::resource_task_count(self : CalendarModel, resource : Int) -> Int

Return the number of tasks assigned to a resource.

#
CalendarModel::solve

fn CalendarModel::solve(self : CalendarModel) -> Solution?

Solve the calendar.

#
CalendarModel::solve_all

fn CalendarModel::solve_all(self : CalendarModel, limit : Int) -> Array[Solution]

Enumerate calendar solutions.

#
CalendarModel::start_domains

fn CalendarModel::start_domains(self : CalendarModel) -> Array[Domain]

Return the current start domains for every task.

#
CalendarModel::start_of

fn CalendarModel::start_of(self : CalendarModel, solution : Solution, task_id : Int) -> Int

Read a task's start in a solution.

#
CalendarModel::stats

Return the latest statistics.

#
CalendarModel::summary

fn CalendarModel::summary(self : CalendarModel, solution : Solution) -> CalendarSummary

Compute utilization counters from a solution.

#
CalendarModel::task

fn CalendarModel::task(self : CalendarModel, task_id : Int) -> CalendarTask

Return a task or abort on an invalid id.

#
CalendarModel::task_count

fn CalendarModel::task_count(self : CalendarModel) -> Int

Return the number of tasks.

#
CalendarModel::task_ids_for_resource

fn CalendarModel::task_ids_for_resource(self : CalendarModel, resource : Int) -> Array[Int]

Return ids assigned to one resource.

#
CalendarModel::task_names

fn CalendarModel::task_names(self : CalendarModel) -> Array[String]

Return task names in insertion order.

#
CalendarModel::tasks

Return all task metadata.

#
CalendarModel::total_duration

fn CalendarModel::total_duration(self : CalendarModel) -> Int

Return total duration across all tasks.

#
CalendarSummary

pub struct CalendarSummary {
tasks : Int
makespan : Int
occupied : Int
resource_load : Array[Int]
}

A summary of calendar utilization.

#
CalendarSummary::describe

fn CalendarSummary::describe(self : CalendarSummary) -> String

Render utilization counters.

#
CalendarSummary::makespan

fn CalendarSummary::makespan(self : CalendarSummary) -> Int

Return the schedule makespan.

#
CalendarSummary::occupied

fn CalendarSummary::occupied(self : CalendarSummary) -> Int

Return total occupied time.

#
CalendarSummary::resource_load

fn CalendarSummary::resource_load(self : CalendarSummary) -> Array[Int]

Return per-resource occupied time.

#
CalendarSummary::tasks

fn CalendarSummary::tasks(self : CalendarSummary) -> Int

Return the scheduled task count.

#
CalendarTask

pub struct CalendarTask {
name : String
start : Int
end : Int
duration : Int
resource : Int
}

A calendar template for interval tasks with explicit end variables. It provides a compact bridge between domain constraints and resource planning applications.

#
CalendarTask::describe

fn CalendarTask::describe(self : CalendarTask) -> String

Render task metadata without a solution.

#
CalendarTask::duration

fn CalendarTask::duration(self : CalendarTask) -> Int

Return a task's duration.

#
CalendarTask::end

fn CalendarTask::end(self : CalendarTask) -> Int

Return a task's end variable.

#
CalendarTask::fits

fn CalendarTask::fits(self : CalendarTask, horizon : Int) -> Bool

Return whether a task can fit in a horizon.

#
CalendarTask::name

fn CalendarTask::name(self : CalendarTask) -> String

Return a task's name.

#
CalendarTask::resource

fn CalendarTask::resource(self : CalendarTask) -> Int

Return a task's resource.

#
CalendarTask::start

fn CalendarTask::start(self : CalendarTask) -> Int

Return a task's start variable.

#
CalendarWindow

pub struct CalendarWindow {
start : Int
end : Int
}

Calendar window metrics for service and scheduling reports.

#
CalendarWindow::contains

fn CalendarWindow::contains(self : CalendarWindow, time : Int) -> Bool

#
CalendarWindow::describe

fn CalendarWindow::describe(self : CalendarWindow) -> String

#
CalendarWindow::duration

fn CalendarWindow::duration(self : CalendarWindow) -> Int

#
CalendarWindow::expand

fn CalendarWindow::expand(self : CalendarWindow, amount : Int) -> CalendarWindow

#
CalendarWindow::intersection

fn CalendarWindow::intersection(self : CalendarWindow, other : CalendarWindow) -> CalendarWindow?

#
CalendarWindow::overlaps

fn CalendarWindow::overlaps(self : CalendarWindow, other : CalendarWindow) -> Bool

#
CalendarWindow::shift

fn CalendarWindow::shift(self : CalendarWindow, offset : Int) -> CalendarWindow

#
CalendarWindow::touches

fn CalendarWindow::touches(self : CalendarWindow, other : CalendarWindow) -> Bool

#
CalendarWindow::valid

fn CalendarWindow::valid(self : CalendarWindow) -> Bool

#
CapacityArc

pub struct CapacityArc {
from : Int
to : Int
capacity : Int
cost : Int
}

Capacity-network models for assignment and transport pipelines.

This layer complements the dense graph algorithms with an explicit network object that tracks capacities, supplies, and a computed flow assignment.

#
CapacityNetwork

pub struct CapacityNetwork {
vertices : Int
arcs : Array[CapacityArc]
}

A capacity network.

#
CapacityNetwork::add_arc

fn CapacityNetwork::add_arc(self : CapacityNetwork, from : Int, to : Int, capacity : Int, cost : Int) -> Bool

Add a directed capacity arc.

#
CapacityNetwork::arc_count

fn CapacityNetwork::arc_count(self : CapacityNetwork) -> Int

Return arc count.

#
CapacityNetwork::arcs

Return copied arcs.

#
CapacityNetwork::capacity_matrix

fn CapacityNetwork::capacity_matrix(self : CapacityNetwork) -> IntMatrix

Return an integer capacity matrix.

#
CapacityNetwork::cut_capacity

fn CapacityNetwork::cut_capacity(self : CapacityNetwork, reachable : Array[Int]) -> Int

Return a min-cut capacity from a reachable partition.

#
CapacityNetwork::flow_cost

fn CapacityNetwork::flow_cost(self : CapacityNetwork, flow : IntMatrix) -> Int

Return the total cost of a flow matrix.

#
CapacityNetwork::max_flow

fn CapacityNetwork::max_flow(self : CapacityNetwork, source : Int, sink : Int) -> (Int, IntMatrix)

Compute a maximum flow value and flow matrix.

#
CapacityNetwork::outgoing

fn CapacityNetwork::outgoing(self : CapacityNetwork, vertex : Int) -> Array[CapacityArc]

Return outgoing arcs.

#
CapacityNetwork::signature

fn CapacityNetwork::signature(self : CapacityNetwork) -> Int

Return a deterministic network fingerprint.

#
CapacityNetwork::validate_flow

fn CapacityNetwork::validate_flow(self : CapacityNetwork, flow : IntMatrix) -> Array[String]

Validate a flow matrix against arc capacities.

#
CapacityNetwork::vertex_count

fn CapacityNetwork::vertex_count(self : CapacityNetwork) -> Int

Return vertex count.

#
ConflictReport

pub struct ConflictReport {
satisfiable : Bool
core : AssumptionSet
probes : Int
original_size : Int
}

A deletion-based conflict report for a set of temporary decisions.

#
ConflictReport::core

Return the irreducible-by-deletion conflict subset.

#
ConflictReport::describe

fn ConflictReport::describe(self : ConflictReport) -> String

Render the report for logs or a diagnostics page.

#
ConflictReport::original_size

fn ConflictReport::original_size(self : ConflictReport) -> Int

Return the number of decisions initially examined.

#
ConflictReport::probes

fn ConflictReport::probes(self : ConflictReport) -> Int

Return the number of solver probes used to derive the report.

#
ConflictReport::satisfiable

fn ConflictReport::satisfiable(self : ConflictReport) -> Bool

Whether the complete decision set is satisfiable.

#
Constraint

pub enum Constraint {
Equal(Int, Int)
NotEqual(Int, Int)
LessThan(Int, Int)
LessEqual(Int, Int)
GreaterThan(Int, Int)
GreaterEqual(Int, Int)
AllDifferent(Array[Int])
Sum(Array[Int], Int)
Element(Int, Array[Int], Int)
Linear(Array[(Int, Int)], Int)
LinearLessEqual(Array[(Int, Int)], Int)
LinearGreaterEqual(Array[(Int, Int)], Int)
Between(Int, Int, Int)
Member(Int, Array[Int])
CountValue(Array[Int], Int, Int)
AtMostValue(Array[Int], Int, Int)
AtLeastValue(Array[Int], Int, Int)
Minimum(Array[Int], Int)
Maximum(Array[Int], Int)
Absolute(Int, Int)
Distance(Int, Int, Int)
NotDistance(Int, Int, Int)
Table(Array[Int], Array[Array[Int]])
NoOverlap(Array[(Int, Int)])
Cumulative(Array[(Int, Int, Int)], Int)
} derive(
Debug
)

Constraints supported by the first solver engine.

#
ConstraintBuilder

pub struct ConstraintBuilder {
solver : Solver
variables : Array[Int]
}

Higher-level constraint model builders.

The builder layer packages recurring finite-domain patterns—grids, cardinality rules, automaton-like transitions, and resource windows—into small APIs that remain inspectable through the underlying Solver.

#
ConstraintBuilder::add_bool

fn ConstraintBuilder::add_bool(self : ConstraintBuilder, name : String) -> Int

Add a Boolean variable.

#
ConstraintBuilder::add_int

fn ConstraintBuilder::add_int(self : ConstraintBuilder, name : String, lower : Int, upper : Int) -> Int

Add a bounded integer variable.

#
ConstraintBuilder::adjacent_different

fn ConstraintBuilder::adjacent_different(self : ConstraintBuilder, variables : Array[Int]) -> Bool

Add adjacent inequality constraints.

#
ConstraintBuilder::all_different

fn ConstraintBuilder::all_different(self : ConstraintBuilder, variables : Array[Int]) -> Bool

Add all-different constraints for a variable list.

#
ConstraintBuilder::at_least_count

fn ConstraintBuilder::at_least_count(self : ConstraintBuilder, variables : Array[Int], value : Int, count : Int) -> Bool

Add a lower count.

#
ConstraintBuilder::at_most_count

fn ConstraintBuilder::at_most_count(self : ConstraintBuilder, variables : Array[Int], value : Int, count : Int) -> Bool

Add an upper count.

#
ConstraintBuilder::cumulative

fn ConstraintBuilder::cumulative(self : ConstraintBuilder, starts : Array[Int], durations : Array[Int], heights : Array[Int], capacity : Int) -> Bool

Add a cumulative capacity constraint.

#
ConstraintBuilder::describe

fn ConstraintBuilder::describe(self : ConstraintBuilder) -> String

Return a builder summary.

#
ConstraintBuilder::exact_count

fn ConstraintBuilder::exact_count(self : ConstraintBuilder, variables : Array[Int], value : Int, count : Int) -> Bool

Add an exact count of a value.

#
ConstraintBuilder::exact_sum

fn ConstraintBuilder::exact_sum(self : ConstraintBuilder, variables : Array[Int], target : Int) -> Bool

Add a fixed target sum.

#
ConstraintBuilder::fix

fn ConstraintBuilder::fix(self : ConstraintBuilder, variable_id : Int, value : Int) -> Bool

Fix a variable.

#
ConstraintBuilder::grid

fn ConstraintBuilder::grid(self : ConstraintBuilder, name : String, rows : Int, columns : Int, lower : Int, upper : Int) -> Array[Int]

Add a row-major integer grid with one variable per cell.

#
ConstraintBuilder::grid_columns

fn ConstraintBuilder::grid_columns(self : ConstraintBuilder, grid : Array[Int], rows : Int, columns : Int) -> Bool

Add all-different rules to each grid column.

#
ConstraintBuilder::grid_rows

fn ConstraintBuilder::grid_rows(self : ConstraintBuilder, grid : Array[Int], rows : Int, columns : Int) -> Bool

Add all-different rules to each grid row.

#
ConstraintBuilder::minimum_distance

fn ConstraintBuilder::minimum_distance(self : ConstraintBuilder, variables : Array[Int], distance : Int) -> Bool

Add pairwise separation by a minimum absolute distance.

#
ConstraintBuilder::no_overlap

fn ConstraintBuilder::no_overlap(self : ConstraintBuilder, starts : Array[Int], durations : Array[Int]) -> Bool

Add interval no-overlap constraints.

#
ConstraintBuilder::nondecreasing_chain

fn ConstraintBuilder::nondecreasing_chain(self : ConstraintBuilder, variables : Array[Int]) -> Bool

Add a nondecreasing chain.

#
ConstraintBuilder::signature

fn ConstraintBuilder::signature(self : ConstraintBuilder) -> Int

Return a model fingerprint.

#
ConstraintBuilder::solve

Solve once.

#
ConstraintBuilder::solve_all

fn ConstraintBuilder::solve_all(self : ConstraintBuilder, limit : Int) -> Array[Solution]

Enumerate a bounded number of solutions.

#
ConstraintBuilder::solver

Return the underlying solver.

#
ConstraintBuilder::strict_chain

fn ConstraintBuilder::strict_chain(self : ConstraintBuilder, variables : Array[Int]) -> Bool

Add a chain of strict ordering constraints.

#
ConstraintBuilder::transition_table

fn ConstraintBuilder::transition_table(self : ConstraintBuilder, variables : Array[Int], transitions : Array[Array[Int]]) -> Bool

Add a transition table to adjacent state variables.

#
ConstraintBuilder::variables

fn ConstraintBuilder::variables(self : ConstraintBuilder) -> Array[Int]

Return all variable ids.

#
ConstraintBuilder::weighted_at_least

fn ConstraintBuilder::weighted_at_least(self : ConstraintBuilder, terms : Array[(Int, Int)], target : Int) -> Bool

Add a weighted lower bound.

#
ConstraintBuilder::weighted_at_most

fn ConstraintBuilder::weighted_at_most(self : ConstraintBuilder, terms : Array[(Int, Int)], target : Int) -> Bool

Add a weighted sum bound.

#
ConstraintInfo

pub struct ConstraintInfo {
kind : ConstraintKind
arity : Int
variables : Array[Int]
label : String
}

Counted information about one constraint for diagnostics.

#
ConstraintInfo::arity

fn ConstraintInfo::arity(self : ConstraintInfo) -> Int

Read a diagnostic record's arity.

#
ConstraintInfo::describe

fn ConstraintInfo::describe(self : ConstraintInfo) -> String

Render a constraint diagnostic in one line.

#
ConstraintInfo::kind

Read a diagnostic record's kind.

#
ConstraintInfo::label

fn ConstraintInfo::label(self : ConstraintInfo) -> String

Read a diagnostic record's label.

#
ConstraintInfo::variables

fn ConstraintInfo::variables(self : ConstraintInfo) -> Array[Int]

Read a diagnostic record's variables.

#
ConstraintKind

pub enum ConstraintKind {
BinaryConstraint
GlobalConstraint
ArithmeticConstraint
ExtensionalConstraint
SchedulingConstraint
} derive(Eq,
Debug
)

Classification of the supported constraint families.

#
ConstraintRecipe

pub struct ConstraintRecipe {
builder : ConstraintBuilder
result : RecipeResult
}

A reusable recipe object.

#
ConstraintRecipe::builder

#
ConstraintRecipe::describe

fn ConstraintRecipe::describe(self : ConstraintRecipe) -> String

Return a recipe model summary.

#
ConstraintRecipe::post_adjacent_change

fn ConstraintRecipe::post_adjacent_change(self : ConstraintRecipe, variables : Array[Int]) -> Bool

#
ConstraintRecipe::post_all_different

fn ConstraintRecipe::post_all_different(self : ConstraintRecipe, variables : Array[Int]) -> Bool

Post a row of all-different variables.

#
ConstraintRecipe::post_at_least

fn ConstraintRecipe::post_at_least(self : ConstraintRecipe, variables : Array[Int], value : Int, count : Int) -> Bool

#
ConstraintRecipe::post_at_most

fn ConstraintRecipe::post_at_most(self : ConstraintRecipe, variables : Array[Int], value : Int, count : Int) -> Bool

#
ConstraintRecipe::post_chain

fn ConstraintRecipe::post_chain(self : ConstraintRecipe, variables : Array[Int]) -> Bool

#
ConstraintRecipe::post_cumulative

fn ConstraintRecipe::post_cumulative(self : ConstraintRecipe, starts : Array[Int], durations : Array[Int], heights : Array[Int], capacity : Int) -> Bool

#
ConstraintRecipe::post_exact_count

fn ConstraintRecipe::post_exact_count(self : ConstraintRecipe, variables : Array[Int], value : Int, count : Int) -> Bool

#
ConstraintRecipe::post_exact_sum

fn ConstraintRecipe::post_exact_sum(self : ConstraintRecipe, variables : Array[Int], target : Int) -> Bool

#
ConstraintRecipe::post_fix

fn ConstraintRecipe::post_fix(self : ConstraintRecipe, variable_id : Int, value : Int) -> Bool

Post a fixed assignment.

#
ConstraintRecipe::post_grid_rules

fn ConstraintRecipe::post_grid_rules(self : ConstraintRecipe, grid : Array[Int], rows : Int, columns : Int) -> Bool

Post a grid's row and column rules.

#
ConstraintRecipe::post_lower

fn ConstraintRecipe::post_lower(self : ConstraintRecipe, terms : Array[(Int, Int)], target : Int) -> Bool

#
ConstraintRecipe::post_minimum_distance

fn ConstraintRecipe::post_minimum_distance(self : ConstraintRecipe, variables : Array[Int], distance : Int) -> Bool

#
ConstraintRecipe::post_no_overlap

fn ConstraintRecipe::post_no_overlap(self : ConstraintRecipe, starts : Array[Int], durations : Array[Int]) -> Bool

#
ConstraintRecipe::post_non_decreasing

fn ConstraintRecipe::post_non_decreasing(self : ConstraintRecipe, variables : Array[Int]) -> Bool

#
ConstraintRecipe::post_transition

fn ConstraintRecipe::post_transition(self : ConstraintRecipe, variables : Array[Int], transitions : Array[Array[Int]]) -> Bool

#
ConstraintRecipe::post_upper

fn ConstraintRecipe::post_upper(self : ConstraintRecipe, terms : Array[(Int, Int)], target : Int) -> Bool

Post bounded weighted rules.

#
ConstraintRecipe::recipe_binary_vector

fn ConstraintRecipe::recipe_binary_vector(self : ConstraintRecipe, variables : Array[Int]) -> Bool

Build a binary selection vector.

#
ConstraintRecipe::recipe_one_hot

fn ConstraintRecipe::recipe_one_hot(self : ConstraintRecipe, variables : Array[Int]) -> Bool

#
ConstraintRecipe::result

#
ConstraintRecipe::signature

fn ConstraintRecipe::signature(self : ConstraintRecipe) -> Int

#
ConstraintRecipe::solve

Solve a recipe.

#
ConstraintRecipe::solve_all

fn ConstraintRecipe::solve_all(self : ConstraintRecipe, limit : Int) -> Array[Solution]

#
ConstraintRecipe::valid

fn ConstraintRecipe::valid(self : ConstraintRecipe) -> Bool

Return whether all posted recipes succeeded.

#
ConstraintSet

pub struct ConstraintSet {
constraints : Array[Constraint]
}

A reusable batch of constraints that can be assembled before posting.

#
ConstraintSet::add

fn ConstraintSet::add(self : ConstraintSet, constraint : Constraint) -> ConstraintSet

Append one constraint.

#
ConstraintSet::append

Append every constraint from another set.

#
ConstraintSet::constraints

fn ConstraintSet::constraints(self : ConstraintSet) -> Array[Constraint]

Return a defensive copy.

#
ConstraintSet::labels

fn ConstraintSet::labels(self : ConstraintSet) -> Array[String]

Render labels for a constraint batch.

#
ConstraintSet::length

fn ConstraintSet::length(self : ConstraintSet) -> Int

Number of constraints in the set.

#
ConstraintSet::post

fn ConstraintSet::post(self : ConstraintSet, solver : Solver) -> Int

Post every constraint and return the posted count.

#
ConstraintSet::report

Summarize a constraint set before posting.

#
ConstraintSetReport

pub struct ConstraintSetReport {
count : Int
labels : Array[String]
fingerprint : String
}

A small report about a posted constraint batch.

#
ConstraintSetReport::count

fn ConstraintSetReport::count(self : ConstraintSetReport) -> Int

Return the report's count.

#
ConstraintSetReport::describe

fn ConstraintSetReport::describe(self : ConstraintSetReport) -> String

Render a batch report.

#
ConstraintSetReport::fingerprint

fn ConstraintSetReport::fingerprint(self : ConstraintSetReport) -> String

Return a report fingerprint.

#
ConstraintSetReport::labels

fn ConstraintSetReport::labels(self : ConstraintSetReport) -> Array[String]

Return report labels.

#
DecisionStep

pub struct DecisionStep {
variable : Int
value : Int
accepted : Bool
depth : Int
}

One assignment step recorded by an incremental solving client.

#
DecisionStep::accepted

fn DecisionStep::accepted(self : DecisionStep) -> Bool

Whether this decision remained consistent.

#
DecisionStep::depth

fn DecisionStep::depth(self : DecisionStep) -> Int

Read the search depth of a decision.

#
DecisionStep::describe

fn DecisionStep::describe(self : DecisionStep) -> String

Render a decision record.

#
DecisionStep::value

fn DecisionStep::value(self : DecisionStep) -> Int

Read the value in a decision record.

#
DecisionStep::variable

fn DecisionStep::variable(self : DecisionStep) -> Int

Read the variable in a decision record.

#
DecisionTrace

pub struct DecisionTrace {
steps : Array[DecisionStep]
}

A reusable trace assembled by a model-building client.

#
DecisionTrace::accepted_count

fn DecisionTrace::accepted_count(self : DecisionTrace) -> Int

Count accepted steps.

#
DecisionTrace::describe

fn DecisionTrace::describe(self : DecisionTrace) -> String

Render a multiline trace.

#
DecisionTrace::length

fn DecisionTrace::length(self : DecisionTrace) -> Int

Return the number of recorded steps.

#
DecisionTrace::maximum_depth

fn DecisionTrace::maximum_depth(self : DecisionTrace) -> Int

Return the deepest recorded decision.

#
DecisionTrace::record

fn DecisionTrace::record(self : DecisionTrace, step : DecisionStep) -> Unit

Append a step to a trace.

#
DecisionTrace::rejected_count

fn DecisionTrace::rejected_count(self : DecisionTrace) -> Int

Count rejected steps.

#
DecisionTrace::steps

Return a copy of the trace steps.

#
Domain

pub struct Domain {
lower : Int
upper : Int
removed : Array[Int]
} derive(
Debug
)

A finite integer domain represented by an inclusive interval and holes.

#
Domain::assign

fn Domain::assign(self : Domain, value : Int) -> Bool

Narrow the domain to one value.

#
Domain::assign_largest

fn Domain::assign_largest(self : Domain) -> Bool

Return a domain after assigning the last available value.

#
Domain::assign_smallest

fn Domain::assign_smallest(self : Domain) -> Bool

Return a domain after assigning the first available value.

#
Domain::choose_largest

fn Domain::choose_largest(self : Domain) -> Int?

Return the largest available value without allocating the full list.

#
Domain::choose_smallest

fn Domain::choose_smallest(self : Domain) -> Int?

Return the smallest available value without allocating the full list.

#
Domain::clone

fn Domain::clone(self : Domain) -> Domain

Make an independent copy of a domain.

#
Domain::compact

fn Domain::compact(self : Domain) -> String

Render a domain as a compact union of intervals.

#
Domain::contains

fn Domain::contains(self : Domain, value : Int) -> Bool

Test whether value is still available.

#
Domain::contains_all

fn Domain::contains_all(self : Domain, other : Domain) -> Bool

Return whether every value in other also occurs in self.

#
Domain::count_range

fn Domain::count_range(self : Domain, lower : Int, upper : Int) -> Int

Number of values in the inclusive range that remain available.

#
Domain::describe

fn Domain::describe(self : Domain) -> String

Return a stable textual form useful in diagnostics and benchmark output.

#
Domain::domain_scale

fn Domain::domain_scale(self : Domain, coefficient : Int) -> Domain

Multiply every value by a non-zero coefficient.

#
Domain::domain_shift

fn Domain::domain_shift(self : Domain, offset : Int) -> Domain

Translate every value by a constant.

#
Domain::intersect_range

fn Domain::intersect_range(self : Domain, lower : Int, upper : Int) -> Bool

Keep only values in the inclusive range.

#
Domain::intersect_values

fn Domain::intersect_values(self : Domain, allowed : Array[Int]) -> Bool

Keep only values that also occur in allowed.

#
Domain::interval_lower

fn Domain::interval_lower(self : Domain) -> Int

Return the fixed lower endpoint of the original interval.

#
Domain::interval_upper

fn Domain::interval_upper(self : Domain) -> Int

Return the fixed upper endpoint of the original interval.

#
Domain::intervals

fn Domain::intervals(self : Domain) -> Array[DomainInterval]

Return maximal contiguous segments of the remaining domain.

#
Domain::is_contiguous

fn Domain::is_contiguous(self : Domain) -> Bool

Whether every value in the enclosing interval is still available.

#
Domain::is_empty

fn Domain::is_empty(self : Domain) -> Bool

Whether no value remains in the domain.

#
Domain::is_singleton

fn Domain::is_singleton(self : Domain) -> Bool

Check whether the domain has exactly one value.

#
Domain::max

fn Domain::max(self : Domain) -> Int?

Return the largest value in the domain, or None when it is empty.

#
Domain::min

fn Domain::min(self : Domain) -> Int?

Return the smallest value in the domain, or None when it is empty.

#
Domain::next

fn Domain::next(self : Domain, value : Int) -> Int?

Return the first available value at or above value.

#
Domain::nth

fn Domain::nth(self : Domain, rank : Int) -> Int?

Return the value at a zero-based rank.

#
Domain::previous

fn Domain::previous(self : Domain, value : Int) -> Int?

Return the last available value at or below value.

#
Domain::profile

fn Domain::profile(self : Domain) -> DomainProfile

Build a domain profile without exposing implementation fields.

#
Domain::rank

fn Domain::rank(self : Domain, value : Int) -> Int?

Return the zero-based rank of a value, if present.

#
Domain::remove

fn Domain::remove(self : Domain, value : Int) -> Bool

Remove one value. Returns whether the domain changed.

#
Domain::remove_above

fn Domain::remove_above(self : Domain, upper : Int) -> Bool

Remove every value above upper and report whether the domain changed.

#
Domain::remove_below

fn Domain::remove_below(self : Domain, lower : Int) -> Bool

Remove every value below lower and report whether the domain changed.

#
Domain::remove_many

fn Domain::remove_many(self : Domain, values : Array[Int]) -> Int

Return a domain after removing a sorted list of values.

#
Domain::removed_count

fn Domain::removed_count(self : Domain) -> Int

Return the number of removed values in the enclosing interval.

#
Domain::restore

fn Domain::restore(self : Domain, snapshot : Domain) -> Unit

Restore the removed-value state from another domain with the same interval. This is used by incremental solver probes to make temporary assumptions fully reversible after propagation and search.

#
Domain::singleton

fn Domain::singleton(self : Domain) -> Int?

Return the only value when this domain is a singleton.

#
Domain::size

fn Domain::size(self : Domain) -> Int

Number of values still available.

#
Domain::sum_values

fn Domain::sum_values(self : Domain) -> Int

Sum all available values using an overflow-conscious accumulator.

#
Domain::values

fn Domain::values(self : Domain) -> Array[Int]

Return all available values in ascending order.

#
DomainCatalog

pub struct DomainCatalog {
entries : Array[DomainEntry]
}

A named domain catalog.

#
DomainCatalog::add

fn DomainCatalog::add(self : DomainCatalog, name : String, value_domain : Domain, tag : String) -> Int?

Add a unique entry.

#
DomainCatalog::available_values

fn DomainCatalog::available_values(self : DomainCatalog) -> Int

Return the number of available values.

#
DomainCatalog::cartesian_size

fn DomainCatalog::cartesian_size(self : DomainCatalog, limit : Int) -> Int

Return the total Cartesian size capped at a limit.

#
DomainCatalog::clone

Return a catalog of cloned domains.

#
DomainCatalog::consistent

fn DomainCatalog::consistent(self : DomainCatalog) -> Bool

Return whether every domain is non-empty.

#
DomainCatalog::describe

fn DomainCatalog::describe(self : DomainCatalog) -> String

Return a compact catalog description.

#
DomainCatalog::empty_entries

fn DomainCatalog::empty_entries(self : DomainCatalog) -> Array[Int]

Return empty-domain entries.

#
DomainCatalog::entries

Return copied entries.

#
DomainCatalog::entry

fn DomainCatalog::entry(self : DomainCatalog, id : Int) -> DomainEntry

Read an entry.

#
DomainCatalog::find

fn DomainCatalog::find(self : DomainCatalog, name : String) -> DomainEntry?

Find an entry by name.

#
DomainCatalog::hole_count

fn DomainCatalog::hole_count(self : DomainCatalog) -> Int

Return the number of holes across all domains.

#
DomainCatalog::intersect_range

fn DomainCatalog::intersect_range(self : DomainCatalog, id : Int, lower : Int, upper : Int) -> Bool

Restrict one domain to an interval.

#
DomainCatalog::intersect_values

fn DomainCatalog::intersect_values(self : DomainCatalog, id : Int, values : Array[Int]) -> Bool

Restrict one domain to an explicit set.

#
DomainCatalog::length

fn DomainCatalog::length(self : DomainCatalog) -> Int

Return catalog length.

#
DomainCatalog::most_constrained

fn DomainCatalog::most_constrained(self : DomainCatalog, threshold : Int) -> Array[Int]

Return domains with at most a threshold number of values.

#
DomainCatalog::names

fn DomainCatalog::names(self : DomainCatalog) -> Array[String]

Return all names.

#
DomainCatalog::remove

fn DomainCatalog::remove(self : DomainCatalog, id : Int, value : Int) -> Bool

Remove a value from one catalog entry.

#
DomainCatalog::restrict_all

fn DomainCatalog::restrict_all(self : DomainCatalog, lower : Int, upper : Int) -> Int

Return a copy with every domain intersected by a shared interval.

#
DomainCatalog::signature

fn DomainCatalog::signature(self : DomainCatalog) -> Int

Return a catalog fingerprint.

#
DomainCatalog::singleton_entries

fn DomainCatalog::singleton_entries(self : DomainCatalog) -> Array[(Int, Int)]

Return singleton entries.

#
DomainCatalog::sizes

fn DomainCatalog::sizes(self : DomainCatalog) -> Array[Int]

Return all domain sizes.

#
DomainCatalog::tagged_bounds

fn DomainCatalog::tagged_bounds(self : DomainCatalog, tag : String) -> (Int, Int)?

Return the smallest enclosing interval for tagged domains.

#
DomainCatalog::tagged_values

fn DomainCatalog::tagged_values(self : DomainCatalog, tag : String) -> IntegerSet

Return the union of all values in tagged entries.

#
DomainCatalog::with_tag

fn DomainCatalog::with_tag(self : DomainCatalog, tag : String) -> Array[Int]

Return entries with a tag.

#
DomainChange

pub struct DomainChange {
variable : Int
before : Domain
after : Domain
removed : Array[Int]
added : Array[Int]
}

Explain finite-domain changes in a solver-friendly form.

Explanations are deliberately data-only: callers can render them as CLI diagnostics, attach them to an assumption conflict, or snapshot them in a regression test without depending on mutable solver internals.

#
DomainChange::added_values

fn DomainChange::added_values(self : DomainChange) -> Array[Int]

Return added values.

#
DomainChange::changed

fn DomainChange::changed(self : DomainChange) -> Bool

Return whether a domain changed.

#
DomainChange::describe

fn DomainChange::describe(self : DomainChange) -> String

Return a stable explanation.

#
DomainChange::removed_values

fn DomainChange::removed_values(self : DomainChange) -> Array[Int]

Return removed values.

#
DomainDelta

pub struct DomainDelta {
variable : Int
before : Domain
after : Domain
}

Return a domain delta between two saved states.

#
DomainDelta::after

fn DomainDelta::after(self : DomainDelta) -> Domain

Read the narrowed domain.

#
DomainDelta::before

fn DomainDelta::before(self : DomainDelta) -> Domain

Read the previous domain.

#
DomainDelta::describe

fn DomainDelta::describe(self : DomainDelta) -> String

Render a delta for propagation diagnostics.

#
DomainDelta::variable

fn DomainDelta::variable(self : DomainDelta) -> Int

Read the variable from a domain delta.

#
DomainEntry

pub struct DomainEntry {
id : Int
name : String
domain : Domain
tag : String
}

Domain catalogs for application-level variable schemas.

A catalog gives names, domains, tags, and simple filtering operations to data-driven model builders. It preserves the finite-domain core while allowing CLI and configuration layers to inspect variables without depending on solver internals.

#
DomainInterval

pub struct DomainInterval {
lower : Int
upper : Int
} derive(Eq,
Debug
)

A maximal contiguous segment of an integer domain.

#
DomainInterval::contains

fn DomainInterval::contains(self : DomainInterval, value : Int) -> Bool

Whether a value is contained in an interval.

#
DomainInterval::describe

fn DomainInterval::describe(self : DomainInterval) -> String

Return a stable textual interval.

#
DomainInterval::intersect

fn DomainInterval::intersect(self : DomainInterval, other : DomainInterval) -> DomainInterval?

Return the intersection of two intervals, when it exists.

#
DomainInterval::lower

fn DomainInterval::lower(self : DomainInterval) -> Int

Read an interval's lower bound.

#
DomainInterval::size

fn DomainInterval::size(self : DomainInterval) -> Int

Number of integers in an interval.

#
DomainInterval::touches

fn DomainInterval::touches(self : DomainInterval, other : DomainInterval) -> Bool

Whether two intervals overlap or touch.

#
DomainInterval::upper

fn DomainInterval::upper(self : DomainInterval) -> Int

Read an interval's upper bound.

#
DomainProfile

pub struct DomainProfile {
minimum : Int?
maximum : Int?
size : Int
interval_count : Int
removed_count : Int
}

Return a summary of domain shape for instrumentation.

#
DomainProfile::describe

fn DomainProfile::describe(self : DomainProfile) -> String

Render a domain profile for metrics output.

#
DomainProfile::interval_count

fn DomainProfile::interval_count(self : DomainProfile) -> Int

Read the profile's interval count.

#
DomainProfile::size

fn DomainProfile::size(self : DomainProfile) -> Int

Read the profile's candidate count.

#
EventQueue

pub struct EventQueue {
events : Array[SimulationEvent]
}

A sorted event queue.

#
EventQueue::clear

fn EventQueue::clear(self : EventQueue) -> Unit

Remove all queued events.

#
EventQueue::length

fn EventQueue::length(self : EventQueue) -> Int

Return queue length.

#
EventQueue::peek

Peek at the earliest event.

#
EventQueue::pop

Pop the earliest event.

#
EventQueue::push

fn EventQueue::push(self : EventQueue, event : SimulationEvent) -> Bool

Add an event in stable order.

#
EvidenceBundle

pub struct EvidenceBundle {
records : Array[EvidenceRecord]
}

A collection of evidence records.

#
EvidenceBundle::add

fn EvidenceBundle::add(self : EvidenceBundle, record : EvidenceRecord) -> Bool

#
EvidenceBundle::describe

fn EvidenceBundle::describe(self : EvidenceBundle) -> String

#
EvidenceBundle::exact

fn EvidenceBundle::exact(self : EvidenceBundle, name : String, metric : String, value : Int, expected : Int) -> Unit

Add an exact evidence gate.

#
EvidenceBundle::failure_count

fn EvidenceBundle::failure_count(self : EvidenceBundle) -> Int

#
EvidenceBundle::length

fn EvidenceBundle::length(self : EvidenceBundle) -> Int

#
EvidenceBundle::maximum

fn EvidenceBundle::maximum(self : EvidenceBundle, name : String, metric : String, value : Int, expected : Int) -> Unit

Add a maximum evidence gate.

#
EvidenceBundle::minimum

fn EvidenceBundle::minimum(self : EvidenceBundle, name : String, metric : String, value : Int, expected : Int) -> Unit

Add a minimum evidence gate.

#
EvidenceBundle::passed

fn EvidenceBundle::passed(self : EvidenceBundle) -> Bool

#
EvidenceBundle::signature

fn EvidenceBundle::signature(self : EvidenceBundle) -> Int

#
EvidenceBundle::values

fn EvidenceBundle::values(self : EvidenceBundle) -> Array[Int]

#
EvidenceRecord

pub struct EvidenceRecord {
name : String
metric : String
value : Int
expected : Int
passed : Bool
}

Compact evidence records for local acceptance runs.

#
EvidenceRecord::describe

fn EvidenceRecord::describe(self : EvidenceRecord) -> String

#
EvidenceRecord::expected

fn EvidenceRecord::expected(self : EvidenceRecord) -> Int

#
EvidenceRecord::passed

fn EvidenceRecord::passed(self : EvidenceRecord) -> Bool

#
EvidenceRecord::value

fn EvidenceRecord::value(self : EvidenceRecord) -> Int

#
FiniteRelation

pub struct FiniteRelation {
left_size : Int
right_size : Int
pairs : Array[RelationPair]
}

A finite binary relation.

#
FiniteRelation::add

fn FiniteRelation::add(self : FiniteRelation, left : Int, right : Int) -> Bool

Add a pair.

#
FiniteRelation::contains

fn FiniteRelation::contains(self : FiniteRelation, left : Int, right : Int) -> Bool

Return whether a pair is present.

#
FiniteRelation::functional

fn FiniteRelation::functional(self : FiniteRelation) -> Bool

Return whether the relation is functional.

#
FiniteRelation::image

fn FiniteRelation::image(self : FiniteRelation, left : Int) -> IntegerSet

Return right values supported by a left value.

#
FiniteRelation::inverse

Return the inverse relation.

#
FiniteRelation::length

fn FiniteRelation::length(self : FiniteRelation) -> Int

Return pair count.

#
FiniteRelation::pairs

Return pairs.

#
FiniteRelation::preimage

fn FiniteRelation::preimage(self : FiniteRelation, right : Int) -> IntegerSet

Return left values that support a right value.

#
FiniteRelation::restrict

fn FiniteRelation::restrict(self : FiniteRelation, left : IntegerSet, right : IntegerSet) -> FiniteRelation

Restrict a relation to left and right sets.

#
FiniteRelation::signature

fn FiniteRelation::signature(self : FiniteRelation) -> Int

Return a stable relation fingerprint.

#
FiniteRelation::table

fn FiniteRelation::table(self : FiniteRelation) -> Array[Array[Int]]

Return a table of supported pairs.

#
FiniteRelation::total

fn FiniteRelation::total(self : FiniteRelation) -> Bool

Return whether every left value has a support.

#
GraphColoring

pub struct GraphColoring {
solver : Solver
colors : Array[Int]
vertices : Int
color_count : Int
edges : Array[(Int, Int)]
}

An undirected graph-coloring model.

#
GraphColoring::adjacency

fn GraphColoring::adjacency(self : GraphColoring) -> Array[Array[Bool]]

Return an adjacency matrix, useful for debugging imported graphs.

#
GraphColoring::color_of

fn GraphColoring::color_of(self : GraphColoring, vertex : Int) -> Int

Return the variable identifier for a vertex.

#
GraphColoring::colors

fn GraphColoring::colors(self : GraphColoring, solution : Solution) -> Array[Int]

Return the color vector in vertex order.

#
GraphColoring::is_valid

fn GraphColoring::is_valid(self : GraphColoring, solution : Solution) -> Bool

Validate a complete coloring.

#
GraphColoring::render

fn GraphColoring::render(self : GraphColoring, solution : Solution) -> String

Render a solution as vertex:color pairs.

#
GraphColoring::solve

fn GraphColoring::solve(self : GraphColoring) -> Solution?

Solve a coloring problem once.

#
GraphColoring::solve_all

fn GraphColoring::solve_all(self : GraphColoring, limit : Int) -> Array[Solution]

Enumerate up to limit colorings.

#
GraphColoring::stats

Return solver statistics.

#
GraphEdge

pub struct GraphEdge {
from : Int
to : Int
weight : Int
}

Deterministic graph algorithms for constraint-model preprocessing.

Graphs use a dense integer matrix because finite-domain applications often already have a bounded set of resources, machines, or locations. A value of -1 means that an edge is absent; zero-weight edges are supported.

#
GraphEdge::from

fn GraphEdge::from(self : GraphEdge) -> Int

Read an edge source.

#
GraphEdge::to

fn GraphEdge::to(self : GraphEdge) -> Int

Read an edge destination.

#
GraphEdge::weight

fn GraphEdge::weight(self : GraphEdge) -> Int

Read an edge weight.

#
GuardedSolve

pub struct GuardedSolve {
status : SolveStatus
solution : Solution?
stats : SearchStats
reason : String?
}

Result of a solve subject to structural and search limits.

#
GuardedSolve::describe

fn GuardedSolve::describe(self : GuardedSolve) -> String

Render a guarded solve result.

#
GuardedSolve::is_success

fn GuardedSolve::is_success(self : GuardedSolve) -> Bool

Return whether a guarded solve reached a valid solution.

#
GuardedSolve::reason

fn GuardedSolve::reason(self : GuardedSolve) -> String?

Return an optional rejection or budget reason.

#
GuardedSolve::solution

fn GuardedSolve::solution(self : GuardedSolve) -> Solution?

Return the optional solution.

#
GuardedSolve::solution_values

fn GuardedSolve::solution_values(self : GuardedSolve) -> Array[Int]?

Return a defensive copy of a guarded result's solution values.

#
GuardedSolve::stats

Return solve counters.

#
GuardedSolve::status

fn GuardedSolve::status(self : GuardedSolve) -> SolveStatus

Return the solve status.

#
GuardedSolve::was_budget_limited

fn GuardedSolve::was_budget_limited(self : GuardedSolve) -> Bool

Return whether a guarded solve exhausted its node budget.

#
GuardedSolve::was_rejected

fn GuardedSolve::was_rejected(self : GuardedSolve) -> Bool

Return whether a guarded solve was rejected before search.

#
HeuristicResult

pub struct HeuristicResult {
name : String
solutions : Int
stats : SearchStats
}

A comparative result for one search configuration.

#
HeuristicResult::describe

fn HeuristicResult::describe(self : HeuristicResult) -> String

Render a comparative result.

#
HeuristicResult::name

fn HeuristicResult::name(self : HeuristicResult) -> String

Read the strategy name.

#
HeuristicResult::solutions

fn HeuristicResult::solutions(self : HeuristicResult) -> Int

Read solution count.

#
HeuristicResult::stats

Read search statistics.

#
IntMatrix

pub struct IntMatrix {
rows : Int
columns : Int
values : Array[Int]
}

Integer matrix utilities used by grid constraints and resource heatmaps.

Matrices are row-major, bounds checked at construction, and intentionally use integers so they can be shared by solver preprocessing, image-like occupancy grids, and deterministic benchmark fixtures.

#
IntMatrix::add

fn IntMatrix::add(self : IntMatrix, other : IntMatrix) -> IntMatrix?

Add two matrices.

#
IntMatrix::box_blur

fn IntMatrix::box_blur(self : IntMatrix, radius : Int) -> IntMatrix

Return a centered moving average with integer division.

#
IntMatrix::clamp

fn IntMatrix::clamp(self : IntMatrix, lower : Int, upper : Int) -> Unit

Clamp every cell into an inclusive range.

#
IntMatrix::column

fn IntMatrix::column(self : IntMatrix, column : Int) -> Array[Int]

Return a copied column.

#
IntMatrix::column_count

fn IntMatrix::column_count(self : IntMatrix) -> Int

Return column count.

#
IntMatrix::column_sums

fn IntMatrix::column_sums(self : IntMatrix) -> Array[Int]

Return column sums.

#
IntMatrix::component_size

fn IntMatrix::component_size(self : IntMatrix, row : Int, column : Int) -> Int

Count a connected component of equal-valued cells.

#
IntMatrix::convolve3x3

fn IntMatrix::convolve3x3(self : IntMatrix, kernel : Array[Int], divisor : Int) -> IntMatrix?

Apply a four-neighbor convolution kernel.

#
IntMatrix::count

fn IntMatrix::count(self : IntMatrix, value : Int) -> Int

Count cells equal to a value.

#
IntMatrix::csv

fn IntMatrix::csv(self : IntMatrix) -> String

Render rows as comma-separated integers.

#
IntMatrix::diagonal

fn IntMatrix::diagonal(self : IntMatrix) -> Array[Int]

Return the main diagonal.

#
IntMatrix::fill

fn IntMatrix::fill(self : IntMatrix, value : Int) -> Unit

Fill every cell.

#
IntMatrix::get

fn IntMatrix::get(self : IntMatrix, row : Int, column : Int) -> Int

Read a cell.

#
IntMatrix::grid_path

fn IntMatrix::grid_path(self : IntMatrix, start : (Int, Int), goal : (Int, Int), passable : Int) -> Array[(Int, Int)]?

Return a four-neighbor shortest path on cells equal to a passable value.

#
IntMatrix::maximum

fn IntMatrix::maximum(self : IntMatrix) -> Int?

Return the largest cell value, or None for an empty matrix.

#
IntMatrix::minimum

fn IntMatrix::minimum(self : IntMatrix) -> Int?

Return the smallest cell value, or None for an empty matrix.

#
IntMatrix::multiply

fn IntMatrix::multiply(self : IntMatrix, other : IntMatrix) -> IntMatrix?

Multiply two matrices.

#
IntMatrix::neighbors4

fn IntMatrix::neighbors4(self : IntMatrix, row : Int, column : Int) -> Array[(Int, Int)]

Return the four-neighbor cells of a coordinate.

#
IntMatrix::prefix_sum

fn IntMatrix::prefix_sum(self : IntMatrix) -> IntMatrix

Compute an integral prefix-sum matrix.

#
IntMatrix::reflect_horizontal

fn IntMatrix::reflect_horizontal(self : IntMatrix) -> IntMatrix

Reflect across the vertical axis.

#
IntMatrix::reflect_vertical

fn IntMatrix::reflect_vertical(self : IntMatrix) -> IntMatrix

Reflect across the horizontal axis.

#
IntMatrix::render

fn IntMatrix::render(self : IntMatrix) -> String

Render a matrix with spaces between cells.

#
IntMatrix::rotate_clockwise

fn IntMatrix::rotate_clockwise(self : IntMatrix) -> IntMatrix

Rotate clockwise by 90 degrees.

#
IntMatrix::row

fn IntMatrix::row(self : IntMatrix, row : Int) -> Array[Int]

Return a copied row.

#
IntMatrix::row_count

fn IntMatrix::row_count(self : IntMatrix) -> Int

Return row count.

#
IntMatrix::row_sums

fn IntMatrix::row_sums(self : IntMatrix) -> Array[Int]

Return row sums.

#
IntMatrix::scale

fn IntMatrix::scale(self : IntMatrix, factor : Int) -> IntMatrix

Multiply each cell by a scalar.

#
IntMatrix::set

fn IntMatrix::set(self : IntMatrix, row : Int, column : Int, value : Int) -> Bool

Write a cell and return whether it changed.

#
IntMatrix::sign

fn IntMatrix::sign(self : IntMatrix) -> IntMatrix

Replace each cell by its sign.

#
IntMatrix::signature

fn IntMatrix::signature(self : IntMatrix) -> Int

Return a stable matrix fingerprint.

#
IntMatrix::subtract

fn IntMatrix::subtract(self : IntMatrix, other : IntMatrix) -> IntMatrix?

Subtract two matrices.

#
IntMatrix::threshold

fn IntMatrix::threshold(self : IntMatrix, limit : Int) -> IntMatrix

Return a binary occupancy mask.

#
IntMatrix::trace

fn IntMatrix::trace(self : IntMatrix) -> Int?

Return the trace of a square matrix.

#
IntMatrix::transpose

fn IntMatrix::transpose(self : IntMatrix) -> IntMatrix

Return the transpose.

#
IntMatrix::valid_cell

fn IntMatrix::valid_cell(self : IntMatrix, row : Int, column : Int) -> Bool

Validate a cell coordinate.

#
IntMatrix::values

fn IntMatrix::values(self : IntMatrix) -> Array[Int]

Return copied row-major values.

#
IntegerHistogram

pub struct IntegerHistogram {
lower : Int
width : Int
counts : Array[Int]
}

A histogram with fixed-width integer buckets.

#
IntegerHistogram::add

fn IntegerHistogram::add(self : IntegerHistogram, value : Int) -> Bool

Add a value to a histogram when it falls within its buckets.

#
IntegerHistogram::add_all

fn IntegerHistogram::add_all(self : IntegerHistogram, values : Array[Int]) -> Int

Add all values and return the number accepted.

#
IntegerHistogram::bucket

fn IntegerHistogram::bucket(self : IntegerHistogram, index : Int) -> Int

Return a bucket count.

#
IntegerHistogram::counts

fn IntegerHistogram::counts(self : IntegerHistogram) -> Array[Int]

Return bucket counts.

#
IntegerHistogram::peak

fn IntegerHistogram::peak(self : IntegerHistogram) -> Int?

Return the bucket with the largest count.

#
IntegerHistogram::total

fn IntegerHistogram::total(self : IntegerHistogram) -> Int

Return total accepted values.

#
IntegerObjective

pub struct IntegerObjective {
values : Array[Int]
directions : Array[PortfolioDirection]
}

Integer optimization utilities for candidate plans.

#
IntegerObjective::compare

fn IntegerObjective::compare(self : IntegerObjective, other : IntegerObjective) -> Int

Compare vectors lexicographically.

#
IntegerObjective::dominates

fn IntegerObjective::dominates(self : IntegerObjective, other : IntegerObjective) -> Bool

Return whether this vector dominates another.

#
IntegerObjective::length

fn IntegerObjective::length(self : IntegerObjective) -> Int

Return objective dimension.

#
IntegerObjective::values

fn IntegerObjective::values(self : IntegerObjective) -> Array[Int]

Return copied objective values.

#
IntegerRegression

pub struct IntegerRegression {
slope_scaled : Int
intercept : Int
error : Int
}

A pair of samples for regression.

#
IntegerRegression::error

fn IntegerRegression::error(self : IntegerRegression) -> Int

Read squared error.

#
IntegerRegression::intercept

fn IntegerRegression::intercept(self : IntegerRegression) -> Int

Read intercept.

#
IntegerRegression::slope_scaled

fn IntegerRegression::slope_scaled(self : IntegerRegression) -> Int

Read scaled slope.

#
IntegerSet

pub struct IntegerSet {
values : Array[Int]
}

Small finite-set and relation structures for domain preprocessing.

IntegerSet keeps sorted unique values and offers the operations commonly needed when filtering domains, composing allowed-value tables, or explaining the support of a constraint.

#
IntegerSet::contains

fn IntegerSet::contains(self : IntegerSet, value : Int) -> Bool

Return whether a value belongs to the set.

#
IntegerSet::contiguous

fn IntegerSet::contiguous(self : IntegerSet) -> Bool

Return whether all values form a contiguous interval.

#
IntegerSet::describe

fn IntegerSet::describe(self : IntegerSet) -> String

Return a stable set representation.

#
IntegerSet::difference

fn IntegerSet::difference(self : IntegerSet, other : IntegerSet) -> IntegerSet

Return values in the left set but not the right set.

#
IntegerSet::insert

fn IntegerSet::insert(self : IntegerSet, value : Int) -> Bool

Insert a value.

#
IntegerSet::intersection

fn IntegerSet::intersection(self : IntegerSet, other : IntegerSet) -> IntegerSet

Return the intersection.

#
IntegerSet::length

fn IntegerSet::length(self : IntegerSet) -> Int

Return set cardinality.

#
IntegerSet::maximum

fn IntegerSet::maximum(self : IntegerSet) -> Int?

Return the largest value.

#
IntegerSet::minimum

fn IntegerSet::minimum(self : IntegerSet) -> Int?

Return the smallest value.

#
IntegerSet::remove

fn IntegerSet::remove(self : IntegerSet, value : Int) -> Bool

Remove a value.

#
IntegerSet::runs

fn IntegerSet::runs(self : IntegerSet) -> Array[(Int, Int)]

Return contiguous runs as inclusive pairs.

#
IntegerSet::subset_of

fn IntegerSet::subset_of(self : IntegerSet, other : IntegerSet) -> Bool

Return whether every value is in another set.

#
IntegerSet::union

fn IntegerSet::union(self : IntegerSet, other : IntegerSet) -> IntegerSet

Return the union.

#
IntegerSet::values

fn IntegerSet::values(self : IntegerSet) -> Array[Int]

Return copied sorted values.

#
IntegerSummary

pub struct IntegerSummary {
count : Int
total : Int
minimum : Int
maximum : Int
median : Int
mean : Int
}

Integer statistics for deterministic solver and application telemetry.

Metrics avoid floating-point dependence so benchmark snapshots remain reproducible across native, wasm, and wasm-gc targets. Percentage and correlation helpers use explicit scale factors documented by their names.

#
IntegerSummary::count

fn IntegerSummary::count(self : IntegerSummary) -> Int

Read sample count.

#
IntegerSummary::describe

fn IntegerSummary::describe(self : IntegerSummary) -> String

Return a stable summary line.

#
IntegerSummary::maximum

fn IntegerSummary::maximum(self : IntegerSummary) -> Int

Read maximum.

#
IntegerSummary::mean

fn IntegerSummary::mean(self : IntegerSummary) -> Int

Read integer mean.

#
IntegerSummary::median

fn IntegerSummary::median(self : IntegerSummary) -> Int

Read median.

#
IntegerSummary::minimum

fn IntegerSummary::minimum(self : IntegerSummary) -> Int

Read minimum.

#
IntegerSummary::total

fn IntegerSummary::total(self : IntegerSummary) -> Int

Read total.

#
IntervalTask

pub struct IntervalTask {
name : String
start : Int
duration : Int
demand : Int
latest_start : Int
}

A finite-horizon interval scheduling model.

#
Knapsack

pub struct Knapsack {
solver : Solver
items : Array[KnapsackItem]
objective : Int
capacity : Int
}

A knapsack model and its objective variable.

#
Knapsack::is_valid

fn Knapsack::is_valid(self : Knapsack, solution : Solution) -> Bool

Return whether a solution is capacity-feasible.

#
Knapsack::objective_variable

fn Knapsack::objective_variable(self : Knapsack) -> Int

Return the objective variable.

#
Knapsack::render

fn Knapsack::render(self : Knapsack, solution : Solution) -> String

Render a solution as a compact item list.

#
Knapsack::selected_names

fn Knapsack::selected_names(self : Knapsack, solution : Solution) -> Array[String]

Return all selected item names.

#
Knapsack::selection_variable

fn Knapsack::selection_variable(self : Knapsack, item : Int) -> Int

Return the item selection variable.

#
Knapsack::solve

fn Knapsack::solve(self : Knapsack) -> OptimizationResult?

Solve for a maximum-value selection.

#
Knapsack::stats

fn Knapsack::stats(self : Knapsack) -> SearchStats

Return solver statistics.

#
Knapsack::value

fn Knapsack::value(self : Knapsack, solution : Solution) -> Int

Return the total value of a solution.

#
Knapsack::weight

fn Knapsack::weight(self : Knapsack, solution : Solution) -> Int

Return the total weight of a solution.

#
KnapsackItem

pub struct KnapsackItem {
name : String
weight : Int
value : Int
selected : Int
}

A 0/1 knapsack model with a real weighted capacity constraint.

#
LatinPuzzle

pub struct LatinPuzzle {
size : Int
values : IntMatrix
}

A Latin square model.

#
LatinPuzzle::candidates

fn LatinPuzzle::candidates(self : LatinPuzzle, row : Int, column : Int) -> Array[Int]

Return legal values for a Latin square cell.

#
LatinPuzzle::set

fn LatinPuzzle::set(self : LatinPuzzle, row : Int, column : Int, value : Int) -> Bool

Set a Latin square cell.

#
LatinPuzzle::signature

fn LatinPuzzle::signature(self : LatinPuzzle) -> Int

Return a puzzle fingerprint.

#
LatinPuzzle::solved

fn LatinPuzzle::solved(self : LatinPuzzle) -> Bool

Return whether a Latin square is complete and valid.

#
LatinSquare

pub struct LatinSquare {
solver : Solver
cells : Array[Int]
size : Int
}

A Latin square model with row and column permutation constraints.

#
LatinSquare::cell

fn LatinSquare::cell(self : LatinSquare, row : Int, column : Int) -> Int

Return a cell identifier.

#
LatinSquare::fix_first_row

fn LatinSquare::fix_first_row(self : LatinSquare) -> Unit

Fix the first row to canonical symbol order.

#
LatinSquare::is_valid

fn LatinSquare::is_valid(self : LatinSquare, solution : Solution) -> Bool

Validate a Latin square solution.

#
LatinSquare::matrix

fn LatinSquare::matrix(self : LatinSquare, solution : Solution) -> Array[Array[Int]]

Return a matrix of a Latin square solution.

#
LatinSquare::solve

fn LatinSquare::solve(self : LatinSquare) -> Solution?

Solve the Latin square once.

#
LatinSquare::stats

fn LatinSquare::stats(self : LatinSquare) -> SearchStats

Return search statistics.

#
LinearBuilder

pub struct LinearBuilder {
terms : Array[(Int, Int)]
constant : Int
}

A small fluent builder for weighted linear constraints.

#
LinearBuilder::constant

fn LinearBuilder::constant(self : LinearBuilder) -> Int

Return the constant offset.

#
LinearBuilder::equals

fn LinearBuilder::equals(self : LinearBuilder, target : Int) -> Constraint

Convert an expression equality into a solver constraint.

#
LinearBuilder::offset

fn LinearBuilder::offset(self : LinearBuilder, value : Int) -> LinearBuilder

Add a constant offset to the expression.

#
LinearBuilder::post_equals

fn LinearBuilder::post_equals(self : LinearBuilder, model : ModelBuilder, target : Int) -> Unit

Add an expression equality to a named model.

#
LinearBuilder::term

fn LinearBuilder::term(self : LinearBuilder, variable : Int, coefficient : Int) -> LinearBuilder

Append coefficient * variable to an expression.

#
LinearBuilder::terms

fn LinearBuilder::terms(self : LinearBuilder) -> Array[(Int, Int)]

Return a defensive copy of expression terms.

#
MachineSpec

pub struct MachineSpec {
id : Int
name : String
capacity : Int
}

Job-shop and machine-sequencing utilities.

Manufacturing operations are represented as fixed machine assignments with setup and processing durations. The module provides deterministic dispatch rules and validates the resulting Gantt plan before it is used as a solver seed or exported to a shop-floor integration.

#
MachineSpec::capacity

fn MachineSpec::capacity(self : MachineSpec) -> Int

Read machine capacity.

#
MachineSpec::id

fn MachineSpec::id(self : MachineSpec) -> Int

Read machine identifier.

#
MagicSquare

pub struct MagicSquare {
solver : Solver
cells : Array[Int]
size : Int
magic_sum : Int
}

A magic-square model with all-different cells and line sums.

#
MagicSquare::cell

fn MagicSquare::cell(self : MagicSquare, row : Int, column : Int) -> Int

Return a cell identifier.

#
MagicSquare::is_valid

fn MagicSquare::is_valid(self : MagicSquare, solution : Solution) -> Bool

Return whether a magic-square assignment is valid.

#
MagicSquare::matrix

fn MagicSquare::matrix(self : MagicSquare, solution : Solution) -> Array[Array[Int]]

Return a matrix from a magic-square solution.

#
MagicSquare::solve

fn MagicSquare::solve(self : MagicSquare) -> Solution?

Solve a magic square once.

#
MagicSquare::stats

fn MagicSquare::stats(self : MagicSquare) -> SearchStats

Return statistics from the most recent solve.

#
MagicSquare::target

fn MagicSquare::target(self : MagicSquare) -> Int

Return the target line sum.

#
ManufacturingInstance

pub struct ManufacturingInstance {
machines : Array[MachineSpec]
operations : Array[ManufacturingOperation]
setup_matrix : Array[Array[Int]]
}

A validated manufacturing instance.

#
ManufacturingInstance::machine

Read a machine.

#
ManufacturingInstance::machine_count

fn ManufacturingInstance::machine_count(self : ManufacturingInstance) -> Int

Return machine count.

#
ManufacturingInstance::operation

Read an operation.

#
ManufacturingInstance::operation_count

fn ManufacturingInstance::operation_count(self : ManufacturingInstance) -> Int

Return operation count.

#
ManufacturingOperation

pub struct ManufacturingOperation {
id : Int
job : Int
sequence : Int
machine : Int
setup : Int
duration : Int
family : Int
due : Int
}

A fixed-machine operation.

#
ManufacturingOperation::job

Read operation job.

#
ManufacturingOperation::machine

Read assigned machine.

#
ManufacturingOperation::sequence

Read operation sequence.

#
ManufacturingOperation::total_duration

fn ManufacturingOperation::total_duration(self : ManufacturingOperation) -> Int

Return setup plus processing duration.

#
ManufacturingSchedule

pub struct ManufacturingSchedule {
starts : Array[Int]
machine_order : Array[Array[Int]]
}

A concrete operation start schedule.

#
ManufacturingSchedule::machine_sequence

fn ManufacturingSchedule::machine_sequence(self : ManufacturingSchedule, machine : Int) -> Array[Int]

Return machine sequence.

#
ManufacturingSchedule::queue

fn ManufacturingSchedule::queue(self : ManufacturingSchedule, machine : Int, operation : Int) -> Bool

Add an operation to a machine sequence.

#
ManufacturingSchedule::set_start

fn ManufacturingSchedule::set_start(self : ManufacturingSchedule, operation : Int, start : Int) -> Bool

Set an operation start time.

#
ManufacturingSchedule::start

fn ManufacturingSchedule::start(self : ManufacturingSchedule, operation : Int) -> Int

Read an operation start.

#
ManufacturingSchedule::starts

Return a copied start array.

#
ModelBuilder

pub struct ModelBuilder {
solver : Solver
names : Map[String, Int]
}

A named facade over Solver for applications that prefer model-building APIs over manually managing integer identifiers.

#
ModelBuilder::configure

fn ModelBuilder::configure(self : ModelBuilder, config : SearchConfig) -> Unit

Configure the named model's search strategy.

#
ModelBuilder::constraint_count

fn ModelBuilder::constraint_count(self : ModelBuilder) -> Int

Return the number of constraints currently posted.

#
ModelBuilder::describe_solution

fn ModelBuilder::describe_solution(self : ModelBuilder, solution : Solution) -> String

Format a solution using the model's declared variable order.

#
ModelBuilder::find

fn ModelBuilder::find(self : ModelBuilder, name : String) -> Int?

Resolve a variable name to an identifier.

#
ModelBuilder::finite

fn ModelBuilder::finite(self : ModelBuilder, name : String, values : Array[Int]) -> Int

Add a named variable with an explicit finite domain.

#
ModelBuilder::fix

fn ModelBuilder::fix(self : ModelBuilder, name : String, value : Int) -> Bool

Fix a named variable to one value.

#
ModelBuilder::int

fn ModelBuilder::int(self : ModelBuilder, name : String, lower : Int, upper : Int) -> Int

Add a bounded integer variable and return its identifier.

#
ModelBuilder::limit

fn ModelBuilder::limit(self : ModelBuilder, count : Int) -> Unit

Set the solution limit for the named model.

#
ModelBuilder::named_solution

fn ModelBuilder::named_solution(self : ModelBuilder, solution : Solution) -> Map[String, Int]

Bind a solution to a name/value map.

#
ModelBuilder::names

fn ModelBuilder::names(self : ModelBuilder) -> Map[String, Int]

Return a copy of the name-to-id map for diagnostics and adapters.

#
ModelBuilder::post

fn ModelBuilder::post(self : ModelBuilder, constraint : Constraint) -> Unit

Post a constraint to the underlying solver.

#
ModelBuilder::post_all_different

fn ModelBuilder::post_all_different(self : ModelBuilder, names : Array[String]) -> Unit

Add an all-different constraint by variable names.

#
ModelBuilder::post_count

fn ModelBuilder::post_count(self : ModelBuilder, names : Array[String], value : Int, count : Int) -> Unit

Add an exact count constraint by variable names.

#
ModelBuilder::post_equal

fn ModelBuilder::post_equal(self : ModelBuilder, left : String, right : String) -> Unit

A readable, checked model construction helper for equality.

#
ModelBuilder::post_less_than

fn ModelBuilder::post_less_than(self : ModelBuilder, left : String, right : String) -> Unit

A readable, checked model construction helper for ordering.

#
ModelBuilder::post_not_equal

fn ModelBuilder::post_not_equal(self : ModelBuilder, left : String, right : String) -> Unit

A readable, checked model construction helper for inequality.

#
ModelBuilder::require

fn ModelBuilder::require(self : ModelBuilder, name : String) -> Int

Resolve a name or abort with a model-building error.

#
ModelBuilder::solve

fn ModelBuilder::solve(self : ModelBuilder) -> Solution?

Solve the named model once.

#
ModelBuilder::solve_all

fn ModelBuilder::solve_all(self : ModelBuilder) -> Array[Solution]

Enumerate solutions of the named model.

#
ModelBuilder::solver

fn ModelBuilder::solver(self : ModelBuilder) -> Solver

Access the underlying solver for advanced constraints or diagnostics.

#
ModelBuilder::summary

fn ModelBuilder::summary(self : ModelBuilder) -> String

Return a summary that keeps names in insertion order.

#
ModelBuilder::variable_count

fn ModelBuilder::variable_count(self : ModelBuilder) -> Int

Return the number of variables currently declared.

#
ModelLimits

pub struct ModelLimits {
max_variables : Int
max_constraints : Int
max_domain_size : Int
}

Model-size limits for services that accept user-authored constraints.

#
ModelReport

pub struct ModelReport {
name : String
variables : Int
constraints : Int
solved : Bool
solutions : Int
nodes : Int
propagations : Int
checks : Int
pruned : Int
signature : Int
}

Structured model and solve reports for CLI and CI artifacts.

Reports keep metrics close to the model that produced them, making it possible to compare revisions without scraping human-oriented logs.

#
ModelReport::constraints

fn ModelReport::constraints(self : ModelReport) -> Int

Return constraint count.

#
ModelReport::csv

fn ModelReport::csv(self : ModelReport) -> String

Render a report as CSV.

#
ModelReport::describe

fn ModelReport::describe(self : ModelReport) -> String

Return a stable one-line report.

#
ModelReport::solutions

fn ModelReport::solutions(self : ModelReport) -> Int

Return solution count.

#
ModelReport::solved

fn ModelReport::solved(self : ModelReport) -> Bool

Return whether solved.

#
ModelReport::variables

fn ModelReport::variables(self : ModelReport) -> Int

Return variable count.

#
ModelReport::work

fn ModelReport::work(self : ModelReport) -> Int

Return work score.

#
ModelSchema

pub struct ModelSchema {
name : String
fields : Array[SchemaField]
}

A model schema.

#
ModelSchema::add

fn ModelSchema::add(self : ModelSchema, field : SchemaField) -> Bool

Add a field if its id and name are unique.

#
ModelSchema::cartesian_size

fn ModelSchema::cartesian_size(self : ModelSchema, limit : Int) -> Int

Return the Cartesian size capped at a limit.

#
ModelSchema::changed_defaults

fn ModelSchema::changed_defaults(self : ModelSchema, values : Array[Int]) -> Array[(Int, Int, Int)]

Return an assignment difference from defaults.

#
ModelSchema::csv

fn ModelSchema::csv(self : ModelSchema) -> String

Render a schema as CSV.

#
ModelSchema::defaults

fn ModelSchema::defaults(self : ModelSchema) -> Array[Int]

Return default values.

#
ModelSchema::describe

fn ModelSchema::describe(self : ModelSchema) -> String

Return a schema summary.

#
ModelSchema::field

fn ModelSchema::field(self : ModelSchema, id : Int) -> SchemaField

Read a field.

#
ModelSchema::find

fn ModelSchema::find(self : ModelSchema, name : String) -> SchemaField?

Find a field by name.

#
ModelSchema::length

fn ModelSchema::length(self : ModelSchema) -> Int

Return schema field count.

#
ModelSchema::names

fn ModelSchema::names(self : ModelSchema) -> Array[String]

Return field names.

#
ModelSchema::report

Return a schema report.

#
ModelSchema::signature

fn ModelSchema::signature(self : ModelSchema) -> Int

Return a stable schema signature.

#
ModelSchema::validate

fn ModelSchema::validate(self : ModelSchema, values : Array[Int]) -> ValidationReport

Validate values against the schema.

#
ModelSnapshot

pub struct ModelSnapshot {
domains : Array[Domain]
max_solutions : Int
search_config : SearchConfig
}

A reversible copy of the variable domains and search settings.

#
ModelSnapshot::describe

fn ModelSnapshot::describe(self : ModelSnapshot) -> String

Render the saved domain state.

#
ModelSnapshot::domain_of

fn ModelSnapshot::domain_of(self : ModelSnapshot, variable : Int) -> Domain

Return a copy of a saved domain.

#
ModelSnapshot::variable_count

fn ModelSnapshot::variable_count(self : ModelSnapshot) -> Int

Return the number of variables in a snapshot.

#
NQueens

pub struct NQueens {
solver : Solver
queens : Array[Int]
size : Int
}

A non-attacking N-Queens model.

#
NQueens::compact

fn NQueens::compact(self : NQueens, solution : Solution) -> String

Return a compact row-to-column representation.

#
NQueens::is_valid

fn NQueens::is_valid(self : NQueens, solution : Solution) -> Bool

Validate a complete N-Queens placement.

#
NQueens::queen_ids

fn NQueens::queen_ids(self : NQueens) -> Array[Int]

Return queen variables in row order.

#
NQueens::render

fn NQueens::render(self : NQueens, solution : Solution) -> String

Draw a placement with Q and . characters.

#
NQueens::solve

fn NQueens::solve(self : NQueens) -> Solution?

Solve N-Queens once.

#
NQueens::solve_all

fn NQueens::solve_all(self : NQueens, limit : Int) -> Array[Solution]

Enumerate up to limit placements.

#
NQueens::stats

fn NQueens::stats(self : NQueens) -> SearchStats

Return search counters.

#
NonogramLine

pub struct NonogramLine {
length : Int
clues : Array[Int]
}

Small exact puzzle models backed by finite-domain primitives.

These helpers are useful as regression fixtures as well as educational examples: a puzzle carries its dimensions and clues, generates legal line patterns, propagates forced cells, and exposes a stable verification path.

#
NonogramLine::matches

fn NonogramLine::matches(self : NonogramLine, cells : Array[Int]) -> Bool

Return whether a binary line satisfies this clue.

#
NonogramLine::minimum_used

fn NonogramLine::minimum_used(self : NonogramLine) -> Int

Return the minimum cells required by clues and separators.

#
NonogramLine::patterns

fn NonogramLine::patterns(self : NonogramLine) -> Array[Array[Int]]

Generate all legal binary patterns for a clue.

#
NonogramPuzzle

pub struct NonogramPuzzle {
rows : Array[NonogramLine]
columns : Array[NonogramLine]
cells : IntMatrix
}

A rectangular nonogram puzzle.

#
NonogramPuzzle::cell

fn NonogramPuzzle::cell(self : NonogramPuzzle, row : Int, column : Int) -> Int

Read a cell, or -1 when outside the puzzle.

#
NonogramPuzzle::column_count

fn NonogramPuzzle::column_count(self : NonogramPuzzle) -> Int

Read column count.

#
NonogramPuzzle::consistent

fn NonogramPuzzle::consistent(self : NonogramPuzzle) -> Bool

Return whether the current partial board can still satisfy clues.

#
NonogramPuzzle::fix

fn NonogramPuzzle::fix(self : NonogramPuzzle, row : Int, column : Int, value : Int) -> Bool

Fix a cell to empty or filled.

#
NonogramPuzzle::propagate

fn NonogramPuzzle::propagate(self : NonogramPuzzle) -> Int

Propagate forced cells from row and column pattern intersections.

#
NonogramPuzzle::render

fn NonogramPuzzle::render(self : NonogramPuzzle) -> String

Render a board with ? for unknown cells.

#
NonogramPuzzle::row_count

fn NonogramPuzzle::row_count(self : NonogramPuzzle) -> Int

Read puzzle dimensions.

#
NonogramPuzzle::solved

fn NonogramPuzzle::solved(self : NonogramPuzzle) -> Bool

Return whether every row and column is solved.

#
Objective

pub struct Objective {
terms : Array[ObjectiveTerm]
}

A multi-component objective used by application adapters.

#
Objective::best

fn Objective::best(self : Objective, solutions : Array[Solution]) -> Solution?

Return the preferred solution from a non-empty array.

#
Objective::describe

fn Objective::describe(self : Objective) -> String

Return a simple objective summary.

#
Objective::dominates

fn Objective::dominates(self : Objective, candidate : Solution, other : Solution) -> Bool

Return whether a solution dominates another over all objective terms.

#
Objective::is_better

fn Objective::is_better(self : Objective, candidate : Solution, incumbent : Solution) -> Bool

Return whether candidate is preferred to incumbent lexicographically.

#
Objective::pareto_front

fn Objective::pareto_front(self : Objective, solutions : Array[Solution]) -> Array[Solution]

Filter a solution set to its Pareto frontier.

#
Objective::score

fn Objective::score(self : Objective, solution : Solution) -> Int

Calculate a weighted scalar score.

#
Objective::terms

fn Objective::terms(self : Objective) -> Array[ObjectiveTerm]

Return objective terms.

#
Objective::then

fn Objective::then(self : Objective, variable : Int, direction : OptimizationDirection, weight : Int) -> Objective

Append a lower-priority objective component.

#
Objective::values

fn Objective::values(self : Objective, solution : Solution) -> Array[Int]

Return the tuple of objective values for a solution.

#
ObjectiveTerm

pub struct ObjectiveTerm {
variable : Int
direction : OptimizationDirection
weight : Int
}

One lexicographic objective component.

#
ObjectiveTerm::direction

Read an objective direction.

#
ObjectiveTerm::variable

fn ObjectiveTerm::variable(self : ObjectiveTerm) -> Int

Read an objective variable identifier.

#
ObjectiveTerm::weight

fn ObjectiveTerm::weight(self : ObjectiveTerm) -> Int

Read the objective weight.

#
OperationalLedger

pub struct OperationalLedger {
records : Array[OperationalRecord]
}

#
OperationalLedger::append

fn OperationalLedger::append(self : OperationalLedger, record : OperationalRecord) -> Bool

#
OperationalLedger::attempt_sum

fn OperationalLedger::attempt_sum(self : OperationalLedger) -> Int

#
OperationalLedger::clear

fn OperationalLedger::clear(self : OperationalLedger) -> Unit

#
OperationalLedger::contains

fn OperationalLedger::contains(self : OperationalLedger, key : String) -> Bool

#
OperationalLedger::count_failure

fn OperationalLedger::count_failure(self : OperationalLedger) -> Int

#
OperationalLedger::count_retryable

fn OperationalLedger::count_retryable(self : OperationalLedger) -> Int

#
OperationalLedger::count_state

fn OperationalLedger::count_state(self : OperationalLedger, state : OperationalState) -> Int

#
OperationalLedger::count_success

fn OperationalLedger::count_success(self : OperationalLedger) -> Int

#
OperationalLedger::count_terminal

fn OperationalLedger::count_terminal(self : OperationalLedger) -> Int

#
OperationalLedger::duration_sum

fn OperationalLedger::duration_sum(self : OperationalLedger) -> Int

#
OperationalLedger::error_codes

fn OperationalLedger::error_codes(self : OperationalLedger) -> Array[Int]

#
OperationalLedger::failure_rate

fn OperationalLedger::failure_rate(self : OperationalLedger) -> Int

#
OperationalLedger::filter_state

#
OperationalLedger::get

fn OperationalLedger::get(self : OperationalLedger, key : String) -> OperationalRecord?

#
OperationalLedger::index_of

fn OperationalLedger::index_of(self : OperationalLedger, key : String) -> Int?

#
OperationalLedger::is_empty

fn OperationalLedger::is_empty(self : OperationalLedger) -> Bool

#
OperationalLedger::keys

fn OperationalLedger::keys(self : OperationalLedger) -> Array[String]

#
OperationalLedger::len

fn OperationalLedger::len(self : OperationalLedger) -> Int

#
OperationalLedger::max_duration

fn OperationalLedger::max_duration(self : OperationalLedger) -> Int

#
OperationalLedger::min_duration

fn OperationalLedger::min_duration(self : OperationalLedger) -> Int?

#
OperationalLedger::output_sum

fn OperationalLedger::output_sum(self : OperationalLedger) -> Int

#
OperationalLedger::remove

fn OperationalLedger::remove(self : OperationalLedger, key : String) -> Bool

#
OperationalLedger::signature

fn OperationalLedger::signature(self : OperationalLedger) -> Int

#
OperationalLedger::success_rate

fn OperationalLedger::success_rate(self : OperationalLedger) -> Int

#
OperationalLedger::summary

#
OperationalLedger::throughput

fn OperationalLedger::throughput(self : OperationalLedger) -> Int

#
OperationalLedger::upsert

fn OperationalLedger::upsert(self : OperationalLedger, record : OperationalRecord) -> Bool

#
OperationalLedger::validate

fn OperationalLedger::validate(self : OperationalLedger) -> Bool

#
OperationalRecord

pub struct OperationalRecord {
key : String
state : OperationalState
started_at : Int
finished_at : Int
attempts : Int
output_count : Int
error_code : Int
}

A compact, serializable record for one operational job.

#
OperationalState

pub enum OperationalState {
LedgerQueued
LedgerRunning
LedgerSucceeded
LedgerFailed
LedgerSkipped
}

Lifecycle states used by long-running planning and validation jobs.

#
OperationalSummary

pub struct OperationalSummary {
total : Int
queued : Int
running : Int
succeeded : Int
failed : Int
skipped : Int
duration : Int
outputs : Int
attempts : Int
success_rate : Int
failure_rate : Int
throughput : Int
}

#
OptimizationDirection

pub enum OptimizationDirection {
MinimizeValue
MaximizeValue
} derive(Eq,
Debug
)

Direction used by optimization helpers.

#
OptimizationResult

pub struct OptimizationResult {
solution : Solution
objective : Int
} derive(
Debug
)

A result that includes both a solution and its measured objective value.

#
OptimizationResult::objective

fn OptimizationResult::objective(self : OptimizationResult) -> Int

Return the objective value.

#
OptimizationResult::solution

Return the optimized solution.

#
PlanningCapacityPoint

pub struct PlanningCapacityPoint {
resource : Int
time : Int
load : Int
capacity : Int
}

Planning utilities that bridge schedules, routes, and resource calendars.

These functions answer operational questions around a model—what is late, where is capacity tight, and which task should be moved—without changing the underlying solver representation.

#
PlanningCapacityPoint::overloaded

fn PlanningCapacityPoint::overloaded(self : PlanningCapacityPoint) -> Bool

Return whether overloaded.

#
PlanningCapacityPoint::residual

fn PlanningCapacityPoint::residual(self : PlanningCapacityPoint) -> Int

Return residual capacity.

#
PlanningDependency

pub struct PlanningDependency {
before : Int
after : Int
lag : Int
}

A precedence arc from one task to another.

#
PlanningDependency::after

fn PlanningDependency::after(self : PlanningDependency) -> Int

Read the successor.

#
PlanningDependency::before

fn PlanningDependency::before(self : PlanningDependency) -> Int

Read the predecessor.

#
PlanningDependency::lag

fn PlanningDependency::lag(self : PlanningDependency) -> Int

Read the minimum lag.

#
PlanningTask

pub struct PlanningTask {
id : Int
name : String
duration : Int
resource : Int
demand : Int
release : Int
due : Int
}

Project planning primitives for dependency-constrained work.

A planning task has a start variable, a fixed duration, an optional release time, a due date, and a resource demand. The API supports both a fast critical-path analysis and a Solver-backed schedule for exact checks.

#
PlanningTask::contains

fn PlanningTask::contains(self : PlanningTask, start : Int, time : Int) -> Bool

Return whether an interval contains a time point.

#
PlanningTask::demand

fn PlanningTask::demand(self : PlanningTask) -> Int

Read the resource demand.

#
PlanningTask::duration

fn PlanningTask::duration(self : PlanningTask) -> Int

Read the duration.

#
PlanningTask::id

fn PlanningTask::id(self : PlanningTask) -> Int

Read the task identifier.

#
PlanningTask::name

fn PlanningTask::name(self : PlanningTask) -> String

Read the task name.

#
PlanningTask::resource

fn PlanningTask::resource(self : PlanningTask) -> Int

Read the resource identifier.

#
PlanningTask::valid_window

fn PlanningTask::valid_window(self : PlanningTask) -> Bool

Return whether the time window is valid.

#
PlanningTask::with_window

fn PlanningTask::with_window(self : PlanningTask, release : Int, due : Int) -> PlanningTask

Return a task with a release and due window.

#
PortfolioAudit

pub struct PortfolioAudit {
candidates : Int
distinct : Int
retained : Int
pareto : Int
}

A deterministic search audit record.

#
PortfolioAudit::candidates

fn PortfolioAudit::candidates(self : PortfolioAudit) -> Int

Read candidate count.

#
PortfolioAudit::describe

fn PortfolioAudit::describe(self : PortfolioAudit) -> String

Return a stable audit summary.

#
PortfolioAudit::pareto

fn PortfolioAudit::pareto(self : PortfolioAudit) -> Int

Read Pareto count.

#
PortfolioAudit::retained

fn PortfolioAudit::retained(self : PortfolioAudit) -> Int

Read retained count.

#
PortfolioDirection

pub enum PortfolioDirection {
Minimize
Maximize
}

Solution portfolio and multi-objective selection utilities.

Finite-domain models frequently have several feasible schedules. This module keeps a bounded, duplicate-free portfolio, supports lexicographic and Pareto selection, and records deterministic search evidence for a CLI or benchmark report.

#
PortfolioObjectiveTerm

pub struct PortfolioObjectiveTerm {
name : String
direction : PortfolioDirection
weight : Int
}

A named objective component.

#
ProbeBatch

pub struct ProbeBatch {
results : Array[AssumptionResult]
}

A bounded sequence of temporary model probes.

#
ProbeBatch::describe

fn ProbeBatch::describe(self : ProbeBatch) -> String

Render a probe batch for regression logs.

#
ProbeBatch::length

fn ProbeBatch::length(self : ProbeBatch) -> Int

Number of recorded probes.

#
ProbeBatch::results

Return a copy of recorded probe results.

#
ProbeBatch::satisfiable_count

fn ProbeBatch::satisfiable_count(self : ProbeBatch) -> Int

Count satisfiable probes.

#
ProbeBatch::unsatisfiable_count

fn ProbeBatch::unsatisfiable_count(self : ProbeBatch) -> Int

Count unsatisfiable probes.

#
ProjectPlan

pub struct ProjectPlan {
solver : Solver
tasks : Array[PlanningTask]
starts : Array[Int]
dependencies : Array[PlanningDependency]
horizon : Int
capacities : Array[Int]
}

A project plan with an exact finite-domain start model.

#
ProjectPlan::add_dependency

fn ProjectPlan::add_dependency(self : ProjectPlan, before : Int, after : Int, lag : Int) -> Bool

Add a precedence relationship.

#
ProjectPlan::critical_path_length

fn ProjectPlan::critical_path_length(self : ProjectPlan) -> Int

Return the critical-path makespan.

#
ProjectPlan::critical_task_count

fn ProjectPlan::critical_task_count(self : ProjectPlan) -> Int

Return the number of critical tasks.

#
ProjectPlan::critical_tasks

fn ProjectPlan::critical_tasks(self : ProjectPlan) -> Array[Int]

Return all zero-slack tasks.

#
ProjectPlan::dependencies

fn ProjectPlan::dependencies(self : ProjectPlan) -> Array[PlanningDependency]

Read copied dependencies.

#
ProjectPlan::dependencies_valid

fn ProjectPlan::dependencies_valid(self : ProjectPlan) -> Bool

Return whether dependencies reference valid tasks.

#
ProjectPlan::describe

fn ProjectPlan::describe(self : ProjectPlan) -> String

Return a project summary for CLI diagnostics.

#
ProjectPlan::earliest_starts

fn ProjectPlan::earliest_starts(self : ProjectPlan) -> Array[Int]

Compute earliest feasible starts using a critical-path pass.

#
ProjectPlan::fix_start

fn ProjectPlan::fix_start(self : ProjectPlan, id : Int, start : Int) -> Bool

Add a fixed assignment for a task start.

#
ProjectPlan::has_cycle

fn ProjectPlan::has_cycle(self : ProjectPlan) -> Bool

Return whether the dependency network is acyclic.

#
ProjectPlan::horizon

fn ProjectPlan::horizon(self : ProjectPlan) -> Int

Read the planning horizon.

#
ProjectPlan::is_valid_schedule

fn ProjectPlan::is_valid_schedule(self : ProjectPlan, starts : Array[Int]) -> Bool

Return whether a concrete schedule is valid.

#
ProjectPlan::latest_starts

fn ProjectPlan::latest_starts(self : ProjectPlan) -> Array[Int]

Compute latest starts without extending the project horizon.

#
ProjectPlan::makespan

fn ProjectPlan::makespan(self : ProjectPlan, starts : Array[Int]) -> Int

Return a schedule's makespan.

#
ProjectPlan::maximum_demand

fn ProjectPlan::maximum_demand(self : ProjectPlan) -> Int

Return the maximum resource demand.

#
ProjectPlan::post_all_resource_non_overlap

fn ProjectPlan::post_all_resource_non_overlap(self : ProjectPlan) -> Unit

Add non-overlap constraints for every resource.

#
ProjectPlan::post_resource_non_overlap

fn ProjectPlan::post_resource_non_overlap(self : ProjectPlan, resource : Int) -> Bool

Add pairwise non-overlap constraints for a resource's tasks.

#
ProjectPlan::predecessors

fn ProjectPlan::predecessors(self : ProjectPlan, id : Int) -> Array[Int]

Return tasks that directly precede a task.

#
ProjectPlan::render

fn ProjectPlan::render(self : ProjectPlan, starts : Array[Int]) -> String

Return a stable task timeline.

#
ProjectPlan::resource_profile

fn ProjectPlan::resource_profile(self : ProjectPlan, starts : Array[Int], resource : Int) -> Array[Int]

Return resource usage at each time slot.

#
ProjectPlan::resource_utilization

fn ProjectPlan::resource_utilization(self : ProjectPlan, starts : Array[Int], resource : Int) -> Int

Return resource utilization in integer percentage points.

#
ProjectPlan::schedule

fn ProjectPlan::schedule(self : ProjectPlan, solution : Solution) -> Array[Int]

Extract start times from a solution.

#
ProjectPlan::signature

fn ProjectPlan::signature(self : ProjectPlan) -> Int

Return a stable plan fingerprint.

#
ProjectPlan::slacks

fn ProjectPlan::slacks(self : ProjectPlan) -> Array[Int]

Return task slack from earliest and latest passes.

#
ProjectPlan::solve

fn ProjectPlan::solve(self : ProjectPlan) -> Solution?

Solve the exact start model once.

#
ProjectPlan::solve_all

fn ProjectPlan::solve_all(self : ProjectPlan, limit : Int) -> Array[Solution]

Enumerate project schedules.

#
ProjectPlan::solver

fn ProjectPlan::solver(self : ProjectPlan) -> Solver

Return the underlying solver for application-specific constraints.

#
ProjectPlan::start_variable

fn ProjectPlan::start_variable(self : ProjectPlan, id : Int) -> Int

Read a start variable identifier.

#
ProjectPlan::stats

fn ProjectPlan::stats(self : ProjectPlan) -> SearchStats

Read the latest search statistics.

#
ProjectPlan::successors

fn ProjectPlan::successors(self : ProjectPlan, id : Int) -> Array[Int]

Return tasks that directly follow a task.

#
ProjectPlan::task

fn ProjectPlan::task(self : ProjectPlan, id : Int) -> PlanningTask

Read a task.

#
ProjectPlan::task_at

fn ProjectPlan::task_at(self : ProjectPlan, starts : Array[Int], resource : Int, time : Int) -> Int?

Return the first task that uses a resource at a time.

#
ProjectPlan::task_count

fn ProjectPlan::task_count(self : ProjectPlan) -> Int

Read the number of tasks.

#
ProjectPlan::tasks_on_resource

fn ProjectPlan::tasks_on_resource(self : ProjectPlan, resource : Int) -> Array[Int]

Return all task ids using a resource.

#
ProjectPlan::topological_order

fn ProjectPlan::topological_order(self : ProjectPlan) -> Array[Int]?

Return a topological task order, or None when dependencies cycle.

#
ProjectPlan::total_load

fn ProjectPlan::total_load(self : ProjectPlan) -> Int

Return total demand-time across all tasks.

#
ProjectPlan::total_work

fn ProjectPlan::total_work(self : ProjectPlan) -> Int

Return the total work across all tasks.

#
ProjectPlan::validate_schedule

fn ProjectPlan::validate_schedule(self : ProjectPlan, starts : Array[Int]) -> Array[String]

Validate a concrete schedule and return stable error codes.

#
PruningExplanation

pub struct PruningExplanation {
reasons : Array[PruningReason]
}

A collection of pruning reasons.

#
PruningExplanation::add

fn PruningExplanation::add(self : PruningExplanation, reason : PruningReason) -> Bool

Add a reason when not duplicated.

#
PruningExplanation::describe

fn PruningExplanation::describe(self : PruningExplanation) -> String

Render reasons.

#
PruningExplanation::explains

fn PruningExplanation::explains(self : PruningExplanation, variable : Int, value : Int) -> Bool

Return whether a value has an explanation.

#
PruningExplanation::for_variable

fn PruningExplanation::for_variable(self : PruningExplanation, variable : Int) -> Array[PruningReason]

Return reasons for one variable.

#
PruningExplanation::length

fn PruningExplanation::length(self : PruningExplanation) -> Int

Return reason count.

#
PruningReason

pub struct PruningReason {
variable : Int
value : Int
constraint : String
detail : String
}

A reason for a domain value removal.

#
QualityGateResult

pub struct QualityGateResult {
name : String
status : QualityStatus
observed : Int
threshold : Int
detail : String
}

One quality-gate result.

#
QualityGateResult::describe

fn QualityGateResult::describe(self : QualityGateResult) -> String

Return a stable line.

#
QualityGateResult::passed

fn QualityGateResult::passed(self : QualityGateResult) -> Bool

Return whether this gate passes.

#
QualityGateResult::status_name

fn QualityGateResult::status_name(self : QualityGateResult) -> String

Return a status label.

#
QualityReview

pub struct QualityReview {
results : Array[QualityGateResult]
}

A collection of quality-gate results.

#
QualityReview::add

fn QualityReview::add(self : QualityReview, result : QualityGateResult) -> Unit

Add a gate.

#
QualityReview::describe

fn QualityReview::describe(self : QualityReview) -> String

Render the review.

#
QualityReview::failure_count

fn QualityReview::failure_count(self : QualityReview) -> Int

Return failure count.

#
QualityReview::length

fn QualityReview::length(self : QualityReview) -> Int

Return gate count.

#
QualityReview::maximum

fn QualityReview::maximum(self : QualityReview, name : String, observed : Int, threshold : Int, detail : String) -> Unit

Add a maximum threshold gate.

#
QualityReview::minimum

fn QualityReview::minimum(self : QualityReview, name : String, observed : Int, threshold : Int, detail : String) -> Unit

Add a minimum threshold gate.

#
QualityReview::note

fn QualityReview::note(self : QualityReview, name : String, detail : String) -> Unit

Add a non-blocking informational warning.

#
QualityReview::passed

fn QualityReview::passed(self : QualityReview) -> Bool

Return whether the review passes.

#
QualityReview::require

fn QualityReview::require(self : QualityReview, name : String, condition : Bool, detail : String) -> Unit

Add a boolean gate.

#
QualityReview::results

Return copied results.

#
QualityReview::score

fn QualityReview::score(self : QualityReview) -> Int

Return a combined score where failures dominate.

#
QualityReview::signature

fn QualityReview::signature(self : QualityReview) -> Int

Return a stable review signature.

#
QualityReview::status_line

fn QualityReview::status_line(self : QualityReview) -> String

Return a concise review status.

#
QualityReview::warning_count

fn QualityReview::warning_count(self : QualityReview) -> Int

Return warning count.

#
QualityStatus

pub enum QualityStatus {
GatePassed
GateWarning
GateFailed
}

Application quality gates for local acceptance and regression checks.

Gates turn model-level invariants into a compact report: feasibility, coverage, deterministic signatures, and metric thresholds can be checked together before a CLI or CI job declares a scenario ready.

#
QueueSimulation

pub struct QueueSimulation {
horizon : Int
entities : Array[SimulationEntity]
queue : EventQueue
trace : Array[SimulationEvent]
next_sequence : Int
server_free : Int
total_wait : Int
completed : Int
}

A single-server queue simulation.

#
QueueSimulation::arrivals

fn QueueSimulation::arrivals(self : QueueSimulation) -> Array[Int]

Return all arrivals in id order.

#
QueueSimulation::average_wait

fn QueueSimulation::average_wait(self : QueueSimulation) -> Int

Return average waiting time.

#
QueueSimulation::completed

fn QueueSimulation::completed(self : QueueSimulation) -> Int

Return completed entity count.

#
QueueSimulation::current_time

fn QueueSimulation::current_time(self : QueueSimulation) -> Int

Return current simulation time.

#
QueueSimulation::describe

fn QueueSimulation::describe(self : QueueSimulation) -> String

Return a trace summary.

#
QueueSimulation::entity_trace

fn QueueSimulation::entity_trace(self : QueueSimulation, entity : Int) -> Array[SimulationEvent]

Return all events for one entity.

#
QueueSimulation::pending

fn QueueSimulation::pending(self : QueueSimulation) -> Int

Return queued entity count.

#
QueueSimulation::run

fn QueueSimulation::run(self : QueueSimulation) -> Int

Run until no event remains or the horizon is reached.

#
QueueSimulation::schedule

fn QueueSimulation::schedule(self : QueueSimulation, time : Int, entity : Int, resource : Int, kind : SimulationEventKind, payload : Int) -> Bool

Schedule an event.

#
QueueSimulation::schedule_maintenance

fn QueueSimulation::schedule_maintenance(self : QueueSimulation, start : Int, duration : Int) -> Bool

Schedule a maintenance block on the server.

#
QueueSimulation::service_times

fn QueueSimulation::service_times(self : QueueSimulation) -> Array[Int]

Return all service durations in id order.

#
QueueSimulation::signature

fn QueueSimulation::signature(self : QueueSimulation) -> Int

Return a stable simulation signature.

#
QueueSimulation::step

Process the next queued event.

#
QueueSimulation::total_wait

fn QueueSimulation::total_wait(self : QueueSimulation) -> Int

Return total waiting time.

#
QueueSimulation::trace

Return the event trace.

#
QueueSimulation::utilization

fn QueueSimulation::utilization(self : QueueSimulation) -> Int

Return a deterministic utilization percentage.

#
RecipeResult

pub struct RecipeResult {
posted : Int
rejected : Int
}

Constraint recipes for common operational rules.

#
RecipeResult::describe

fn RecipeResult::describe(self : RecipeResult) -> String

#
RecipeResult::ok

fn RecipeResult::ok(self : RecipeResult) -> Bool

#
RecipeResult::posted

fn RecipeResult::posted(self : RecipeResult) -> Int

#
RecipeResult::rejected

fn RecipeResult::rejected(self : RecipeResult) -> Int

#
RelationPair

pub struct RelationPair {
left : Int
right : Int
}

A tuple in a finite relation.

#
RelationTable

pub struct RelationTable {
arity : Int
rows : Array[Array[Int]]
}

A validated extensional relation that can be posted to a solver.

#
RelationTable::arity

fn RelationTable::arity(self : RelationTable) -> Int

Return relation arity.

#
RelationTable::column

fn RelationTable::column(self : RelationTable, index : Int) -> Array[Int]

Return the projection of one relation column.

#
RelationTable::compatible

fn RelationTable::compatible(self : RelationTable, partial : Array[Int?]) -> Array[Array[Int]]

Return the rows compatible with a partial tuple.

#
RelationTable::contains

fn RelationTable::contains(self : RelationTable, row : Array[Int]) -> Bool

Return whether a row occurs in the relation.

#
RelationTable::describe

fn RelationTable::describe(self : RelationTable) -> String

Render rows for diagnostics.

#
RelationTable::post

fn RelationTable::post(self : RelationTable, solver : Solver, variables : Array[Int]) -> Bool

Post this relation for a tuple of variables.

#
RelationTable::rows

fn RelationTable::rows(self : RelationTable) -> Array[Array[Int]]

Return a defensive copy of relation rows.

#
ResourceMetric

pub struct ResourceMetric {
resource : Int
capacity : Int
total_load : Int
peak_load : Int
busy_slots : Int
horizon : Int
}

Resource utilization and bottleneck metrics.

#
ResourceMetric::average_percent

fn ResourceMetric::average_percent(self : ResourceMetric) -> Int

Return average utilization percentage.

#
ResourceMetric::bottleneck_score

fn ResourceMetric::bottleneck_score(self : ResourceMetric) -> Int

Return a bottleneck score.

#
ResourceMetric::describe

fn ResourceMetric::describe(self : ResourceMetric) -> String

Return a stable metric line.

#
ResourceMetric::idle_slots

fn ResourceMetric::idle_slots(self : ResourceMetric) -> Int

Return idle slot count.

#
ResourceMetric::overloaded

fn ResourceMetric::overloaded(self : ResourceMetric) -> Bool

Return whether capacity is exceeded.

#
ResourceMetric::peak_percent

fn ResourceMetric::peak_percent(self : ResourceMetric) -> Int

Return peak utilization percentage.

#
ResourceSchedule

pub struct ResourceSchedule {
solver : Solver
tasks : Array[IntervalTask]
horizon : Int
capacity : Int
}

A resource-constrained schedule with optional capacity checks.

#
ResourceSchedule::add_flexible_task

fn ResourceSchedule::add_flexible_task(self : ResourceSchedule, name : String, duration : Int, demand : Int) -> Int?

Add an interval with a full-horizon start window.

#
ResourceSchedule::add_task

fn ResourceSchedule::add_task(self : ResourceSchedule, name : String, duration : Int, demand : Int, latest_start : Int) -> Int?

Add an interval task and return its index.

#
ResourceSchedule::avoid_window

fn ResourceSchedule::avoid_window(self : ResourceSchedule, window_start : Int, window_end : Int) -> Bool

Add an exclusive maintenance window to every task by fixing an allowed start range that lies entirely before or after the window.

#
ResourceSchedule::duration

fn ResourceSchedule::duration(self : ResourceSchedule, task : Int) -> Int

Return task duration.

#
ResourceSchedule::ends

fn ResourceSchedule::ends(self : ResourceSchedule, solution : Solution) -> Array[Int]

Return task end times from a solution.

#
ResourceSchedule::fix_start

fn ResourceSchedule::fix_start(self : ResourceSchedule, task : Int, start : Int) -> Bool

Set an exact task start.

#
ResourceSchedule::is_valid

fn ResourceSchedule::is_valid(self : ResourceSchedule, solution : Solution) -> Bool

Check every task and capacity slot in a complete schedule.

#
ResourceSchedule::load_profile

fn ResourceSchedule::load_profile(self : ResourceSchedule, solution : Solution) -> Array[Int]

Return a resource load profile.

#
ResourceSchedule::precede

fn ResourceSchedule::precede(self : ResourceSchedule, first : Int, second : Int) -> Bool

Add a precedence relation by tightening the successor start domain.

#
ResourceSchedule::render

fn ResourceSchedule::render(self : ResourceSchedule, solution : Solution) -> String

Render a Gantt-like one-line-per-task schedule.

#
ResourceSchedule::solve

Solve the resource schedule once.

#
ResourceSchedule::solve_all

fn ResourceSchedule::solve_all(self : ResourceSchedule, limit : Int) -> Array[Solution]

Enumerate up to limit schedules.

#
ResourceSchedule::start_variable

fn ResourceSchedule::start_variable(self : ResourceSchedule, task : Int) -> Int

Return the start variable for a task.

#
ResourceSchedule::starts

fn ResourceSchedule::starts(self : ResourceSchedule, solution : Solution) -> Array[Int]

Return all task starts from a solution.

#
ResourceSchedule::stats

Return statistics for the most recent solve.

#
ResourceSchedule::summary

fn ResourceSchedule::summary(self : ResourceSchedule) -> String

Return a stable task list summary.

#
ResourceSchedule::task_count

fn ResourceSchedule::task_count(self : ResourceSchedule) -> Int

Return the number of tasks.

#
ResourceSchedule::task_name

fn ResourceSchedule::task_name(self : ResourceSchedule, task : Int) -> String

Return task name.

#
ResourceTimeline

pub struct ResourceTimeline {
horizon : Int
capacities : Array[Int]
intervals : Array[TimelineInterval]
}

A collection of resource intervals.

#
ResourceTimeline::add

fn ResourceTimeline::add(self : ResourceTimeline, interval : TimelineInterval) -> Bool

Add an interval after bounds validation.

#
ResourceTimeline::conflicts

fn ResourceTimeline::conflicts(self : ResourceTimeline) -> Array[(Int, Int)]

Return all conflicting interval id pairs.

#
ResourceTimeline::contains_id

fn ResourceTimeline::contains_id(self : ResourceTimeline, id : Int) -> Bool

Return whether an id exists.

#
ResourceTimeline::feasible

fn ResourceTimeline::feasible(self : ResourceTimeline) -> Bool

Return whether all capacity rules hold.

#
ResourceTimeline::find_slot

fn ResourceTimeline::find_slot(self : ResourceTimeline, resource : Int, duration : Int) -> Int?

Return the earliest free slot of a requested duration.

#
ResourceTimeline::free_slots

fn ResourceTimeline::free_slots(self : ResourceTimeline, resource : Int) -> Array[(Int, Int)]

Return free time slots on one resource.

#
ResourceTimeline::length

fn ResourceTimeline::length(self : ResourceTimeline) -> Int

Return interval count.

#
ResourceTimeline::load_at

fn ResourceTimeline::load_at(self : ResourceTimeline, resource : Int, time : Int) -> Int

Return the load at one resource and time.

#
ResourceTimeline::makespan

fn ResourceTimeline::makespan(self : ResourceTimeline) -> Int

Return the latest occupied time.

#
ResourceTimeline::on_resource

fn ResourceTimeline::on_resource(self : ResourceTimeline, resource : Int) -> Array[TimelineInterval]

Return intervals on one resource.

#
ResourceTimeline::ordered

fn ResourceTimeline::ordered(self : ResourceTimeline, resource : Int) -> Array[TimelineInterval]

Return intervals sorted by start time.

#
ResourceTimeline::overloads

fn ResourceTimeline::overloads(self : ResourceTimeline, resource : Int) -> Array[Int]

Return all overload time points on a resource.

#
ResourceTimeline::profile

fn ResourceTimeline::profile(self : ResourceTimeline, resource : Int) -> Array[Int]

Return a resource load profile.

#
ResourceTimeline::render

fn ResourceTimeline::render(self : ResourceTimeline) -> String

Render resource intervals.

#
ResourceTimeline::signature

fn ResourceTimeline::signature(self : ResourceTimeline) -> Int

Return a stable timeline fingerprint.

#
ResourceTimeline::total_work

fn ResourceTimeline::total_work(self : ResourceTimeline) -> Int

Return total work.

#
ResourceTimeline::utilization

fn ResourceTimeline::utilization(self : ResourceTimeline, resource : Int) -> Int

Return weighted utilization in integer percentage points.

#
ResultCounter

pub struct ResultCounter {
accepted : Int
rejected : Int
}

Small result helpers shared by CLI integrations.

#
ResultCounter::accept

fn ResultCounter::accept(self : ResultCounter, value : Bool) -> Bool

#
ResultCounter::describe

fn ResultCounter::describe(self : ResultCounter) -> String

#
ResultCounter::passed

fn ResultCounter::passed(self : ResultCounter) -> Bool

#
ResultCounter::success_rate

fn ResultCounter::success_rate(self : ResultCounter) -> Int

#
ResultCounter::total

fn ResultCounter::total(self : ResultCounter) -> Int

#
RiskBand

pub enum RiskBand {
LowRisk
MediumRisk
HighRisk
CriticalRisk
}

Integer risk and sensitivity models for planning decisions.

Risk scores are explicit integer products of likelihood and impact. The model is small enough for CI scenario checks and structured enough to feed objective terms or an acceptance report.

#
RiskItem

pub struct RiskItem {
id : Int
name : String
likelihood : Int
impact : Int
mitigation : Int
}

A risk item.

#
RiskItem::gross_score

fn RiskItem::gross_score(self : RiskItem) -> Int

Return gross risk score.

#
RiskItem::residual_score

fn RiskItem::residual_score(self : RiskItem) -> Int

Return residual risk after mitigation.

#
RiskScenario

pub struct RiskScenario {
items : Array[RiskItem]
budget : Int
}

A scenario with risk items and a resource budget.

#
RiskScenario::above

fn RiskScenario::above(self : RiskScenario, threshold : Int) -> Array[Int]

Return items above a threshold.

#
RiskScenario::band_counts

fn RiskScenario::band_counts(self : RiskScenario) -> Array[Int]

Return the band distribution.

#
RiskScenario::describe

fn RiskScenario::describe(self : RiskScenario) -> String

Return a stable scenario summary.

#
RiskScenario::gross_score

fn RiskScenario::gross_score(self : RiskScenario) -> Int

Return total gross risk.

#
RiskScenario::maximum_residual

fn RiskScenario::maximum_residual(self : RiskScenario) -> Int

Return highest residual risk.

#
RiskScenario::mitigate

fn RiskScenario::mitigate(self : RiskScenario, id : Int, amount : Int) -> Bool

Apply extra mitigation to one item.

#
RiskScenario::mitigation_value

fn RiskScenario::mitigation_value(self : RiskScenario, id : Int, amount : Int) -> Int

Return marginal score reduction for mitigation.

#
RiskScenario::priority_order

fn RiskScenario::priority_order(self : RiskScenario) -> Array[Int]

Return a priority order by residual risk.

#
RiskScenario::residual_score

fn RiskScenario::residual_score(self : RiskScenario) -> Int

Return total residual risk.

#
RiskScenario::signature

fn RiskScenario::signature(self : RiskScenario) -> Int

Return a scenario fingerprint.

#
RosterModel

pub struct RosterModel {
solver : Solver
assignments : Array[Array[Int]]
workers : Int
days : Int
shifts : Int
}

A worker/day/shift roster template built on the generic solver.

#
RosterModel::configure

fn RosterModel::configure(self : RosterModel, config : SearchConfig) -> Unit

Configure the underlying search engine.

#
RosterModel::coverage

fn RosterModel::coverage(self : RosterModel, solution : Solution) -> Array[Array[Int]]

Return a day/shift coverage matrix.

#
RosterModel::day_count

fn RosterModel::day_count(self : RosterModel) -> Int

Return the day count.

#
RosterModel::day_variables

fn RosterModel::day_variables(self : RosterModel, day : Int) -> Array[Int]

Return all variables for a day.

#
RosterModel::fingerprint

fn RosterModel::fingerprint(self : RosterModel, solution : Solution) -> String

Return a stable roster fingerprint.

#
RosterModel::fix

fn RosterModel::fix(self : RosterModel, worker : Int, day : Int, shift : Int) -> Bool

Fix one worker/day assignment.

#
RosterModel::is_valid

fn RosterModel::is_valid(self : RosterModel, solution : Solution) -> Bool

Check a solution against every roster constraint.

#
RosterModel::post_daily_cover

fn RosterModel::post_daily_cover(self : RosterModel, required : Array[Array[Int]]) -> Unit

Require exact worker coverage for each day and shift.

#
RosterModel::post_daily_different

fn RosterModel::post_daily_different(self : RosterModel, day : Int) -> Unit

Require every worker to have a different shift on a day.

#
RosterModel::post_no_consecutive_shift

fn RosterModel::post_no_consecutive_shift(self : RosterModel, worker : Int) -> Unit

Require adjacent assignments for one worker to use different shifts.

#
RosterModel::post_pair_different

fn RosterModel::post_pair_different(self : RosterModel, first : Int, second : Int) -> Unit

Prevent the same pair of workers from sharing a shift on a day.

#
RosterModel::post_worker_interval

fn RosterModel::post_worker_interval(self : RosterModel, worker : Int, lower_shift : Int, upper_shift : Int, minimum : Int, maximum : Int) -> Unit

Bound a worker's number of assignments in a shift interval.

#
RosterModel::post_worker_shift_bounds

fn RosterModel::post_worker_shift_bounds(self : RosterModel, worker : Int, shift : Int, minimum : Int, maximum : Int) -> Unit

Bound how often a worker may receive a shift type.

#
RosterModel::post_worker_window_different

fn RosterModel::post_worker_window_different(self : RosterModel, worker : Int, width : Int) -> Unit

Require different shifts within a worker's rolling window.

#
RosterModel::render

fn RosterModel::render(self : RosterModel, solution : Solution) -> String

Render the roster as a stable worker-major table.

#
RosterModel::score

fn RosterModel::score(self : RosterModel, solution : Solution) -> RosterScore

Score a valid or partial roster using observable structural counters.

#
RosterModel::shift_count

fn RosterModel::shift_count(self : RosterModel) -> Int

Return the number of shifts.

#
RosterModel::shift_count_for

fn RosterModel::shift_count_for(self : RosterModel, solution : Solution, worker : Int, shift : Int) -> Int

Count a shift for one worker.

#
RosterModel::solve

fn RosterModel::solve(self : RosterModel) -> Solution?

Solve one roster.

#
RosterModel::solve_all

fn RosterModel::solve_all(self : RosterModel, limit : Int) -> Array[Solution]

Enumerate rosters up to a limit.

#
RosterModel::stats

fn RosterModel::stats(self : RosterModel) -> SearchStats

Return the latest search statistics.

#
RosterModel::values

fn RosterModel::values(self : RosterModel, solution : Solution) -> Array[Array[Int]]

Read all assignments in worker-major order.

#
RosterModel::variable

fn RosterModel::variable(self : RosterModel, worker : Int, day : Int) -> Int

Return a worker/day variable id.

#
RosterModel::worker_count

fn RosterModel::worker_count(self : RosterModel) -> Int

Return the worker count.

#
RosterModel::worker_values

fn RosterModel::worker_values(self : RosterModel, solution : Solution, worker : Int) -> Array[Int]

Read one worker's assignments.

#
RosterModel::worker_variables

fn RosterModel::worker_variables(self : RosterModel, worker : Int) -> Array[Int]

Return all variables for a worker.

#
RosterModel::workload_spread

fn RosterModel::workload_spread(self : RosterModel, solution : Solution) -> Int

Compute the largest worker workload difference across shifts.

#
RosterScore

pub struct RosterScore {
spread : Int
violations : Int
coverage_total : Int
}

A compact roster quality score.

#
RosterScore::coverage_total

fn RosterScore::coverage_total(self : RosterScore) -> Int

Return the number of assigned worker/day cells represented by coverage.

#
RosterScore::describe

fn RosterScore::describe(self : RosterScore) -> String

Render a roster score.

#
RosterScore::spread

fn RosterScore::spread(self : RosterScore) -> Int

Return the worker workload spread.

#
RosterScore::violations

fn RosterScore::violations(self : RosterScore) -> Int

Return the number of detected violations.

#
RoutingInstance

pub struct RoutingInstance {
points : Array[RoutingPoint]
depot : Int
vehicles : Int
capacities : Array[Int]
distances : Array[Array[Int]]
}

A validated routing instance with an integer distance matrix.

#
RoutingInstance::capacity

fn RoutingInstance::capacity(self : RoutingInstance, vehicle : Int) -> Int

Read one vehicle capacity.

#
RoutingInstance::customers

fn RoutingInstance::customers(self : RoutingInstance) -> Array[Int]

Return all customer identifiers, excluding the depot.

#
RoutingInstance::depot

fn RoutingInstance::depot(self : RoutingInstance) -> Int

Return the depot location identifier.

#
RoutingInstance::distance

fn RoutingInstance::distance(self : RoutingInstance, from : Int, to : Int) -> Int

Return the directed distance between two locations.

#
RoutingInstance::location_count

fn RoutingInstance::location_count(self : RoutingInstance) -> Int

Number of locations including the depot.

#
RoutingInstance::point

fn RoutingInstance::point(self : RoutingInstance, id : Int) -> RoutingPoint

Read one point.

#
RoutingInstance::total_demand

fn RoutingInstance::total_demand(self : RoutingInstance) -> Int

Return the total demand of all customers.

#
RoutingInstance::vehicle_count

fn RoutingInstance::vehicle_count(self : RoutingInstance) -> Int

Number of vehicles.

#
RoutingPlan

pub struct RoutingPlan {
routes : Array[VehicleRoute]
}

A complete multi-vehicle plan.

#
RoutingPlan::append

fn RoutingPlan::append(self : RoutingPlan, vehicle : Int, stop : Int) -> Bool

Append a stop to a vehicle route.

#
RoutingPlan::describe

fn RoutingPlan::describe(self : RoutingPlan) -> String

Return a stable route string useful for logs and benchmark snapshots.

#
RoutingPlan::locate

fn RoutingPlan::locate(self : RoutingPlan, stop : Int) -> (Int, Int)?

Locate a customer in the plan, returning vehicle and position.

#
RoutingPlan::route

fn RoutingPlan::route(self : RoutingPlan, vehicle : Int) -> VehicleRoute

Read a route.

#
RoutingPlan::route_count

fn RoutingPlan::route_count(self : RoutingPlan) -> Int

Read the number of routes.

#
RoutingPlan::routes

fn RoutingPlan::routes(self : RoutingPlan) -> Array[VehicleRoute]

Return copied routes.

#
RoutingPlan::visited

fn RoutingPlan::visited(self : RoutingPlan) -> Array[Int]

Return all visits in vehicle order.

#
RoutingPoint

pub struct RoutingPoint {
id : Int
x : Int
y : Int
demand : Int
service : Int
ready : Int
due : Int
}

A finite-domain friendly vehicle-routing toolkit.

The routing layer deliberately keeps the data representation compact and deterministic. It is useful before a full solver model is posted: a planner can validate input, construct a feasible seed plan, measure it, and then use the resulting route as a warm start for a richer model.

#
RoutingPoint::demand

fn RoutingPoint::demand(self : RoutingPoint) -> Int

Read the demand.

#
RoutingPoint::id

fn RoutingPoint::id(self : RoutingPoint) -> Int

Read the stable customer identifier.

#
RoutingPoint::service

fn RoutingPoint::service(self : RoutingPoint) -> Int

Read the service duration.

#
RoutingPoint::valid_window

fn RoutingPoint::valid_window(self : RoutingPoint) -> Bool

Return whether a point has a valid time window.

#
RoutingPoint::with_service

fn RoutingPoint::with_service(self : RoutingPoint, service : Int) -> RoutingPoint

Return a copy with a service duration.

#
RoutingPoint::with_window

fn RoutingPoint::with_window(self : RoutingPoint, ready : Int, due : Int) -> RoutingPoint

Return a copy with a time window.

#
RoutingPoint::x

fn RoutingPoint::x(self : RoutingPoint) -> Int

Read the horizontal coordinate.

#
RoutingPoint::y

fn RoutingPoint::y(self : RoutingPoint) -> Int

Read the vertical coordinate.

#
RoutingReport

pub struct RoutingReport {
distance : Int
makespan : Int
load : Int
visits : Int
errors : Array[String]
}

Compact quality report for a routing plan.

#
RoutingReport::describe

fn RoutingReport::describe(self : RoutingReport) -> String

Return a stable summary string.

#
RoutingReport::distance

fn RoutingReport::distance(self : RoutingReport) -> Int

Read the travel distance.

#
RoutingReport::feasible

fn RoutingReport::feasible(self : RoutingReport) -> Bool

Return whether a report is feasible.

#
RoutingReport::load

fn RoutingReport::load(self : RoutingReport) -> Int

Read the served load.

#
RoutingReport::makespan

fn RoutingReport::makespan(self : RoutingReport) -> Int

Read the route makespan.

#
RoutingReport::visits

fn RoutingReport::visits(self : RoutingReport) -> Int

Read the visit count.

#
Scenario

pub struct Scenario {
name : String
solver : Solver
expected_solutions : Int
}

A named reusable model scenario for demos and acceptance smoke tests.

#
Scenario::expected

fn Scenario::expected(self : Scenario) -> Int

Read expected solution count.

#
Scenario::matches

fn Scenario::matches(self : Scenario, solutions : Array[Solution]) -> Bool

Return whether the observed count matches the expected count.

#
Scenario::name

fn Scenario::name(self : Scenario) -> String

Read a scenario name.

#
Scenario::solve

fn Scenario::solve(self : Scenario, limit : Int) -> Array[Solution]

Solve a scenario with a cap.

#
Scenario::stats

fn Scenario::stats(self : Scenario) -> SearchStats

Read scenario statistics.

#
ScenarioAxis

pub struct ScenarioAxis {
name : String
values : Array[Int]
}

A parameter axis for Cartesian scenario generation.

#
ScenarioEvaluation

pub struct ScenarioEvaluation {
scenario : WhatIfScenario
score : Int
feasible : Bool
}

A scenario evaluation.

#
ScenarioEvaluation::feasible

fn ScenarioEvaluation::feasible(self : ScenarioEvaluation) -> Bool

Return whether evaluation is feasible.

#
ScenarioEvaluation::name

fn ScenarioEvaluation::name(self : ScenarioEvaluation) -> String

Return scenario name.

#
ScenarioEvaluation::score

fn ScenarioEvaluation::score(self : ScenarioEvaluation) -> Int

Return score.

#
ScenarioValue

pub struct ScenarioValue {
name : String
value : Int
}

Deterministic scenario generation for what-if model validation.

A scenario is a named vector of integer parameters. The engine supports bounded Cartesian expansion, overrides, deltas, and reproducible scoring; it is useful for capacity planning and regression matrices in CI.

#
SchedulePreference

pub struct SchedulePreference {
day : Int
shift : Int
preferred_person : Int
penalty : Int
}

A small weighted preference used by application code to rank schedules.

#
ScheduleProblem

pub struct ScheduleProblem {
solver : Solver
slots : Array[Int]
people : Int
days : Int
shifts_per_day : Int
minimum_load : Int
maximum_load : Int
}

A compact multi-day staff scheduling model.

Each slot is an integer variable containing the assigned worker. The builder adds per-day uniqueness, workload bounds, and optional rotation constraints while leaving the model open for application-specific rules.

#
ScheduleProblem::assignments

fn ScheduleProblem::assignments(self : ScheduleProblem, solution : Solution) -> Array[Array[Int]]

Convert a solution to a day-by-day integer matrix.

#
ScheduleProblem::avoid_pair

fn ScheduleProblem::avoid_pair(self : ScheduleProblem, first : Int, second : Int) -> Bool

Add a rule that two workers cannot share a day.

#
ScheduleProblem::avoid_same_shift

fn ScheduleProblem::avoid_same_shift(self : ScheduleProblem, shift : Int) -> Bool

Add a rule that the same shift rotates between consecutive days.

#
ScheduleProblem::fix

fn ScheduleProblem::fix(self : ScheduleProblem, day : Int, shift : Int, person : Int) -> Bool

Add an exact assignment for one day and shift.

#
ScheduleProblem::is_complete

fn ScheduleProblem::is_complete(self : ScheduleProblem, solution : Solution) -> Bool

Return whether an assignment covers every slot exactly once.

#
ScheduleProblem::maximum_load

fn ScheduleProblem::maximum_load(self : ScheduleProblem) -> Int

Read the configured workload upper bound.

#
ScheduleProblem::minimum_load

fn ScheduleProblem::minimum_load(self : ScheduleProblem) -> Int

Read the configured workload lower bound.

#
ScheduleProblem::render

fn ScheduleProblem::render(self : ScheduleProblem, solution : Solution) -> String

Render a solution as a stable, human-readable grid.

#
ScheduleProblem::score

fn ScheduleProblem::score(self : ScheduleProblem, solution : Solution, preferences : Array[SchedulePreference]) -> Int

Score a solution by summing penalties for preference violations.

#
ScheduleProblem::slot

fn ScheduleProblem::slot(self : ScheduleProblem, day : Int, shift : Int) -> Int

Return a slot variable identifier.

#
ScheduleProblem::slot_ids

fn ScheduleProblem::slot_ids(self : ScheduleProblem) -> Array[Int]

Return all slot identifiers in day-major order.

#
ScheduleProblem::solve

Solve the schedule once.

#
ScheduleProblem::solve_all

fn ScheduleProblem::solve_all(self : ScheduleProblem, limit : Int) -> Array[Solution]

Enumerate schedule solutions.

#
ScheduleProblem::solver

fn ScheduleProblem::solver(self : ScheduleProblem) -> Solver

Return the underlying model for additional constraints.

#
ScheduleProblem::stats

Return solver counters for the most recent schedule solve.

#
SchemaField

pub struct SchemaField {
id : Int
name : String
lower : Int
upper : Int
default : Int
}

Schema helpers for named finite-domain models.

A schema is a stable, serializable view of variables and defaults. It is useful for CLI forms, configuration validation, and checking that a saved solution still matches the model shape after a library upgrade.

#
SchemaField::domain

fn SchemaField::domain(self : SchemaField) -> Domain

Return its finite domain.

#
SchemaField::valid

fn SchemaField::valid(self : SchemaField) -> Bool

Return whether the field is valid.

#
ScoredSolution

pub struct ScoredSolution {
solution : Solution
score : Int
rank : Int
}

A score paired with a solution for reporting and ranking.

#
ScoredSolution::describe

fn ScoredSolution::describe(self : ScoredSolution) -> String

Return a stable score report.

#
ScoredSolution::rank

fn ScoredSolution::rank(self : ScoredSolution) -> Int

Return the one-based display rank.

#
ScoredSolution::score

fn ScoredSolution::score(self : ScoredSolution) -> Int

Return the scalar score.

#
ScoredSolution::solution

fn ScoredSolution::solution(self : ScoredSolution) -> Solution

Return the underlying solution.

#
SearchConfig

pub struct SearchConfig {
max_solutions : Int
variable_heuristic : VariableHeuristic
value_heuristic : ValueHeuristic
propagation_rounds : Int
enable_learning : Bool
node_limit : Int
} derive(
Debug
)

Search behavior that is stable across all supported backends.

#
SearchConfig::choose_values

fn SearchConfig::choose_values(self : SearchConfig, heuristic : ValueHeuristic) -> SearchConfig

Select a value ordering heuristic.

#
SearchConfig::choose_variables

fn SearchConfig::choose_variables(self : SearchConfig, heuristic : VariableHeuristic) -> SearchConfig

Select a variable heuristic.

#
SearchConfig::learning

fn SearchConfig::learning(self : SearchConfig, enabled : Bool) -> SearchConfig

Enable or disable lightweight conflict learning.

#
SearchConfig::limit

fn SearchConfig::limit(self : SearchConfig, count : Int) -> SearchConfig

Set the solution limit.

#
SearchConfig::node_budget

fn SearchConfig::node_budget(self : SearchConfig, nodes : Int) -> SearchConfig

Cap visited search nodes for interactive or service workloads.

#
SearchConfig::round_limit

fn SearchConfig::round_limit(self : SearchConfig, rounds : Int) -> SearchConfig

Set the maximum number of propagation rounds at one search node.

#
SearchStats

pub struct SearchStats {
nodes : Int
failures : Int
propagations : Int
constraint_checks : Int
pruned_values : Int
solutions : Int
maximum_depth : Int
restarts : Int
learned_conflicts : Int
truncated : Bool
} derive(
Debug
)

Counters collected by the solver during the most recent run.

#
SearchStats::check_count

fn SearchStats::check_count(self : SearchStats) -> Int

Number of individual constraint evaluations.

#
SearchStats::depth

fn SearchStats::depth(self : SearchStats) -> Int

Maximum recursion depth reached.

#
SearchStats::describe

fn SearchStats::describe(self : SearchStats) -> String

Render statistics as stable key-value output for CI and benchmarks.

#
SearchStats::failure_count

fn SearchStats::failure_count(self : SearchStats) -> Int

Number of rejected branches.

#
SearchStats::is_truncated

fn SearchStats::is_truncated(self : SearchStats) -> Bool

Whether a node or propagation budget stopped the search.

#
SearchStats::node_count

fn SearchStats::node_count(self : SearchStats) -> Int

Number of visited search nodes.

#
SearchStats::propagation_count

fn SearchStats::propagation_count(self : SearchStats) -> Int

Number of domain propagation passes.

#
SearchStats::pruned_count

fn SearchStats::pruned_count(self : SearchStats) -> Int

Number of values removed by propagation.

#
SearchStats::solution_count

fn SearchStats::solution_count(self : SearchStats) -> Int

Number of solutions found.

#
SequenceModel

pub struct SequenceModel {
solver : Solver
values : Array[Int]
length : Int
lower : Int
upper : Int
}

A reusable finite-domain sequence model. It is useful for quotas, transition planning, configuration strings and small scheduling horizons.

#
SequenceModel::configure

fn SequenceModel::configure(self : SequenceModel, config : SearchConfig) -> Unit

Set the search configuration.

#
SequenceModel::domain_of

fn SequenceModel::domain_of(self : SequenceModel, position : Int) -> Domain

Return the current domain of a sequence position.

#
SequenceModel::fingerprint

fn SequenceModel::fingerprint(self : SequenceModel, solution : Solution) -> String

Return a compact sequence fingerprint.

#
SequenceModel::fix

fn SequenceModel::fix(self : SequenceModel, position : Int, value : Int) -> Bool

Bind a position to a constant value.

#
SequenceModel::is_valid

fn SequenceModel::is_valid(self : SequenceModel, solution : Solution) -> Bool

Check a solution against the sequence model.

#
SequenceModel::length

fn SequenceModel::length(self : SequenceModel) -> Int

Return the number of positions.

#
SequenceModel::lower_bound

fn SequenceModel::lower_bound(self : SequenceModel) -> Int

Return the value lower bound.

#
SequenceModel::post_allowed_values

fn SequenceModel::post_allowed_values(self : SequenceModel, allowed : Array[Int]) -> Unit

Restrict every sequence position to an explicit finite set.

#
SequenceModel::post_at_least_count

fn SequenceModel::post_at_least_count(self : SequenceModel, value : Int, count : Int) -> Unit

Require at least count positions to contain value.

#
SequenceModel::post_at_most_count

fn SequenceModel::post_at_most_count(self : SequenceModel, value : Int, count : Int) -> Unit

Require at most count positions to contain value.

#
SequenceModel::post_constant_step

fn SequenceModel::post_constant_step(self : SequenceModel, distance_value : Int) -> Unit

Require every adjacent difference to equal distance.

#
SequenceModel::post_edge_transitions

fn SequenceModel::post_edge_transitions(self : SequenceModel, tables : Array[Array[Array[Int]]]) -> Unit

Allow a different transition table at each edge.

#
SequenceModel::post_exact_count

fn SequenceModel::post_exact_count(self : SequenceModel, value : Int, count : Int) -> Unit

Require exactly count positions to contain value.

#
SequenceModel::post_no_adjacent_equal

fn SequenceModel::post_no_adjacent_equal(self : SequenceModel) -> Unit

Require consecutive positions to differ.

#
SequenceModel::post_nondecreasing

fn SequenceModel::post_nondecreasing(self : SequenceModel) -> Unit

Require a nondecreasing sequence.

#
SequenceModel::post_run_limit

fn SequenceModel::post_run_limit(self : SequenceModel, maximum_run : Int) -> Unit

Bound the length of every same-value run.

#
SequenceModel::post_strictly_increasing

fn SequenceModel::post_strictly_increasing(self : SequenceModel) -> Unit

Require a strictly increasing sequence.

#
SequenceModel::post_sum

fn SequenceModel::post_sum(self : SequenceModel, target : Int) -> Unit

Post an exact weighted sum over all sequence values.

#
SequenceModel::post_sum_between

fn SequenceModel::post_sum_between(self : SequenceModel, minimum : Int, maximum : Int) -> Unit

Restrict the total sequence sum to an inclusive interval.

#
SequenceModel::post_transitions

fn SequenceModel::post_transitions(self : SequenceModel, transitions : Array[Array[Int]]) -> Unit

Allow only the supplied adjacent transition pairs.

#
SequenceModel::post_window_count

fn SequenceModel::post_window_count(self : SequenceModel, width : Int, value : Int, count : Int) -> Unit

Require a window to contain exactly count occurrences of value.

#
SequenceModel::post_window_sum

fn SequenceModel::post_window_sum(self : SequenceModel, width : Int, target : Int) -> Unit

Require a window to have an exact sum at every start position.

#
SequenceModel::post_window_table

fn SequenceModel::post_window_table(self : SequenceModel, width : Int, rows : Array[Array[Int]]) -> Unit

Post a table relation over one or more consecutive windows.

#
SequenceModel::render

fn SequenceModel::render(self : SequenceModel, solution : Solution) -> String

Render a sequence as a space-separated row.

#
SequenceModel::solution_summary

fn SequenceModel::solution_summary(self : SequenceModel, solution : Solution) -> SequenceSummary?

Return every value used by a complete solution.

#
SequenceModel::solve

fn SequenceModel::solve(self : SequenceModel) -> Solution?

Solve for one sequence.

#
SequenceModel::solve_all

fn SequenceModel::solve_all(self : SequenceModel, limit : Int) -> Array[Solution]

Enumerate up to limit sequences.

#
SequenceModel::stats

Return the latest search statistics.

#
SequenceModel::upper_bound

fn SequenceModel::upper_bound(self : SequenceModel) -> Int

Return the value upper bound.

#
SequenceModel::values_of

fn SequenceModel::values_of(self : SequenceModel, solution : Solution) -> Array[Int]

Extract sequence values from a solution.

#
SequenceModel::variables

fn SequenceModel::variables(self : SequenceModel) -> Array[Int]

Return a copy of sequence variable identifiers.

#
SequenceReport

pub struct SequenceReport {
length : Int
minimum : Int
maximum : Int
transitions : Int
runs : Int
checksum : Int
}

Sequence analytics for traces, rosters, and solver decisions.

The routines are allocation-conscious for small integer traces and expose stable edit, transition, run, and normalization metrics used by diagnostics.

#
SequenceReport::describe

fn SequenceReport::describe(self : SequenceReport) -> String

Return a stable sequence summary.

#
SequenceSummary

pub struct SequenceSummary {
values : Array[Int]
total : Int
minimum : Int
maximum : Int
changes : Int
runs : Int
} derive(Eq,
Debug
)

Summary statistics for a complete sequence.

#
SequenceSummary::changes

fn SequenceSummary::changes(self : SequenceSummary) -> Int

Return the number of adjacent changes.

#
SequenceSummary::describe

fn SequenceSummary::describe(self : SequenceSummary) -> String

Render a sequence summary.

#
SequenceSummary::maximum

fn SequenceSummary::maximum(self : SequenceSummary) -> Int

Return the maximum.

#
SequenceSummary::minimum

fn SequenceSummary::minimum(self : SequenceSummary) -> Int

Return the minimum.

#
SequenceSummary::runs

fn SequenceSummary::runs(self : SequenceSummary) -> Int

Return the number of same-value runs.

#
SequenceSummary::total

fn SequenceSummary::total(self : SequenceSummary) -> Int

Return the sum.

#
SequenceSummary::values

fn SequenceSummary::values(self : SequenceSummary) -> Array[Int]

Return the values in a sequence summary.

#
ServiceMetrics

pub struct ServiceMetrics {
orders : Int
on_time : Int
late : Int
total_lateness : Int
maximum_lateness : Int
quantity : Int
cost : Int
}

A service-level aggregate.

#
ServiceMetrics::average_lateness

fn ServiceMetrics::average_lateness(self : ServiceMetrics) -> Int

Return average lateness.

#
ServiceMetrics::describe

fn ServiceMetrics::describe(self : ServiceMetrics) -> String

Return a stable metrics line.

#
ServiceMetrics::late_percent

fn ServiceMetrics::late_percent(self : ServiceMetrics) -> Int

Return late percentage.

#
ServiceMetrics::meets_target

fn ServiceMetrics::meets_target(self : ServiceMetrics, target_percent : Int) -> Bool

Return whether a target service level is met.

#
ServiceMetrics::on_time_percent

fn ServiceMetrics::on_time_percent(self : ServiceMetrics) -> Int

Return on-time percentage.

#
ServiceObservation

pub struct ServiceObservation {
id : Int
promised : Int
actual : Int
quantity : Int
penalty : Int
}

Service-level metrics for operational plans.

#
ServiceObservation::cost

fn ServiceObservation::cost(self : ServiceObservation) -> Int

Return weighted lateness penalty.

#
ServiceObservation::describe

fn ServiceObservation::describe(self : ServiceObservation) -> String

Return a stable observation line.

#
ServiceObservation::earliness

fn ServiceObservation::earliness(self : ServiceObservation) -> Int

Return earliness.

#
ServiceObservation::lateness

fn ServiceObservation::lateness(self : ServiceObservation) -> Int

Return lateness.

#
ServiceObservation::on_time

fn ServiceObservation::on_time(self : ServiceObservation) -> Bool

Return on-time status.

#
SetCovering

pub struct SetCovering {
solver : Solver
selected : Array[Int]
costs : Array[Int]
total_cost : Int
universe_size : Int
}

A minimum-cost set-covering model.

#
SetCovering::cost

fn SetCovering::cost(self : SetCovering, solution : Solution) -> Int

Return total covering cost.

#
SetCovering::covers_all

fn SetCovering::covers_all(self : SetCovering, solution : Solution, covers : Array[Array[Int]]) -> Bool

Return whether every universe element is covered.

#
SetCovering::render

fn SetCovering::render(self : SetCovering, solution : Solution) -> String

Render a covering solution.

#
SetCovering::selected_sets

fn SetCovering::selected_sets(self : SetCovering, solution : Solution) -> Array[Int]

Return selected set indices.

#
SetCovering::solve

Solve for a minimum-cost covering.

#
SetCovering::stats

fn SetCovering::stats(self : SetCovering) -> SearchStats

Return solver statistics.

#
SimulationEntity

pub struct SimulationEntity {
id : Int
arrival : Int
service : Int
priority : Int
}

A simulated entity record.

#
SimulationEvent

pub struct SimulationEvent {
time : Int
sequence : Int
entity : Int
resource : Int
kind : SimulationEventKind
payload : Int
}

A scheduled event.

#
SimulationEvent::kind_name

fn SimulationEvent::kind_name(self : SimulationEvent) -> String

Return a stable kind label.

#
SimulationEventKind

pub enum SimulationEventKind {
Arrival
ServiceStart
ServiceFinish
Maintenance
CustomEvent
}

Deterministic discrete-event simulation helpers.

The simulation layer is intentionally integer-based: it can replay queue, service, and maintenance scenarios in CI without wall-clock randomness. Events are ordered by time and then sequence number, making traces stable even when several events share a timestamp.

#
Solution

pub struct Solution {
values : Array[Int]
} derive(Eq,
Debug
)

A complete assignment returned by the solver.

#
Solution::csv

fn Solution::csv(self : Solution) -> String

Render a solution as comma-separated values.

#
Solution::describe

fn Solution::describe(self : Solution, variables : Array[Variable]) -> String

Format a solution as name=value pairs using a model's variable names.

#
Solution::get

fn Solution::get(self : Solution, variable : Int) -> Int

Read a variable's assigned value from a solution.

#
Solution::values

fn Solution::values(self : Solution) -> Array[Int]

Return all assigned values in variable-id order.

#
SolutionDelta

pub struct SolutionDelta {
variable : Int
before : Int
after : Int
}

A named difference between two complete assignments.

#
SolutionDelta::after

fn SolutionDelta::after(self : SolutionDelta) -> Int

Read a delta's new value.

#
SolutionDelta::before

fn SolutionDelta::before(self : SolutionDelta) -> Int

Read a delta's old value.

#
SolutionDelta::describe

fn SolutionDelta::describe(self : SolutionDelta) -> String

Return a readable delta line.

#
SolutionDelta::variable

fn SolutionDelta::variable(self : SolutionDelta) -> Int

Read a delta variable id.

#
SolutionPool

pub struct SolutionPool {
records : Array[SolutionRecord]
limit : Int
terms : Array[PortfolioObjectiveTerm]
}

A bounded solution collection.

#
SolutionPool::best

Return the best record.

#
SolutionPool::contains

fn SolutionPool::contains(self : SolutionPool, values : Array[Int]) -> Bool

Return whether a solution value vector is already stored.

#
SolutionPool::insert

fn SolutionPool::insert(self : SolutionPool, record : SolutionRecord) -> Bool

Add a scored solution and keep the best bounded set.

#
SolutionPool::is_full

fn SolutionPool::is_full(self : SolutionPool) -> Bool

Return whether the pool is full.

#
SolutionPool::length

fn SolutionPool::length(self : SolutionPool) -> Int

Return the number of stored solutions.

#
SolutionPool::objective_count

fn SolutionPool::objective_count(self : SolutionPool) -> Int

Return the number of objective dimensions.

#
SolutionPool::pareto_front

fn SolutionPool::pareto_front(self : SolutionPool) -> Array[SolutionRecord]

Return the Pareto-nondominated records.

#
SolutionPool::records

Return copied records in objective order.

#
SolutionPool::signature

fn SolutionPool::signature(self : SolutionPool) -> Int

Return a pool fingerprint.

#
SolutionPool::worst

Return the worst record currently retained.

#
SolutionRecord

pub struct SolutionRecord {
solution : Solution
values : Array[Int]
scores : Array[Int]
rank : Int
}

A scored solution record.

#
SolutionRecord::scores

fn SolutionRecord::scores(self : SolutionRecord) -> Array[Int]

Read objective scores.

#
SolutionRecord::signature

fn SolutionRecord::signature(self : SolutionRecord) -> Int

Return a stable record signature.

#
SolutionRecord::values

fn SolutionRecord::values(self : SolutionRecord) -> Array[Int]

Read the copied solution values.

#
SolveAttempt

pub struct SolveAttempt {
index : Int
solved : Bool
solution_count : Int
work : Int
signature : Int
}

Repeatable model execution sessions.

A session records attempts, signatures, and solver counters around a model. It is intended for local acceptance runs and for collecting evidence that a change remains deterministic across repeated solves.

#
SolveAttempt::describe

fn SolveAttempt::describe(self : SolveAttempt) -> String

Return a stable attempt line.

#
SolveAudit

pub struct SolveAudit {
satisfiable : Bool
solutions : Int
stats : SearchStats
complete : Bool
}

A compact audit record for a solve operation.

#
SolveAudit::complete

fn SolveAudit::complete(self : SolveAudit) -> Bool

Return whether the search was not truncated.

#
SolveAudit::describe

fn SolveAudit::describe(self : SolveAudit) -> String

Return a stable audit summary.

#
SolveAudit::satisfiable

fn SolveAudit::satisfiable(self : SolveAudit) -> Bool

Return whether the capped search found at least one solution.

#
SolveAudit::solutions

fn SolveAudit::solutions(self : SolveAudit) -> Int

Return the number of solutions in an audit.

#
SolveAudit::stats

fn SolveAudit::stats(self : SolveAudit) -> SearchStats

Return search statistics from an audit.

#
SolveSession

pub struct SolveSession {
name : String
attempts : Array[SolveAttempt]
signatures : Array[Int]
}

A repeated execution session.

#
SolveSession::all_solved

fn SolveSession::all_solved(self : SolveSession) -> Bool

Return whether all attempts solved.

#
SolveSession::attempts

fn SolveSession::attempts(self : SolveSession) -> Array[SolveAttempt]

Return attempts.

#
SolveSession::average_work

fn SolveSession::average_work(self : SolveSession) -> Int

Return average work.

#
SolveSession::describe

fn SolveSession::describe(self : SolveSession) -> String

Return a compact session report.

#
SolveSession::deterministic

fn SolveSession::deterministic(self : SolveSession) -> Bool

Return whether all signatures agree.

#
SolveSession::length

fn SolveSession::length(self : SolveSession) -> Int

Return attempt count.

#
SolveSession::maximum_work

fn SolveSession::maximum_work(self : SolveSession) -> Int

Return the largest work attempt.

#
SolveSession::review

Return a quality review for a session.

#
SolveSession::run

fn SolveSession::run(self : SolveSession, solver : Solver, limit : Int) -> SolveAttempt

Execute a solver once and record its result.

#
SolveSession::signature

fn SolveSession::signature(self : SolveSession) -> Int

Return a session fingerprint.

#
SolveSession::total_work

fn SolveSession::total_work(self : SolveSession) -> Int

Return total work.

#
SolveSession::work_stable

fn SolveSession::work_stable(self : SolveSession, tolerance_percent : Int) -> Bool

Return whether work is stable within a tolerance.

#
SolveStatus

pub enum SolveStatus {
SolvedStatus
UnsatisfiableStatus
LimitRejectedStatus
BudgetExceededStatus
} derive(Eq,
Debug
)

Public status of a guarded solve.

#
Solver

pub struct Solver {
variables : Array[Variable]
constraints : Array[Constraint]
max_solutions : Int
search_config : SearchConfig
last_stats : SearchStats
}

The mutable model and deterministic finite-domain search engine.

#
Solver::add_constraint

fn Solver::add_constraint(self : Solver, constraint : Constraint) -> Unit

Add a constraint after checking all referenced variable identifiers.

#
Solver::add_variable

fn Solver::add_variable(self : Solver, variable : Variable) -> Int

Add a variable and return its zero-based identifier.

#
Solver::assign

fn Solver::assign(self : Solver, variable : Int, value : Int) -> Bool

Assign a value before solving. This is useful for givens in application models such as Sudoku and for incremental model construction.

#
Solver::audit

fn Solver::audit(self : Solver, solution_limit : Int) -> SolveAudit

Run a capped solve and return its audit record.

#
Solver::best_solution

fn Solver::best_solution(self : Solver, objective : Objective, limit : Int) -> ScoredSolution?

Return the best solution after bounded enumeration.

#
Solver::compare_heuristics

fn Solver::compare_heuristics(self : Solver, solution_limit : Int) -> Array[HeuristicResult]

Compare the built-in variable heuristics on the same model.

#
Solver::compare_value_orders

fn Solver::compare_value_orders(self : Solver, solution_limit : Int) -> Array[HeuristicResult]

Compare the built-in value ordering heuristics.

#
Solver::configure

fn Solver::configure(self : Solver, config : SearchConfig) -> Unit

Replace the search configuration for future solves.

#
Solver::constraint_count

fn Solver::constraint_count(self : Solver) -> Int

Number of posted constraints in the model.

#
Solver::constraint_csv

fn Solver::constraint_csv(self : Solver) -> String

Render a solver's structural report as CSV-like rows.

#
Solver::constraint_kind_counts

fn Solver::constraint_kind_counts(self : Solver) -> Map[String, Int]

Count constraints by semantic family.

#
Solver::constraint_report

fn Solver::constraint_report(self : Solver) -> Array[ConstraintInfo]

Return one diagnostic line for each posted constraint.

#
Solver::constraints

fn Solver::constraints(self : Solver) -> Array[Constraint]

Return a copy of all posted constraints.

#
Solver::count_solutions

fn Solver::count_solutions(self : Solver, cap : Int) -> Int

Count solutions up to a cap while avoiding a large result allocation.

#
Solver::csv_header

fn Solver::csv_header(self : Solver) -> String

Render all variable names as a CSV header.

#
Solver::diagnostic_report

fn Solver::diagnostic_report(self : Solver) -> String

Produce a complete model report suitable for a CLI or issue template.

#
Solver::domain_csv

fn Solver::domain_csv(self : Solver) -> String

Return a compact domain report.

#
Solver::domain_histogram

fn Solver::domain_histogram(self : Solver) -> Map[Int, Int]

Return a compact domain histogram for model review.

#
Solver::domain_of

fn Solver::domain_of(self : Solver, variable : Int) -> Domain

Read a variable domain from the model without exposing mutable internals.

#
Solver::domains

fn Solver::domains(self : Solver) -> Array[Domain]

Return a copy of all current variable domains.

#
Solver::enumeration_complete

fn Solver::enumeration_complete(self : Solver) -> Bool

Return whether the capped enumeration was complete.

#
Solver::explain_assumptions

fn Solver::explain_assumptions(self : Solver, set : AssumptionSet) -> ConflictReport

Find a deletion-minimal subset that still makes the model unsatisfiable. The operation is deliberately conservative: it only removes an item when the remaining set is still unsatisfiable.

#
Solver::guarded_solve

fn Solver::guarded_solve(self : Solver, limits : ModelLimits, node_budget : Int) -> GuardedSolve

Solve one model while enforcing both structural and node limits.

#
Solver::has_nonempty_domains

fn Solver::has_nonempty_domains(self : Solver) -> Bool

Return whether every variable has at least one candidate.

#
Solver::is_consistent_with

fn Solver::is_consistent_with(self : Solver, set : AssumptionSet) -> Bool

Test a temporary decision set without exposing a solution.

#
Solver::is_satisfiable

fn Solver::is_satisfiable(self : Solver) -> Bool

Return whether at least one solution exists.

#
Solver::is_valid_solution

fn Solver::is_valid_solution(self : Solver, solution : Solution) -> Bool

Verify a complete solution against variable domains and constraints.

#
Solver::last_pruned_values

fn Solver::last_pruned_values(self : Solver) -> Int

Return the number of candidate values removed by the last solve.

#
Solver::last_solve_truncated

fn Solver::last_solve_truncated(self : Solver) -> Bool

Return whether the last solve reached a budget limit.

#
Solver::limit

fn Solver::limit(self : Solver, count : Int) -> Unit

Set the maximum number of solutions collected by solve_all.

#
Solver::limit_violation

fn Solver::limit_violation(self : Solver, limits : ModelLimits) -> String?

Return the first limit category exceeded by a model.

#
Solver::metrics

fn Solver::metrics(self : Solver) -> SolverMetrics

Calculate structural metrics before solving.

#
Solver::metrics_map

fn Solver::metrics_map(self : Solver) -> Map[String, Int]

Return a two-column map that can be emitted by a metrics adapter.

#
Solver::optimize

fn Solver::optimize(self : Solver, variable : Int, direction : OptimizationDirection) -> OptimizationResult?

Enumerate solutions and return the one with the best objective value.

#
Solver::performance_report

fn Solver::performance_report(self : Solver) -> String

Render metrics and latest search statistics together.

#
Solver::probe

fn Solver::probe(self : Solver, batch : ProbeBatch, set : AssumptionSet) -> AssumptionResult

Probe and record a decision set.

#
Solver::ranked_solutions

fn Solver::ranked_solutions(self : Solver, objective : Objective, limit : Int) -> Array[ScoredSolution]

Enumerate and rank solutions by a multi-component objective.

#
Solver::readiness_report

fn Solver::readiness_report(self : Solver, limits : ModelLimits) -> String

Render a model readiness check.

#
Solver::ready

fn Solver::ready(self : Solver) -> Bool

Return whether a model is ready to enter search.

#
Solver::reset_stats

fn Solver::reset_stats(self : Solver) -> Unit

Reset counters without changing the model.

#
Solver::restore

fn Solver::restore(self : Solver, snapshot : ModelSnapshot) -> Unit

Restore a snapshot captured from this solver's variable layout.

#
Solver::snapshot

fn Solver::snapshot(self : Solver) -> ModelSnapshot

Save the current domains and search configuration.

#
Solver::solution_csv

fn Solver::solution_csv(self : Solver, solution : Solution) -> String

Render a named solution as a two-line CSV document.

#
Solver::solve

fn Solver::solve(self : Solver) -> Solution?

Find one solution, if the model is satisfiable.

#
Solver::solve_all

fn Solver::solve_all(self : Solver) -> Array[Solution]

Find up to the configured number of solutions using propagation and MRV.

#
Solver::solve_all_with_assumptions

fn Solver::solve_all_with_assumptions(self : Solver, set : AssumptionSet, limit : Int) -> Array[Solution]

Enumerate solutions under temporary decisions.

#
Solver::solve_with

fn Solver::solve_with(self : Solver, config : SearchConfig) -> Array[Solution]

Solve with an explicit configuration.

#
Solver::solve_with_assumptions

fn Solver::solve_with_assumptions(self : Solver, set : AssumptionSet) -> AssumptionResult

Apply a set of decisions, solve once, and restore every original domain.

#
Solver::solve_with_budget

fn Solver::solve_with_budget(self : Solver, node_budget : Int, solution_limit : Int) -> Array[Solution]

Solve with a node budget and expose truncation explicitly through stats.

#
Solver::stats

fn Solver::stats(self : Solver) -> SearchStats

Get counters from the most recent solve.

#
Solver::structural_fingerprint

fn Solver::structural_fingerprint(self : Solver) -> String

Return a stable textual statistic for a model's structure.

#
Solver::summary

fn Solver::summary(self : Solver) -> String

Return a concise model summary for CLI diagnostics.

#
Solver::validate

fn Solver::validate(self : Solver) -> Bool

Validate the model's static shape without running search.

#
Solver::validation_error

fn Solver::validation_error(self : Solver) -> String?

Validate a model and return a human-readable failure reason.

#
Solver::variable_count

fn Solver::variable_count(self : Solver) -> Int

Number of variables in the model.

#
Solver::variables

fn Solver::variables(self : Solver) -> Array[Variable]

Return a copy of the current variable declarations.

#
Solver::violations

fn Solver::violations(self : Solver, solution : Solution) -> Array[String]

Return labels for every constraint violated by a complete solution.

#
Solver::within_limits

fn Solver::within_limits(self : Solver, limits : ModelLimits) -> Bool

Check whether a model fits configured structural limits.

#
SolverMetrics

pub struct SolverMetrics {
variables : Int
constraints : Int
total_candidates : Int
singleton_variables : Int
empty_variables : Int
global_constraints : Int
arithmetic_constraints : Int
scheduling_constraints : Int
}

Structural metrics for monitoring model growth and propagation quality.

#
SolverMetrics::average_domain_size

fn SolverMetrics::average_domain_size(self : SolverMetrics) -> Int

Return average candidate count rounded down.

#
SolverMetrics::branching_estimate

fn SolverMetrics::branching_estimate(self : SolverMetrics) -> Int

Return a rough branching estimate.

#
SolverMetrics::describe

fn SolverMetrics::describe(self : SolverMetrics) -> String

Return a stable metrics line.

#
SolverMetrics::fixed_percentage

fn SolverMetrics::fixed_percentage(self : SolverMetrics) -> Int

Return the fraction of variables already fixed as a percentage.

#
SolverMetrics::has_empty_domain

fn SolverMetrics::has_empty_domain(self : SolverMetrics) -> Bool

Return whether the model contains an empty domain.

#
SolverMetrics::health_score

fn SolverMetrics::health_score(self : SolverMetrics) -> Int

Calculate a simple model health score from 0 to 100.

#
Sudoku

pub struct Sudoku {
solver : Solver
cells : Array[Int]
givens : Array[Int]
}

A standard 9x9 Sudoku model backed by the finite-domain solver.

#
Sudoku::add_diagonals

fn Sudoku::add_diagonals(self : Sudoku) -> Unit

Add the two main diagonal constraints for a variant Sudoku.

#
Sudoku::add_distance

fn Sudoku::add_distance(self : Sudoku, row : Int, column : Int, other_row : Int, other_column : Int, distance_value : Int) -> Bool

Add a pair of cells that must differ by an exact distance.

#
Sudoku::cell

fn Sudoku::cell(self : Sudoku, row : Int, column : Int) -> Int

Return the cell identifier at row and column coordinates.

#
Sudoku::cell_ids

fn Sudoku::cell_ids(self : Sudoku) -> Array[Int]

Return the internal cell identifiers in row-major order.

#
Sudoku::compact

fn Sudoku::compact(self : Sudoku, solution : Solution) -> String

Render a compact 81-character solution string.

#
Sudoku::count_solutions

fn Sudoku::count_solutions(self : Sudoku, cap : Int) -> Int

Count solutions up to a cap without exposing the whole solution array.

#
Sudoku::givens

fn Sudoku::givens(self : Sudoku) -> Array[Int]

Return the original givens as 81 digits, with zero for blanks.

#
Sudoku::is_valid

fn Sudoku::is_valid(self : Sudoku, solution : Solution) -> Bool

Check whether a solution obeys every row, column and box rule.

#
Sudoku::render

fn Sudoku::render(self : Sudoku, solution : Solution) -> String

Render a solved board with three-by-three separators.

#
Sudoku::solve

fn Sudoku::solve(self : Sudoku) -> Solution?

Solve the Sudoku once.

#
Sudoku::solve_all

fn Sudoku::solve_all(self : Sudoku, limit : Int) -> Array[Solution]

Return up to limit Sudoku solutions.

#
Sudoku::solver

fn Sudoku::solver(self : Sudoku) -> Solver

Return the underlying solver for advanced variants.

#
Sudoku::stats

fn Sudoku::stats(self : Sudoku) -> SearchStats

Return search counters for the most recent solve.

#
TextDocument

pub struct TextDocument {
lines : Array[String]
}

A text document with line access.

#
TextDocument::line

fn TextDocument::line(self : TextDocument, index : Int) -> String

Return one line.

#
TextDocument::line_count

fn TextDocument::line_count(self : TextDocument) -> Int

Return line count.

#
TextDocument::lines

fn TextDocument::lines(self : TextDocument) -> Array[String]

Return copied lines.

#
TextDocument::nonempty_lines

fn TextDocument::nonempty_lines(self : TextDocument) -> Array[Int]

Return non-empty line numbers.

#
TextDocument::without_comments

fn TextDocument::without_comments(self : TextDocument, prefix : String) -> Array[String]

Return comment-free lines with a configured prefix.

#
TextToken

pub struct TextToken {
value : String
line : Int
column : Int
}

Dependency-free text and delimited-data utilities.

Model files and benchmark artifacts often need a tiny parser but should not pull an IO or JSON dependency into the core package. These routines cover stable tokenization, key-value configuration, CSV rows, and redaction.

#
TextToken::column

fn TextToken::column(self : TextToken) -> Int

Read token column.

#
TextToken::line

fn TextToken::line(self : TextToken) -> Int

Read token line.

#
TextToken::value

fn TextToken::value(self : TextToken) -> String

Read token value.

#
TimelineInterval

pub struct TimelineInterval {
id : Int
resource : Int
start : Int
end : Int
weight : Int
label : String
}

Interval analytics for calendars, reservations, and resource timelines.

Timeline records are half-open intervals [start, end). Keeping this convention explicit makes boundary-touching reservations composable and lets capacity checks share the same logic as scheduling constraints.

#
TimelineInterval::contains

fn TimelineInterval::contains(self : TimelineInterval, time : Int) -> Bool

Return whether a time point is covered.

#
TimelineInterval::duration

fn TimelineInterval::duration(self : TimelineInterval) -> Int

Return interval duration.

#
TimelineInterval::valid

fn TimelineInterval::valid(self : TimelineInterval) -> Bool

Return whether an interval is valid.

#
UtilityItem

pub struct UtilityItem {
id : Int
weight : Int
value : Int
}

A weighted item used by integer knapsack helpers.

#
UtilityItem::density

fn UtilityItem::density(self : UtilityItem, scale : Int) -> Int

Return value density using a scale factor.

#
ValidationIssue

pub struct ValidationIssue {
code : String
path : String
message : String
severity : ValidationSeverity
}

One validation finding.

#
ValidationIssue::code

fn ValidationIssue::code(self : ValidationIssue) -> String

Read issue code.

#
ValidationIssue::describe

fn ValidationIssue::describe(self : ValidationIssue) -> String

Render an issue for logs.

#
ValidationIssue::message

fn ValidationIssue::message(self : ValidationIssue) -> String

Read issue message.

#
ValidationIssue::path

fn ValidationIssue::path(self : ValidationIssue) -> String

Read issue path.

#
ValidationIssue::severity_name

fn ValidationIssue::severity_name(self : ValidationIssue) -> String

Return a stable severity label.

#
ValidationReport

pub struct ValidationReport {
issues : Array[ValidationIssue]
}

A collection of findings.

#
ValidationReport::describe

fn ValidationReport::describe(self : ValidationReport) -> String

Render all issues as newline-separated lines.

#
ValidationReport::error

fn ValidationReport::error(self : ValidationReport, code : String, path : String, message : String) -> Unit

Add an error.

#
ValidationReport::error_count

fn ValidationReport::error_count(self : ValidationReport) -> Int

Count errors.

#
ValidationReport::info

fn ValidationReport::info(self : ValidationReport, code : String, path : String, message : String) -> Unit

Add an informational note.

#
ValidationReport::issues

Return copied issues.

#
ValidationReport::length

fn ValidationReport::length(self : ValidationReport) -> Int

Return issue count.

#
ValidationReport::push

fn ValidationReport::push(self : ValidationReport, issue : ValidationIssue) -> Unit

Add an issue.

#
ValidationReport::signature

fn ValidationReport::signature(self : ValidationReport) -> Int

Return a stable report fingerprint.

#
ValidationReport::valid

fn ValidationReport::valid(self : ValidationReport) -> Bool

Return whether no errors exist.

#
ValidationReport::warning

fn ValidationReport::warning(self : ValidationReport, code : String, path : String, message : String) -> Unit

Add a warning.

#
ValidationReport::warning_count

fn ValidationReport::warning_count(self : ValidationReport) -> Int

Count warnings.

#
ValidationSeverity

pub enum ValidationSeverity {
ValidationInfo
ValidationWarning
ValidationError
}

Reusable validation and diagnostics for application-facing APIs.

Validation results carry machine-readable codes and paths so command-line clients can show actionable failures without parsing exception text. The report is immutable from a caller's perspective but uses arrays internally for low-allocation model construction.

#
ValueHeuristic

pub enum ValueHeuristic {
AscendingValues
DescendingValues
MedianFirst
} derive(Eq,
Debug
)

Value ordering strategy used when branching on a variable.

#
Variable

pub struct Variable {
name : String
domain : Domain
} derive(
Debug
)

A named finite-domain variable.

#
Variable::clone

fn Variable::clone(self : Variable) -> Variable

Return an independent copy of the variable and its domain.

#
Variable::domain

fn Variable::domain(self : Variable) -> Domain

Return the current domain of a variable.

#
Variable::name

fn Variable::name(self : Variable) -> String

Return a variable's stable user-facing name.

#
Variable::size

fn Variable::size(self : Variable) -> Int

Return the number of candidate values for a variable.

#
VariableGroup

pub struct VariableGroup {
ids : Array[Int]
}

A reusable collection of variable identifiers for application builders.

#
VariableGroup::all_different

fn VariableGroup::all_different(self : VariableGroup, solver : Solver) -> Unit

Post AllDifferent for the group.

#
VariableGroup::count

fn VariableGroup::count(self : VariableGroup, solver : Solver, value : Int, count : Int) -> Unit

Post a count constraint for the group.

#
VariableGroup::ids

fn VariableGroup::ids(self : VariableGroup) -> Array[Int]

Return identifiers in group order.

#
VariableGroup::length

fn VariableGroup::length(self : VariableGroup) -> Int

Number of variables in the group.

#
VariableGroup::sum

fn VariableGroup::sum(self : VariableGroup, solver : Solver, target : Int) -> Unit

Post a target sum for the group.

#
VariableHeuristic

pub enum VariableHeuristic {
MinimumRemainingValues
FirstUnassigned
MaximumDegree
DomOverDegree
} derive(Eq,
Debug
)

Variable selection strategy used by the depth-first search engine.

#
VehicleRoute

pub struct VehicleRoute {
vehicle : Int
stops : Array[Int]
}

A route is represented without an implicit depot in its stop list.

#
VehicleRoute::insert

fn VehicleRoute::insert(self : VehicleRoute, position : Int, stop : Int) -> Bool

Insert a customer at a bounded position.

#
VehicleRoute::length

fn VehicleRoute::length(self : VehicleRoute) -> Int

Number of customer visits.

#
VehicleRoute::push_unique

fn VehicleRoute::push_unique(self : VehicleRoute, stop : Int) -> Bool

Append a customer when it has not already been used in this route.

#
VehicleRoute::remove

fn VehicleRoute::remove(self : VehicleRoute, stop : Int) -> Bool

Remove a stop and return whether it was found.

#
VehicleRoute::reverse_segment

fn VehicleRoute::reverse_segment(self : VehicleRoute, left : Int, right : Int) -> Bool

Reverse a bounded inclusive segment for 2-opt neighborhoods.

#
VehicleRoute::stops

fn VehicleRoute::stops(self : VehicleRoute) -> Array[Int]

Read a copied stop sequence.

#
VehicleRoute::vehicle

fn VehicleRoute::vehicle(self : VehicleRoute) -> Int

Read the vehicle index.

#
WeightedGraph

pub struct WeightedGraph {
vertices : Int
directed : Bool
weights : Array[Array[Int]]
}

A bounded weighted graph.

#
WeightedGraph::add_edge

fn WeightedGraph::add_edge(self : WeightedGraph, from : Int, to : Int, weight : Int) -> Bool

Add or replace an edge.

#
WeightedGraph::average_degree

fn WeightedGraph::average_degree(self : WeightedGraph) -> Int

Return the average outgoing degree.

#
WeightedGraph::breadth_first_order

fn WeightedGraph::breadth_first_order(self : WeightedGraph, source : Int) -> Array[Int]

Breadth-first traversal from a source.

#
WeightedGraph::connected

fn WeightedGraph::connected(self : WeightedGraph, source : Int, destination : Int) -> Bool

Return whether a graph has a path between two vertices.

#
WeightedGraph::connected_components

fn WeightedGraph::connected_components(self : WeightedGraph) -> Array[Array[Int]]

Return connected components, treating directed edges as undirected links.

#
WeightedGraph::degree

fn WeightedGraph::degree(self : WeightedGraph, vertex : Int) -> Int

Return the out-degree.

#
WeightedGraph::depth_first_order

fn WeightedGraph::depth_first_order(self : WeightedGraph, source : Int) -> Array[Int]

Depth-first traversal from a source.

#
WeightedGraph::dijkstra_distances

fn WeightedGraph::dijkstra_distances(self : WeightedGraph, source : Int) -> Array[Int]

Compute non-negative shortest distances from a source with Dijkstra.

#
WeightedGraph::dijkstra_predecessors

fn WeightedGraph::dijkstra_predecessors(self : WeightedGraph, source : Int) -> Array[Int]

Compute shortest-path predecessors from a source.

#
WeightedGraph::distance_sum

fn WeightedGraph::distance_sum(self : WeightedGraph, source : Int) -> Int

Return the sum of distances from a source to reachable vertices.

#
WeightedGraph::edge_count

fn WeightedGraph::edge_count(self : WeightedGraph) -> Int

Return the total edge count.

#
WeightedGraph::edge_list

fn WeightedGraph::edge_list(self : WeightedGraph) -> String

Return a stable edge-list representation.

#
WeightedGraph::edge_weight

fn WeightedGraph::edge_weight(self : WeightedGraph, from : Int, to : Int) -> Int?

Return an edge weight.

#
WeightedGraph::edges

Return all graph edges in stable row-major order.

#
WeightedGraph::floyd_warshall

fn WeightedGraph::floyd_warshall(self : WeightedGraph) -> Array[Array[Int]]

Compute all-pairs shortest distances.

#
WeightedGraph::graph_signature

fn WeightedGraph::graph_signature(self : WeightedGraph) -> Int

Return a stable graph fingerprint.

#
WeightedGraph::greedy_coloring

fn WeightedGraph::greedy_coloring(self : WeightedGraph) -> Array[Int]

Greedily color vertices in order.

#
WeightedGraph::has_directed_cycle

fn WeightedGraph::has_directed_cycle(self : WeightedGraph) -> Bool

Return whether the directed graph contains a cycle.

#
WeightedGraph::has_edge

fn WeightedGraph::has_edge(self : WeightedGraph, from : Int, to : Int) -> Bool

Return whether an edge exists.

#
WeightedGraph::highest_degree_vertex

fn WeightedGraph::highest_degree_vertex(self : WeightedGraph) -> Int?

Return the vertex with the largest degree.

#
WeightedGraph::is_directed

fn WeightedGraph::is_directed(self : WeightedGraph) -> Bool

Return whether edges are directed.

#
WeightedGraph::is_simple_graph

fn WeightedGraph::is_simple_graph(self : WeightedGraph) -> Bool

Return whether the graph is a simple graph.

#
WeightedGraph::isolated_vertex_count

fn WeightedGraph::isolated_vertex_count(self : WeightedGraph) -> Int

Return the number of isolated vertices.

#
WeightedGraph::matrix

fn WeightedGraph::matrix(self : WeightedGraph) -> Array[Array[Int]]

Return a copied adjacency matrix using -1 for absent edges.

#
WeightedGraph::maximum_flow

fn WeightedGraph::maximum_flow(self : WeightedGraph, source : Int, sink : Int) -> Int

Find a maximum flow between source and sink.

#
WeightedGraph::maximum_outgoing_weight

fn WeightedGraph::maximum_outgoing_weight(self : WeightedGraph, vertex : Int) -> Int

Return the heaviest outgoing edge weight from a vertex.

#
WeightedGraph::minimum_outgoing_weight

fn WeightedGraph::minimum_outgoing_weight(self : WeightedGraph, vertex : Int) -> Int

Return the lightest outgoing edge weight, or -1 when isolated.

#
WeightedGraph::minimum_spanning_forest

fn WeightedGraph::minimum_spanning_forest(self : WeightedGraph) -> Array[GraphEdge]

Return a minimum spanning forest using a deterministic Kruskal pass.

#
WeightedGraph::neighbors

fn WeightedGraph::neighbors(self : WeightedGraph, vertex : Int) -> Array[Int]

Return outgoing neighbors in ascending vertex order.

#
WeightedGraph::reaches_all

fn WeightedGraph::reaches_all(self : WeightedGraph, source : Int) -> Bool

Return whether all vertices are reachable from a source.

#
WeightedGraph::remove_edge

fn WeightedGraph::remove_edge(self : WeightedGraph, from : Int, to : Int) -> Bool

Remove an edge.

#
WeightedGraph::shortest_path

fn WeightedGraph::shortest_path(self : WeightedGraph, source : Int, destination : Int) -> Array[Int]?

Reconstruct a shortest path from source to destination.

#
WeightedGraph::topological_order

fn WeightedGraph::topological_order(self : WeightedGraph) -> Array[Int]?

Return an ordering for a directed acyclic graph, or None for a cycle.

#
WeightedGraph::transitive_closure

fn WeightedGraph::transitive_closure(self : WeightedGraph) -> Array[Array[Bool]]

Compute transitive reachability using boolean closure.

#
WeightedGraph::valid_coloring

fn WeightedGraph::valid_coloring(self : WeightedGraph, colors : Array[Int]) -> Bool

Validate a vertex coloring.

#
WeightedGraph::valid_vertex

fn WeightedGraph::valid_vertex(self : WeightedGraph, vertex : Int) -> Bool

Validate a vertex identifier.

#
WeightedGraph::vertex_count

fn WeightedGraph::vertex_count(self : WeightedGraph) -> Int

Return the vertex count.

#
WhatIfScenario

pub struct WhatIfScenario {
name : String
values : Array[ScenarioValue]
}

A named scenario.

#
WhatIfScenario::delta

fn WhatIfScenario::delta(self : WhatIfScenario, name : String, amount : Int) -> WhatIfScenario

Return a scenario with a delta applied.

#
WhatIfScenario::get

fn WhatIfScenario::get(self : WhatIfScenario, name : String) -> Int?

Read a scenario parameter.

#
WhatIfScenario::set

fn WhatIfScenario::set(self : WhatIfScenario, name : String, value : Int) -> Bool

Set or replace a scenario parameter.

#
WhatIfScenario::signature

fn WhatIfScenario::signature(self : WhatIfScenario) -> Int

Return a stable scenario key.

#
WhatIfScenario::values

Return copied values.

#
absolute

fn absolute(source : Int, result : Int) -> Constraint

Bind result to the absolute value of source.

#
active_resource_count

fn active_resource_count(timeline : ResourceTimeline, time : Int) -> Int

Return the number of active resources at a time.

#
aggregate_model_reports

fn aggregate_model_reports(name : String, reports : Array[ModelReport]) -> ModelReport

Aggregate reports.

#
all_different

fn all_different(variables : Array[Int]) -> Constraint

Require all listed variables to be pairwise different.

#
all_different_pairs

fn all_different_pairs(variables : Array[Int]) -> ConstraintSet

Generate pairwise inequality constraints for a variable group.

#
all_in_range

fn all_in_range(values : Array[Int], lower : Int, upper : Int) -> Bool

Return whether values stay inside a range.

#
all_true

fn all_true(values : Array[Bool]) -> Bool

#
allocation_bin_value

fn allocation_bin_value(instance : AllocationInstance, plan : AllocationPlan, bin : Int) -> Int

Return the total value in a bin.

#
allocation_bin_weight

fn allocation_bin_weight(instance : AllocationInstance, plan : AllocationPlan, bin : Int) -> Int

Return the total weight in a bin.

#
allocation_completion

fn allocation_completion(instance : AllocationInstance, plan : AllocationPlan) -> Int

Return the fraction of items assigned as integer percentage points.

#
allocation_feasible

fn allocation_feasible(instance : AllocationInstance, plan : AllocationPlan) -> Bool

Return whether every item is assigned and every rule holds.

#
allocation_group_count

fn allocation_group_count(instance : AllocationInstance, plan : AllocationPlan, bin : Int, group : Int) -> Int

Count items from a group in a bin.

#
allocation_instance

fn allocation_instance(items : Array[AllocationItem], capacities : Array[Int]) -> AllocationInstance?

Create an allocation instance with no group limits.

#
allocation_item

fn allocation_item(id : Int, weight : Int, value : Int, group : Int) -> AllocationItem

Construct an allocation item.

#
allocation_items_by_value

fn allocation_items_by_value(instance : AllocationInstance) -> Array[Int]

Return items ordered by descending value.

#
allocation_loads

fn allocation_loads(instance : AllocationInstance, plan : AllocationPlan) -> Array[Int]

Return all bin loads.

#
allocation_plan

fn allocation_plan(instance : AllocationInstance) -> AllocationPlan

Create an unassigned plan.

#
allocation_report

fn allocation_report(instance : AllocationInstance, plan : AllocationPlan) -> String

Return a stable allocation report.

#
allocation_signature

fn allocation_signature(plan : AllocationPlan) -> Int

Return a stable one-line plan representation.

#
allocation_spread

fn allocation_spread(instance : AllocationInstance, plan : AllocationPlan) -> Int

Return max load minus min load.

#
allocation_values

fn allocation_values(instance : AllocationInstance, plan : AllocationPlan) -> Array[Int]

Return all bin values.

#
allowed_rows

fn allowed_rows(variables : Array[Int], rows : Array[Array[Int]]) -> ConstraintSet

Generate a table relation for an array of variables.

#
allowed_values

fn allowed_values(variable : Int, values : Array[Int]) -> Constraint

Restrict a variable to an explicit finite set.

#
alternating_binary_sequence

fn alternating_binary_sequence(length : Int) -> SequenceModel?

Build a balanced binary sequence with no adjacent equal positions.

#
any_outside_range

fn any_outside_range(values : Array[Int], lower : Int, upper : Int) -> Bool

#
any_true

fn any_true(values : Array[Bool]) -> Bool

#
arithmetic_relation

fn arithmetic_relation(left_domain : Domain, right_domain : Domain, operation : (Int, Int) -> Int) -> RelationTable?

Build a Cartesian arithmetic table for a custom pure function.

#
arithmetic_result_domain

fn arithmetic_result_domain(left : Domain, right : Domain, operation : (Int, Int) -> Int) -> Domain?

Return a finite domain containing all results of a binary operation.

#
arithmetic_scenario

fn arithmetic_scenario() -> Scenario

Return a tiny arithmetic scenario.

#
artifact_benchmark

fn artifact_benchmark(name : String, work : Int, solved : Bool, signature : Int) -> ArtifactBenchmark

Create a benchmark artifact.

#
assignment_alternates

fn assignment_alternates(values : Array[Int], first : Int, second : Int) -> Bool

Return whether a sequence alternates between two labels.

#
assignment_category_count

fn assignment_category_count(values : Array[Int]) -> Int

Count distinct categorical labels.

#
assignment_change_penalty

fn assignment_change_penalty(previous : Array[Int], current : Array[Int], penalty : Int) -> Int

Return a weighted change penalty.

#
assignment_changes

fn assignment_changes(previous : Array[Int], current : Array[Int]) -> Int

Count differences at matching positions.

#
assignment_counts

fn assignment_counts(values : Array[Int], category_count : Int) -> Array[Int]

Return category counts for labels from 0 through category_count - 1.

#
assignment_hamming_distance

fn assignment_hamming_distance(left : Array[Int], right : Array[Int]) -> Int

Return Hamming distance between assignments.

#
assignment_imbalance

fn assignment_imbalance(values : Array[Int], category_count : Int) -> Int

Return a categorical load imbalance score.

#
assignment_metrics

fn assignment_metrics(values : Array[Int], category_count : Int, previous : Array[Int]) -> AssignmentMetrics

Summarize an assignment sequence.

#
assignment_problem

fn assignment_problem(jobs : Int, workers : Int, costs : Array[Array[Int]]) -> AssignmentProblem?

Build a rectangular assignment model from a row-major cost matrix.

#
assignment_signature

fn assignment_signature(values : Array[Int]) -> Int

Return a stable categorical fingerprint.

#
assignment_transitions

fn assignment_transitions(values : Array[Int]) -> Int

Return the number of adjacent label changes.

#
assumption

fn assumption(variable : Int, value : Int) -> Assumption

Construct a variable/value decision.

#
assumptions

fn assumptions() -> AssumptionSet

Create an empty assumption set.

#
assumptions_from

fn assumptions_from(items : Array[Assumption]) -> AssumptionSet

Create an assumption set from an array. Duplicate variables are rejected by retaining the first decision and ignoring later duplicates.

#
at_least_value

fn at_least_value(variables : Array[Int], value : Int, count : Int) -> Constraint

Require at least count variables to take value.

#
at_most_value

fn at_most_value(variables : Array[Int], value : Int, count : Int) -> Constraint

Require at most count variables to take value.

#
attempts_equal

fn attempts_equal(left : SolveAttempt, right : SolveAttempt) -> Bool

Return whether two attempts agree on outcome and signature.

#
average_customer_demand

fn average_customer_demand(instance : RoutingInstance) -> Int

Return the average customer demand using integer division.

#
average_route_distance

fn average_route_distance(instance : RoutingInstance, plan : RoutingPlan) -> Int

Return the average route distance using integer division.

#
balance_unassigned

fn balance_unassigned(instance : AllocationInstance, plan : AllocationPlan) -> Int

Balance all currently unassigned items onto the least loaded bins.

#
balanced_schedule

fn balanced_schedule(people : Int, days : Int, shifts_per_day : Int) -> ScheduleProblem?

Create a balanced schedule model.

#
benchmark_artifact_suite

fn benchmark_artifact_suite(name : String) -> BenchmarkArtifactSuite

Create a suite.

#
benchmark_coloring

fn benchmark_coloring(rows : Int, columns : Int) -> BenchmarkResult

Run a grid coloring benchmark.

#
benchmark_evidence

fn benchmark_evidence(suite : BenchmarkArtifactSuite, minimum_cases : Int) -> EvidenceBundle

Build benchmark evidence.

#
benchmark_fingerprint

fn benchmark_fingerprint(results : Array[BenchmarkResult]) -> String

Return a stable fingerprint useful for regression tests.

#
benchmark_knapsack

fn benchmark_knapsack() -> BenchmarkResult

Run a small knapsack benchmark.

#
benchmark_latin

fn benchmark_latin(size : Int) -> BenchmarkResult

Run a small Latin-square benchmark.

#
benchmark_markdown

fn benchmark_markdown(results : Array[BenchmarkResult]) -> String

Render benchmark records as Markdown table rows.

#
benchmark_n_queens

fn benchmark_n_queens(size : Int) -> BenchmarkResult

Run the canonical N-Queens benchmark.

#
benchmark_regressions

fn benchmark_regressions(baseline : BenchmarkArtifactSuite, candidate : BenchmarkArtifactSuite, tolerance : Int) -> Array[String]

Return cases whose work regressed beyond tolerance.

#
benchmark_report

fn benchmark_report(results : Array[BenchmarkResult]) -> String

Render the suite as plain text for CI logs.

#
benchmark_result

fn benchmark_result(name : String, solved : Bool, solutions : Int, stats : SearchStats, repeat_count : Int) -> BenchmarkResult

Construct a benchmark result from solver counters.

#
benchmark_schedule

fn benchmark_schedule() -> BenchmarkResult

Run a small balanced-schedule benchmark.

#
benchmark_sudoku

fn benchmark_sudoku() -> BenchmarkResult

Run the canonical Sudoku benchmark.

#
benchmark_suite

fn benchmark_suite() -> Array[BenchmarkResult]

Return the canonical benchmark set.

#
benchmark_work

fn benchmark_work(results : Array[BenchmarkResult]) -> Int

Return total deterministic work across a suite.

#
benchmarks_pass

fn benchmarks_pass(results : Array[BenchmarkResult]) -> Bool

Return whether every benchmark in a suite solved successfully.

#
best_fit_bin

fn best_fit_bin(instance : AllocationInstance, plan : AllocationPlan, item : Int) -> Int?

Return the tightest bin that can receive an item.

#
best_fit_decreasing

fn best_fit_decreasing(instance : AllocationInstance) -> AllocationPlan

Allocate items in descending weight order using best fit.

#
best_heuristic

fn best_heuristic(results : Array[HeuristicResult]) -> HeuristicResult?

Return the result with the lowest deterministic work score.

#
best_heuristic_nodes

fn best_heuristic_nodes(results : Array[HeuristicResult]) -> Int?

Return the deterministic node count of the best configuration.

#
best_objective_row

fn best_objective_row(rows : Array[Array[Int]], directions : Array[PortfolioDirection]) -> Array[Int]?

Return a lexicographically best row.

#
best_scenario

fn best_scenario(evaluations : Array[ScenarioEvaluation], minimize : Bool) -> ScenarioEvaluation?

Select the best feasible evaluation.

#
best_score

fn best_score(pool : SolutionPool, objective : Int) -> Int?

Return the best score for one objective.

#
best_solution

fn best_solution(solver : Solver, terms : Array[PortfolioObjectiveTerm]) -> Solution?

Return a single best solution under objective terms.

#
between

fn between(variable : Int, lower : Int, upper : Int) -> Constraint

Restrict a variable to an inclusive interval.

#
bin_packing

fn bin_packing(weights : Array[Int], bins : Int, capacity : Int) -> BinPacking?

Build a fixed-bin packing problem.

#
binary_sequence

fn binary_sequence(length : Int, ones : Int) -> SequenceModel?

Build a binary sequence with exactly ones true positions.

#
binary_transitions

fn binary_transitions() -> Array[Array[Int]]

Return a canonical transition table for a binary automaton.

#
bipartite_matching

fn bipartite_matching(left_size : Int, right_size : Int, relation : FiniteRelation) -> Array[RelationPair]

Return matched left-right pairs from a unit flow.

#
bipartite_network

fn bipartite_network(left_size : Int, right_size : Int, relation : FiniteRelation) -> CapacityNetwork

Build a bipartite compatibility network.

#
boolean_circuit

fn boolean_circuit() -> BooleanCircuit

Create a Boolean circuit.

#
boolean_domain

fn boolean_domain() -> Domain

Boolean relation helpers built on extensional finite-domain tables.

#
boolean_indicators

fn boolean_indicators(values : Array[Bool]) -> Array[Int]

Convert booleans to integer indicators.

#
boolean_scenario

fn boolean_scenario() -> Scenario

Return a Boolean circuit scenario.

#
boolean_signature

fn boolean_signature(values : Array[Bool]) -> Int

#
boolean_truth_table

fn boolean_truth_table(operation : String) -> Array[Array[Int]]?

Return a Boolean truth table for a binary operation.

#
boolean_variable

fn boolean_variable(solver : Solver, name : String) -> Int

Create a Boolean variable.

#
bottleneck_order

fn bottleneck_order(metrics : Array[ResourceMetric]) -> Array[Int]

Return resource ids sorted by bottleneck score.

#
bounded_quality_score

fn bounded_quality_score(score : Int) -> Int

#
burst_queue

fn burst_queue(count : Int, spacing : Int, service : Int, horizon : Int) -> QueueSimulation?

Build a deterministic burst-arrival queue.

#
calendar_active

fn calendar_active(windows : Array[CalendarWindow], time : Int) -> Int

Return all windows that contain a time.

#
calendar_chain

fn calendar_chain(durations : Array[Int], horizon : Int) -> CalendarModel?

Build a simple precedence chain.

#
calendar_clip

fn calendar_clip(windows : Array[CalendarWindow], lower : Int, upper : Int) -> Array[CalendarWindow]

Return windows within a horizon.

#
calendar_covered_duration

fn calendar_covered_duration(windows : Array[CalendarWindow]) -> Int

Return total covered duration.

#
calendar_first_free

fn calendar_first_free(windows : Array[CalendarWindow], after : Int, duration : Int) -> Int

Return the first free start for a duration after a time.

#
calendar_gap_duration

fn calendar_gap_duration(windows : Array[CalendarWindow]) -> Int

Return total gap duration between windows.

#
calendar_model

fn calendar_model(horizon : Int, resources : Int) -> CalendarModel?

Create an empty calendar.

#
calendar_non_overlapping

fn calendar_non_overlapping(windows : Array[CalendarWindow]) -> Bool

Return whether windows are non-overlapping.

#
calendar_peak_concurrency

fn calendar_peak_concurrency(windows : Array[CalendarWindow]) -> Int

Return the maximum concurrency.

#
calendar_slots

fn calendar_slots(start : Int, end : Int, step : Int) -> Array[CalendarWindow]

Return a regular slot grid.

#
calendar_summary

fn calendar_summary(windows : Array[CalendarWindow]) -> String

Return a calendar summary.

#
calendar_window

fn calendar_window(start : Int, end : Int) -> CalendarWindow

Create a calendar window.

#
calendar_window_signature

fn calendar_window_signature(windows : Array[CalendarWindow]) -> Int

Return a window set fingerprint.

#
capacity_arc

fn capacity_arc(from : Int, to : Int, capacity : Int, cost : Int) -> CapacityArc

Create a capacity arc.

#
capacity_constraint

fn capacity_constraint(tasks : Array[(Int, Int, Int)], capacity : Int) -> ConstraintSet

Generate a cumulative capacity constraint.

#
capacity_network

fn capacity_network(vertices : Int) -> CapacityNetwork

Create an empty network.

#
capacity_slack

fn capacity_slack(instance : RoutingInstance, plan : RoutingPlan) -> Int

Return the largest capacity residual among routes.

#
category_run_lengths

fn category_run_lengths(values : Array[Int], category_count : Int) -> Array[Int]

Return each category's longest consecutive run.

#
checkerboard_matrix

fn checkerboard_matrix(rows : Int, columns : Int) -> IntMatrix

Create a checkerboard matrix.

#
classic_solution_string

fn classic_solution_string() -> String

Return a solved canonical board for regression tests.

#
classic_sudoku

fn classic_sudoku() -> Sudoku?

Return a canonical puzzle used in examples and benchmark baselines.

#
clique_lower_bound

fn clique_lower_bound(clique : Array[Int]) -> Int

Return the chromatic lower bound from a clique supplied by the caller.

#
collect_solution_pool

fn collect_solution_pool(solver : Solver, limit : Int, terms : Array[PortfolioObjectiveTerm]) -> SolutionPool

Enumerate solutions into a bounded portfolio.

#
coloring_count

fn coloring_count(colors : Array[Int]) -> Int

Return the number of colors in a coloring.

#
coloring_scenario

fn coloring_scenario() -> Scenario

Return a graph-coloring scenario.

#
common_domain_values

fn common_domain_values(domains : Array[Domain]) -> IntegerSet

Return values common to all domains.

#
compare_benchmark_suites

fn compare_benchmark_suites(baseline : BenchmarkArtifactSuite, candidate : BenchmarkArtifactSuite) -> Array[(String, Int, Int)]

Compare two suites by case name and work.

#
compare_domain_arrays

fn compare_domain_arrays(before : Array[Domain], after : Array[Domain]) -> Array[DomainChange]

Compare two domain arrays.

#
compare_evidence

fn compare_evidence(left : EvidenceBundle, right : EvidenceBundle) -> Int

Compare two evidence bundles.

#
compare_service_sets

fn compare_service_sets(baseline : Array[ServiceObservation], candidate : Array[ServiceObservation]) -> String

Return a report comparing two observation sets.

#
complete_coloring

fn complete_coloring(vertices : Int) -> GraphColoring?

Build a complete graph where every pair must receive different colors.

#
compose_relations

fn compose_relations(left : FiniteRelation, right : FiniteRelation) -> FiniteRelation?

Compose two relations.

#
constraint_builder

fn constraint_builder() -> ConstraintBuilder

Create an empty builder.

#
constraint_info

fn constraint_info(constraint : Constraint) -> ConstraintInfo

Build a structured diagnostic record.

#
constraint_kind

fn constraint_kind(constraint : Constraint) -> ConstraintKind

Return the semantic family of a constraint.

#
constraint_label

fn constraint_label(constraint : Constraint) -> String

Return a stable public label for a constraint.

#
constraint_recipe

fn constraint_recipe(builder : ConstraintBuilder) -> ConstraintRecipe

Create a recipe around a builder.

#
constraint_set

fn constraint_set() -> ConstraintSet

Create an empty constraint set.

#
constraint_variables

fn constraint_variables(constraint : Constraint) -> Array[Int]

Return all variable ids referenced by a constraint in stable order.

#
count_bundle

fn count_bundle(variables : Array[Int], value : Int, count : Int) -> ConstraintSet

Generate an exact count and its useful at-most/at-least decomposition.

#
count_false

fn count_false(values : Array[Bool]) -> Int

#
count_in_range

fn count_in_range(values : Array[Int], lower : Int, upper : Int) -> Int

#
count_true

fn count_true(values : Array[Bool]) -> Int

Count booleans.

#
count_value

fn count_value(variables : Array[Int], value : Int, count : Int) -> Constraint

Require exactly count variables to take value.

#
covered_duration

fn covered_duration(intervals : Array[TimelineInterval]) -> Int

Return the total covered duration after merging intervals.

#
critical_operations

fn critical_operations(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Array[Int]

Return the critical operation ids by finish time.

#
cumulative

fn cumulative(tasks : Array[(Int, Int, Int)], capacity : Int) -> Constraint

Limit the sum of active demands for interval tasks.

#
custom_event_kind

fn custom_event_kind() -> SimulationEventKind

Return the custom-event constructor for callers building integrations.

#
customers_by_depot_distance

fn customers_by_depot_distance(instance : RoutingInstance) -> Array[Int]

Return customers sorted by distance from the depot.

#
cycle_coloring

fn cycle_coloring(vertices : Int, color_count : Int) -> GraphColoring?

Build a cycle graph with vertices vertices.

#
cyclic_different

fn cyclic_different(variables : Array[Int]) -> ConstraintSet

Generate a cyclic adjacency rule for a sequence.

#
cyclic_latin_puzzle

fn cyclic_latin_puzzle(size : Int) -> LatinPuzzle?

Fill a cyclic Latin square.

#
decision_step

fn decision_step(variable : Int, value : Int, accepted : Bool, depth : Int) -> DecisionStep

Construct a decision record.

#
decision_trace

fn decision_trace() -> DecisionTrace

Create an empty decision trace.

#
default_model_limits

fn default_model_limits() -> ModelLimits

Practical limits for an embedded library use case.

#
default_search_config

fn default_search_config() -> SearchConfig

Construct the default deterministic configuration.

#
demand_first_plan

fn demand_first_plan(instance : RoutingInstance) -> RoutingPlan

Return a plan with customers ordered by descending demand.

#
descending_value_config

fn descending_value_config() -> SearchConfig

Configuration that tries large values first.

#
difference_matrix

fn difference_matrix(values : Array[Int]) -> IntMatrix

#
dispatch_schedule

fn dispatch_schedule(instance : ManufacturingInstance) -> ManufacturingSchedule

Schedule operations with a deterministic earliest-feasible dispatch.

#
distance

fn distance(left : Int, right : Int, distance : Int) -> Constraint

Require the absolute distance between two variables to equal distance.

#
distinct_attempt_signatures

fn distinct_attempt_signatures(attempts : Array[SolveAttempt]) -> Int

Return the number of distinct outcomes.

#
distinct_route_vehicles

fn distinct_route_vehicles(plan : RoutingPlan) -> Bool

Return whether every route has a distinct vehicle identifier.

#
domain

fn domain(lower : Int, upper : Int) -> Domain

Create a domain containing every integer in [lower, upper].

#
domain_add

fn domain_add(left : Domain, right : Domain) -> Domain?

Return all pairwise sums of two domains, if any pair exists.

#
domain_array_signature

fn domain_array_signature(domains : Array[Domain]) -> Int

Return a stable domain-array signature.

#
domain_candidate_count

fn domain_candidate_count(domains : Array[Domain]) -> Int

Return the total number of candidate values.

#
domain_catalog

fn domain_catalog() -> DomainCatalog

Create an empty catalog.

#
domain_change

fn domain_change(variable : Int, before : Domain, after : Domain) -> DomainChange

Compute a domain change.

#
domain_csv

fn domain_csv(domain : Domain) -> String

Render domain intervals as a machine-readable string.

#
domain_difference

fn domain_difference(left : Domain, right : Domain) -> Domain?

Return values in left that do not occur in right, when non-empty.

#
domain_entry

fn domain_entry(id : Int, name : String, value_domain : Domain, tag : String) -> DomainEntry

Create a domain entry.

#
domain_from_values

fn domain_from_values(values : Array[Int]) -> Domain

Create a domain from an arbitrary set of values.

Values outside the smallest enclosing interval are not stored separately; the interval is kept as the compact representation and the missing values are recorded as holes. Duplicate values are ignored.

#
domain_intersection

fn domain_intersection(left : Domain, right : Domain) -> Domain?

Return the intersection of two domains, or None if it is empty.

#
domain_interval

fn domain_interval(lower : Int, upper : Int) -> DomainInterval

Construct an interval.

#
domain_over_degree_config

fn domain_over_degree_config() -> SearchConfig

Configuration using domain-over-degree branching.

#
domain_subtract

fn domain_subtract(left : Domain, right : Domain) -> Domain?

Return all pairwise differences of two domains, if any pair exists.

#
domain_union

fn domain_union(left : Domain, right : Domain) -> Domain

Return the union of two domains.

#
due_date_order

fn due_date_order(instance : ManufacturingInstance) -> Array[Int]

Return operations ordered by earliest due date.

#
edge_set_weight

fn edge_set_weight(edges : Array[GraphEdge]) -> Int

Return the total weight of an edge set.

#
eight_queens_solution

fn eight_queens_solution() -> String?

Return a canonical placement for the eight-queens example.

#
element

fn element(index : Int, table : Array[Int], result : Int) -> Constraint

Constrain result to table[index].

#
empty_search_stats

fn empty_search_stats() -> SearchStats

Empty search statistics.

#
empty_sudoku

fn empty_sudoku() -> Sudoku

Build an empty Sudoku board.

#
equal

fn equal(left : Int, right : Int) -> Constraint

Shorthand constructors keep models readable at the call site.

#
equality_matrix

fn equality_matrix(values : Array[Int]) -> IntMatrix

Return a stable pairwise equality matrix.

#
equality_relation

fn equality_relation(size : Int) -> FiniteRelation

Build an equality relation on a finite range.

#
evaluate_scenario

fn evaluate_scenario(scenario : WhatIfScenario, score : Int, feasible : Bool) -> ScenarioEvaluation

Evaluate a scenario with a callback.

#
event_queue

fn event_queue() -> EventQueue

Create an empty queue.

#
evidence_bundle

fn evidence_bundle() -> EvidenceBundle

Create a bundle.

#
evidence_pass_count

fn evidence_pass_count(bundle : EvidenceBundle) -> Int

Return the number of passing records.

#
evidence_record

fn evidence_record(name : String, metric : String, value : Int, expected : Int, passed : Bool) -> EvidenceRecord

Create an evidence record.

#
evidence_summary

fn evidence_summary(bundle : EvidenceBundle) -> String

Return a stable evidence summary.

#
exactly_k

fn exactly_k(indicators : Array[Int], count : Int) -> ConstraintSet

Generate an exact-k Boolean cardinality encoding.

#
exhaustive_search_config

fn exhaustive_search_config(max_solutions : Int) -> SearchConfig

Construct a configuration suitable for exhaustive enumeration.

#
farthest_customer

fn farthest_customer(instance : RoutingInstance) -> Int?

Return the most distant customer from the depot.

#
feasible_scenario_count

fn feasible_scenario_count(evaluations : Array[ScenarioEvaluation]) -> Int

Return the number of feasible evaluations.

#
feature_selection

fn feature_selection(feature_count : Int, required : Int) -> Solver?

Build an exactly-one selection model for a menu or feature toggle list.

#
filled_matrix

fn filled_matrix(rows : Int, columns : Int, value : Int) -> IntMatrix

Create a filled matrix.

#
finite_relation

fn finite_relation(left_size : Int, right_size : Int) -> FiniteRelation

Create a relation.

#
first_differences

fn first_differences(values : Array[Int]) -> Array[Int]

Return first differences.

#
first_fit_bin

fn first_fit_bin(instance : AllocationInstance, plan : AllocationPlan, item : Int) -> Int?

Return the first bin with enough residual capacity.

#
first_late_stop

fn first_late_stop(instance : RoutingInstance, route : VehicleRoute) -> Int?

Return the first route position violating a time window.

#
first_solvable_n_queens

fn first_solvable_n_queens(lower : Int, upper : Int) -> Int?

Return the smallest known solution size that has a non-empty placement.

#
first_unassigned_config

fn first_unassigned_config() -> SearchConfig

Configuration using first-unassigned branching.

#
flow_balance

fn flow_balance(flow : IntMatrix, vertex : Int) -> Int

Return supply imbalance at a vertex.

#
flow_conserved

fn flow_conserved(flow : IntMatrix, source : Int, sink : Int) -> Bool

Return whether flow is conserved at all non-terminal vertices.

#
flow_in

fn flow_in(flow : IntMatrix, vertex : Int) -> Int

Return incoming flow to a vertex.

#
flow_out

fn flow_out(flow : IntMatrix, vertex : Int) -> Int

Return outgoing flow from a vertex.

#
flow_shop

fn flow_shop(jobs : Array[(String, Int, Int)], horizon : Int) -> ResourceSchedule?

Return a two-machine flow-shop example.

#
fm_abs

fn fm_abs(value : Int) -> Int

Exact integer mathematics used by finite-domain model builders.

#
fm_alternating_sum

fn fm_alternating_sum(values : Array[Int]) -> Int

#
fm_argmax

fn fm_argmax(values : Array[Int]) -> Int?

#
fm_argmin

fn fm_argmin(values : Array[Int]) -> Int?

#
fm_arithmetic_mean

fn fm_arithmetic_mean(left : Int, right : Int) -> Int

#
fm_bucket

fn fm_bucket(value : Int, lower : Int, width : Int) -> Int

#
fm_ceil_div

fn fm_ceil_div(left : Int, right : Int) -> Int

#
fm_checksum

fn fm_checksum(values : Array[Int]) -> Int

#
fm_choose

fn fm_choose(n : Int, k : Int) -> Int

#
fm_chunk

fn fm_chunk(values : Array[Int], size : Int) -> Array[Array[Int]]

#
fm_clamp

fn fm_clamp(value : Int, lower : Int, upper : Int) -> Int

#
fm_clamp_array

fn fm_clamp_array(values : Array[Int], lower : Int, upper : Int) -> Array[Int]

#
fm_contains_all

fn fm_contains_all(values : Array[Int], required : Array[Int]) -> Bool

#
fm_count_primes

fn fm_count_primes(lower : Int, upper : Int) -> Int

#
fm_count_value

fn fm_count_value(values : Array[Int], target : Int) -> Int

#
fm_difference

fn fm_difference(left : Array[Int], right : Array[Int]) -> Array[Int]

#
fm_distance

fn fm_distance(left : Int, right : Int) -> Int

#
fm_dot

fn fm_dot(left : Array[Int], right : Array[Int]) -> Int

#
fm_drop

fn fm_drop(values : Array[Int], count : Int) -> Array[Int]

#
fm_factorial

fn fm_factorial(value : Int) -> Int

#
fm_floor_div

fn fm_floor_div(left : Int, right : Int) -> Int

#
fm_gcd

fn fm_gcd(left : Int, right : Int) -> Int

#
fm_hamming

fn fm_hamming(left : Array[Int], right : Array[Int]) -> Int

#
fm_identity_permutation

fn fm_identity_permutation(size : Int) -> Array[Int]

#
fm_interpolate

fn fm_interpolate(left : Int, right : Int, numerator : Int, denominator : Int) -> Int

#
fm_intersection

fn fm_intersection(left : Array[Int], right : Array[Int]) -> Array[Int]

#
fm_is_even

fn fm_is_even(value : Int) -> Bool

#
fm_is_odd

fn fm_is_odd(value : Int) -> Bool

#
fm_is_permutation

fn fm_is_permutation(values : Array[Int], size : Int) -> Bool

#
fm_is_prime

fn fm_is_prime(value : Int) -> Bool

#
fm_is_sorted

fn fm_is_sorted(values : Array[Int]) -> Bool

#
fm_is_strictly_sorted

fn fm_is_strictly_sorted(values : Array[Int]) -> Bool

#
fm_l1

fn fm_l1(values : Array[Int]) -> Int

#
fm_lcm

fn fm_lcm(left : Int, right : Int) -> Int

#
fm_linf

fn fm_linf(values : Array[Int]) -> Int

#
fm_manhattan

fn fm_manhattan(left : Array[Int], right : Array[Int]) -> Int

#
fm_map_sign

fn fm_map_sign(values : Array[Int]) -> Array[Int]

#
fm_max

fn fm_max(left : Int, right : Int) -> Int

#
fm_midpoint

fn fm_midpoint(lower : Int, upper : Int) -> Int

#
fm_min

fn fm_min(left : Int, right : Int) -> Int

#
fm_mod_positive

fn fm_mod_positive(value : Int, modulus : Int) -> Int

#
fm_next_prime

fn fm_next_prime(value : Int) -> Int

#
fm_nonzero

fn fm_nonzero(values : Array[Int]) -> Array[Int]

#
fm_percent

fn fm_percent(value : Int, total : Int) -> Int

#
fm_permutation_parity

fn fm_permutation_parity(values : Array[Int]) -> Int

#
fm_pow

fn fm_pow(base : Int, exponent : Int) -> Int

#
fm_prefix

fn fm_prefix(values : Array[Int]) -> Array[Int]

#
fm_quantize

fn fm_quantize(value : Int, step : Int) -> Int

#
fm_range

fn fm_range(values : Array[Int]) -> Int

#
fm_range_sum

fn fm_range_sum(lower : Int, upper : Int) -> Int

#
fm_rank

fn fm_rank(value : Int, values : Array[Int]) -> Int

#
fm_repeat

fn fm_repeat(value : Int, count : Int) -> Array[Int]

#
fm_reverse

fn fm_reverse(values : Array[Int]) -> Array[Int]

#
fm_rotate

fn fm_rotate(values : Array[Int], offset : Int) -> Array[Int]

#
fm_saturating_add

fn fm_saturating_add(left : Int, right : Int, upper : Int) -> Int

#
fm_saturating_sub

fn fm_saturating_sub(left : Int, right : Int, lower : Int) -> Int

#
fm_sign

fn fm_sign(value : Int) -> Int

#
fm_signum_sum

fn fm_signum_sum(values : Array[Int]) -> Int

#
fm_sorted

fn fm_sorted(values : Array[Int]) -> Array[Int]

#
fm_suffix

fn fm_suffix(values : Array[Int]) -> Array[Int]

#
fm_swap

fn fm_swap(values : Array[Int], left : Int, right : Int) -> Bool

#
fm_take

fn fm_take(values : Array[Int], count : Int) -> Array[Int]

#
fm_union

fn fm_union(left : Array[Int], right : Array[Int]) -> Array[Int]

#
fm_unique

fn fm_unique(values : Array[Int]) -> Array[Int]

#
fm_weighted_average

fn fm_weighted_average(values : Array[Int], weights : Array[Int]) -> Int

#
fm_weighted_sum

fn fm_weighted_sum(values : Array[Int], weights : Array[Int]) -> Int

#
fm_wrap

fn fm_wrap(value : Int, lower : Int, upper : Int) -> Int

#
free_slot_duration

fn free_slot_duration(windows : Array[CalendarWindow], slots : Array[CalendarWindow]) -> Int

Return total duration of free slots.

#
free_slots

fn free_slots(windows : Array[CalendarWindow], slots : Array[CalendarWindow]) -> Array[Int]

Return free slots.

#
graph_coloring

fn graph_coloring(vertices : Int, color_count : Int, edges : Array[(Int, Int)]) -> GraphColoring?

Create a graph-coloring problem and post one inequality per edge.

#
graph_edge

fn graph_edge(from : Int, to : Int, weight : Int) -> GraphEdge

Construct an edge record.

#
greater_equal

fn greater_equal(left : Int, right : Int) -> Constraint

Require left >= right.

#
greater_than

fn greater_than(left : Int, right : Int) -> Constraint

Require left > right.

#
greedy_utility_subset

fn greedy_utility_subset(items : Array[UtilityItem], capacity : Int) -> Array[Int]

Select a greedy value-density subset.

#
grid_coloring

fn grid_coloring(rows : Int, columns : Int, color_count : Int) -> GraphColoring?

Build a rectangular grid graph for map-coloring examples.

#
grid_routing_points

fn grid_routing_points(width : Int, height : Int) -> Array[RoutingPoint]

Create a linearly spaced point set for deterministic examples.

#
group_bounds

fn group_bounds(variables : Array[Int], lower : Int, upper : Int) -> ConstraintSet

Generate lower and upper bound constraints for one variable group.

#
heaviest_item

fn heaviest_item(instance : AllocationInstance, plan : AllocationPlan, bin : Int) -> Int?

Return the heaviest assigned item in a bin.

#
heuristic_markdown

fn heuristic_markdown(results : Array[HeuristicResult]) -> String

Produce Markdown for comparative search output.

#
heuristic_result

fn heuristic_result(name : String, solutions : Int, stats : SearchStats) -> HeuristicResult

Construct a heuristic result.

#
heuristics_agree

fn heuristics_agree(results : Array[HeuristicResult]) -> Bool

Return whether all compared strategies found the same number of solutions.

#
identity_matrix

fn identity_matrix(size : Int) -> IntMatrix

Create an identity matrix.

#
improve_allocation

fn improve_allocation(instance : AllocationInstance, plan : AllocationPlan) -> Int

Improve bin balance through pair swaps.

#
improve_allocation_once

fn improve_allocation_once(instance : AllocationInstance, plan : AllocationPlan) -> Bool

Swap two items when it reduces the largest bin load.

#
improve_two_opt

fn improve_two_opt(instance : RoutingInstance, plan : RoutingPlan) -> Int

Apply the first improving 2-opt reversal found across all routes.

#
improve_utility_subset

fn improve_utility_subset(items : Array[UtilityItem], selected : Array[Int], capacity : Int) -> Array[Int]

Improve a subset through repeated swaps.

#
increasing_chain

fn increasing_chain(variables : Array[Int]) -> ConstraintSet

Generate a chain of strict inequalities.

#
indicator_rate

fn indicator_rate(values : Array[Int], target : Int) -> Int

#
indicator_sum

fn indicator_sum(values : Array[Int], target : Int) -> Int

#
int_matrix

fn int_matrix(rows : Int, columns : Int) -> IntMatrix

Create a zero-filled matrix.

#
int_matrix_from_values

fn int_matrix_from_values(rows : Int, columns : Int, values : Array[Int]) -> IntMatrix?

Create a matrix from row-major values.

#
integer_correlation

fn integer_correlation(left : Array[Int], right : Array[Int]) -> Int?

Return correlation scaled by 1,000, or None when undefined.

#
integer_covariance

fn integer_covariance(left : Array[Int], right : Array[Int], scale : Int) -> Int?

Return a scaled covariance.

#
integer_histogram

fn integer_histogram(lower : Int, width : Int, buckets : Int) -> IntegerHistogram

Create a histogram.

#
integer_indicators

fn integer_indicators(values : Array[Int], target : Int) -> Array[Int]

#
integer_mean

fn integer_mean(values : Array[Int]) -> Int

Return the integer mean or zero for an empty sample.

#
integer_median

fn integer_median(values : Array[Int]) -> Int?

Return the median of a sample.

#
integer_mode

fn integer_mode(values : Array[Int]) -> Int?

Return the mode, choosing the smallest value on ties.

#
integer_objective

fn integer_objective(values : Array[Int], directions : Array[PortfolioDirection]) -> IntegerObjective

Create an objective vector.

#
integer_outliers

fn integer_outliers(values : Array[Int], deviations : Int) -> Array[Int]

Return values outside mean plus or minus k standard deviations.

#
integer_percentile

fn integer_percentile(values : Array[Int], percent : Int) -> Int?

Return a percentile using nearest-rank selection.

#
integer_regression

fn integer_regression(x : Array[Int], y : Array[Int]) -> IntegerRegression?

Fit y = slope*x + intercept with slope scaled by 1,000.

#
integer_set

fn integer_set(values : Array[Int]) -> IntegerSet

Create a sorted set from arbitrary values.

#
integer_set_range

fn integer_set_range(lower : Int, upper : Int) -> IntegerSet

Create a consecutive integer set.

#
integer_sets_equal

fn integer_sets_equal(left : IntegerSet, right : IntegerSet) -> Bool

Return whether two sets are equal.

#
integer_sqrt

fn integer_sqrt(value : Int) -> Int

Return an integer square root.

#
integer_stddev

fn integer_stddev(values : Array[Int]) -> Int

Return population standard deviation as an integer.

#
integer_sum

fn integer_sum(values : Array[Int]) -> Int

Return the sum of a sample.

#
integer_summary

fn integer_summary(values : Array[Int]) -> IntegerSummary

Summarize an integer sample.

#
integer_tokens

fn integer_tokens(input : String) -> Array[Int]

Return all integer tokens in a document.

#
integer_variance

fn integer_variance(values : Array[Int]) -> Int

Return population variance using integer division.

#
interval_cover

fn interval_cover(universe_size : Int, intervals : Array[(Int, Int)]) -> SetCovering?

Return a fixed cover model for the common interval-covering case.

#
intervals_at

fn intervals_at(intervals : Array[TimelineInterval], time : Int) -> Array[Int]

Return intervals that contain a time point.

#
is_monotone_route

fn is_monotone_route(route : VehicleRoute) -> Bool

Return whether a route uses every stop in strictly increasing order.

#
job_operations

fn job_operations(instance : ManufacturingInstance, job : Int) -> Array[Int]

Return operation ids for a job in process order.

#
key_value

fn key_value(pairs : Array[(String, String)], key : String) -> String?

Find a key in key-value pairs.

#
knapsack

fn knapsack(names : Array[String], weights : Array[Int], values : Array[Int], capacity : Int) -> Knapsack?

Build a bounded 0/1 knapsack model.

#
largest_service_order

fn largest_service_order(observations : Array[ServiceObservation]) -> Int?

Return the largest quantity observation.

#
last_job_operation

fn last_job_operation(instance : ManufacturingInstance, job : Int) -> Int?

Return the last operation of a job.

#
late_jobs

fn late_jobs(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Array[Int]

Return jobs whose final operation is late.

#
late_observations

fn late_observations(observations : Array[ServiceObservation]) -> Array[Int]

Return late observations.

#
late_project_tasks

fn late_project_tasks(project : ProjectPlan, starts : Array[Int]) -> Array[Int]

Return tasks that finish after their due date.

#
latest_service_order

fn latest_service_order(observations : Array[ServiceObservation]) -> Int?

Return the most late observation.

#
latin_puzzle

fn latin_puzzle(size : Int) -> LatinPuzzle?

Create an empty Latin square.

#
latin_square

fn latin_square(size : Int) -> LatinSquare?

Build a Latin square over symbols 0..size-1.

#
least_loaded_bin

fn least_loaded_bin(instance : AllocationInstance, plan : AllocationPlan, item : Int) -> Int?

Return the least loaded bin that can receive an item.

#
less_equal

fn less_equal(left : Int, right : Int) -> Constraint

Require left <= right.

#
less_than

fn less_than(left : Int, right : Int) -> Constraint

Require left < right.

#
less_than_relation

fn less_than_relation(left_size : Int, right_size : Int) -> FiniteRelation

Build a less-than relation.

#
less_than_table

fn less_than_table(values : Array[Int]) -> RelationTable?

Return a table for left < right over a finite value set.

#
linear

fn linear(terms : Array[(Int, Int)], target : Int) -> Constraint

Require a weighted sum to equal target.

#
linear_builder

fn linear_builder() -> LinearBuilder

Start an empty linear expression.

#
linear_forecast

fn linear_forecast(values : Array[Int], steps : Int) -> Array[Int]

Return a simple linear forecast from the last value and average delta.

#
linear_greater_equal

fn linear_greater_equal(terms : Array[(Int, Int)], target : Int) -> Constraint

Require a weighted sum to be at least target.

#
linear_less_equal

fn linear_less_equal(terms : Array[(Int, Int)], target : Int) -> Constraint

Require a weighted sum to be at most target.

#
lines_within_width

fn lines_within_width(input : String, width : Int) -> Bool

Return whether all lines have a maximum width.

#
longest_assignment_run

fn longest_assignment_run(values : Array[Int]) -> Int

Return the longest run of one label.

#
longest_line

fn longest_line(input : String) -> Int

Return the longest line length.

#
loosest_resource

fn loosest_resource(metrics : Array[ResourceMetric]) -> Int?

Return the resource with maximum idle time.

#
machine_busy_time

fn machine_busy_time(instance : ManufacturingInstance, schedule : ManufacturingSchedule, machine : Int) -> Int

Return machine busy time.

#
machine_operations

fn machine_operations(instance : ManufacturingInstance, machine : Int) -> Array[Int]

Return all operation ids for a machine in schedule order.

#
machine_setup_transitions

fn machine_setup_transitions(instance : ManufacturingInstance, schedule : ManufacturingSchedule, machine : Int) -> Int

Return the number of setup transitions in a machine sequence.

#
machine_spec

fn machine_spec(id : Int, name : String, capacity : Int) -> MachineSpec

Create a machine specification.

#
machine_utilization

fn machine_utilization(instance : ManufacturingInstance, schedule : ManufacturingSchedule, machine : Int) -> Int

Return machine utilization as an integer percentage.

#
magic_square

fn magic_square(size : Int) -> MagicSquare?

Build a normal magic square model for a positive odd size.

#
manufacturing_feasible

fn manufacturing_feasible(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Bool

Return whether a schedule is valid.

#
manufacturing_instance

fn manufacturing_instance(machines : Array[MachineSpec], operations : Array[ManufacturingOperation], setup_matrix : Array[Array[Int]]) -> ManufacturingInstance?

Build an instance with a family-to-family setup matrix.

#
manufacturing_jobs

fn manufacturing_jobs(instance : ManufacturingInstance) -> Array[Int]

Return all job identifiers in ascending order.

#
manufacturing_makespan

fn manufacturing_makespan(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Int

Return the makespan.

#
manufacturing_objective

fn manufacturing_objective(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Int

Return a scalar schedule objective.

#
manufacturing_operation

fn manufacturing_operation(id : Int, job : Int, sequence : Int, machine : Int, setup : Int, duration : Int, family : Int, due : Int) -> ManufacturingOperation

Create an operation.

#
manufacturing_render

fn manufacturing_render(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> String

Render a schedule as a stable Gantt summary.

#
manufacturing_schedule

fn manufacturing_schedule(instance : ManufacturingInstance) -> ManufacturingSchedule

Create an empty schedule.

#
manufacturing_setup_work

fn manufacturing_setup_work(instance : ManufacturingInstance) -> Int

Return the total setup work.

#
manufacturing_signature

fn manufacturing_signature(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Int

Return a stable manufacturing fingerprint.

#
manufacturing_tardiness

fn manufacturing_tardiness(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Int

Return the total tardiness.

#
manufacturing_work

fn manufacturing_work(instance : ManufacturingInstance) -> Int

Return the total processing work.

#
matrix_all_different

fn matrix_all_different(matrix : Array[Array[Int]], rows : Int, columns : Int) -> ConstraintSet?

Generate row and column constraints for a rectangular matrix.

#
matrix_sum_constraints

fn matrix_sum_constraints(matrix : Array[Array[Int]], rows : Int, columns : Int, row_target : Int, column_target : Int) -> ConstraintSet?

Generate a Latin-square line-sum system.

#
maximize

fn maximize() -> OptimizationDirection

Select maximization without constructing the enum directly.

#
maximum

fn maximum(variables : Array[Int], result : Int) -> Constraint

Bind result to the maximum value in variables.

#
maximum_degree_config

fn maximum_degree_config() -> SearchConfig

Configuration favoring highly constrained variables.

#
median_value_config

fn median_value_config() -> SearchConfig

Configuration that tries the middle of a domain first.

#
merge_calendar_windows

fn merge_calendar_windows(windows : Array[CalendarWindow]) -> Array[CalendarWindow]

Merge overlapping and touching windows.

#
merge_timeline_intervals

fn merge_timeline_intervals(intervals : Array[TimelineInterval]) -> Array[TimelineInterval]

Merge adjacent intervals with the same resource and label.

#
minimize

fn minimize() -> OptimizationDirection

Select minimization without constructing the enum directly.

#
minimum

fn minimum(variables : Array[Int], result : Int) -> Constraint

Bind result to the minimum value in variables.

#
minimum_capacity_slack

fn minimum_capacity_slack(instance : RoutingInstance, plan : RoutingPlan) -> Int

Return the smallest non-negative capacity residual, or -1 when infeasible.

#
minimum_residual_capacity

fn minimum_residual_capacity(instance : AllocationInstance, plan : AllocationPlan) -> Int

Return the minimum residual capacity.

#
missing_assignment_categories

fn missing_assignment_categories(values : Array[Int], category_count : Int) -> Array[Int]

Return category labels absent from a sequence.

#
model_evidence

fn model_evidence(report : ModelReport) -> EvidenceBundle

Build model evidence.

#
model_limits

fn model_limits(max_variables : Int, max_constraints : Int, max_domain_size : Int) -> ModelLimits

Construct model limits with positive defaults for invalid values.

#
model_report

fn model_report(name : String, solver : Solver, solved : Bool, solutions : Int) -> ModelReport

Build a report from a solver.

#
model_report_header

fn model_report_header() -> String

Return a markdown table header.

#
model_reports_signature

fn model_reports_signature(reports : Array[ModelReport]) -> Int

Return a report signature.

#
model_schema

fn model_schema(name : String) -> ModelSchema

Create an empty schema.

#
most_expensive_report

fn most_expensive_report(reports : Array[ModelReport]) -> ModelReport?

Return the most expensive report.

#
most_valuable_item

fn most_valuable_item(instance : AllocationInstance, plan : AllocationPlan, bin : Int) -> Int?

Return the most valuable assigned item in a bin.

#
movable_task

fn movable_task(project : ProjectPlan, starts : Array[Int]) -> Int?

Return the first task that can be moved later without breaking successors.

#
moving_average

fn moving_average(values : Array[Int], window : Int) -> Array[Int]

Return moving averages with a fixed window.

#
n_queens

fn n_queens(size : Int) -> NQueens?

Build an N-Queens model using all-different columns and diagonal distance constraints. The model is useful as a deterministic search benchmark.

#
n_queens_with_first_column

fn n_queens_with_first_column(size : Int, first_column : Int) -> NQueens?

Build a fixed-size N-Queens model with a preferred first row.

#
nearest_neighbor_plan

fn nearest_neighbor_plan(instance : RoutingInstance) -> RoutingPlan

Construct a deterministic nearest-neighbor seed plan.

#
new_model

fn new_model() -> ModelBuilder

Start a new named model.

#
new_solver

fn new_solver() -> Solver

Create an empty model using MRV and ascending value order.

#
no_overlap

fn no_overlap(tasks : Array[(Int, Int)]) -> Constraint

Require intervals (start variable, duration) not to overlap.

#
non_attacking_diagonals

fn non_attacking_diagonals(positions : Array[Int]) -> ConstraintSet

Generate non-attacking diagonal constraints for row-position variables.

#
non_overlapping_intervals

fn non_overlapping_intervals(intervals : Array[(Int, Int)]) -> ConstraintSet

Generate interval non-overlap constraints.

#
nondecreasing_chain

fn nondecreasing_chain(variables : Array[Int]) -> ConstraintSet

Generate a chain of non-strict inequalities.

#
nonogram_line

fn nonogram_line(length : Int, clues : Array[Int]) -> NonogramLine?

Create a nonogram line clue.

#
nonogram_puzzle

fn nonogram_puzzle(rows : Array[NonogramLine], columns : Array[NonogramLine]) -> NonogramPuzzle?

Create a blank nonogram puzzle.

#
normalize_objective

fn normalize_objective(value : Int, lower : Int, upper : Int) -> Int

Return a min/max normalized score.

#
not_distance

fn not_distance(left : Int, right : Int, distance : Int) -> Constraint

Require two variables not to be at an exact absolute distance.

#
not_equal

fn not_equal(left : Int, right : Int) -> Constraint

Require two variables to take different values.

#
not_equal_table

fn not_equal_table(values : Array[Int]) -> RelationTable?

Return a table for left != right over a finite value set.

#
objective

fn objective(terms : Array[ObjectiveTerm]) -> Objective

Construct an objective from ordered terms.

#
objective_from_directions

fn objective_from_directions(variables : Array[Int], directions : Array[OptimizationDirection]) -> Objective?

Build a lexicographic objective from parallel arrays.

#
objective_meets

fn objective_meets(direction : PortfolioDirection, value : Int, bound : Int) -> Bool

Return whether an objective value meets a bound.

#
objective_row_signature

fn objective_row_signature(row : Array[Int]) -> Int

Return an objective row signature.

#
objective_term

fn objective_term(variable : Int, direction : OptimizationDirection, weight : Int) -> ObjectiveTerm

Create an objective component with a non-zero weight.

#
observations_from_times

fn observations_from_times(promised : Array[Int], actual : Array[Int], penalty : Int) -> Array[ServiceObservation]

Create observations from promised and actual sequences.

#
occupied_slots

fn occupied_slots(windows : Array[CalendarWindow], slots : Array[CalendarWindow]) -> Array[Int]

Return slots occupied by any window.

#
on_time_observations

fn on_time_observations(observations : Array[ServiceObservation]) -> Array[Int]

Return on-time observations.

#
one_hot

fn one_hot(indicators : Array[Int]) -> ConstraintSet

Generate a one-hot Boolean encoding.

#
operation_finish

fn operation_finish(instance : ManufacturingInstance, schedule : ManufacturingSchedule, operation : Int) -> Int

Return operation finish time.

#
operational_backlog

fn operational_backlog(ledger : OperationalLedger) -> Int

#
operational_capacity_ok

fn operational_capacity_ok(ledger : OperationalLedger, maximum_backlog : Int) -> Bool

#
operational_delta

fn operational_delta(left : OperationalSummary, right : OperationalSummary) -> OperationalSummary

#
operational_failed

fn operational_failed() -> OperationalState

#
operational_health_score

fn operational_health_score(ledger : OperationalLedger) -> Int

#
operational_ledger

fn operational_ledger() -> OperationalLedger

#
operational_merge

fn operational_merge(left : OperationalLedger, right : OperationalLedger) -> OperationalLedger

#
operational_next_state

fn operational_next_state(current : OperationalState, success : Bool) -> OperationalState

#
operational_queued

fn operational_queued() -> OperationalState

#
operational_record

fn operational_record(key : String, state : OperationalState, started_at : Int, finished_at : Int, attempts : Int, output_count : Int, error_code : Int) -> OperationalRecord

#
operational_record_duration

fn operational_record_duration(record : OperationalRecord) -> Int

#
operational_record_failure

fn operational_record_failure(record : OperationalRecord) -> Bool

#
operational_record_repair

fn operational_record_repair(record : OperationalRecord) -> OperationalRecord

#
operational_record_retryable

fn operational_record_retryable(record : OperationalRecord) -> Bool

#
operational_record_success

fn operational_record_success(record : OperationalRecord) -> Bool

#
operational_record_terminal

fn operational_record_terminal(record : OperationalRecord) -> Bool

#
operational_record_valid

fn operational_record_valid(record : OperationalRecord) -> Bool

#
operational_records_sorted_by_finish

fn operational_records_sorted_by_finish(records : Array[OperationalRecord]) -> Array[OperationalRecord]

#
operational_records_terminal

fn operational_records_terminal(records : Array[OperationalRecord]) -> Bool

#
operational_records_total_output

fn operational_records_total_output(records : Array[OperationalRecord]) -> Int

#
operational_retry_state

fn operational_retry_state(record : OperationalRecord) -> OperationalState

#
operational_running

fn operational_running() -> OperationalState

#
operational_score

fn operational_score(completion_percent : Int, violations : Int, penalty : Int) -> Int

Return an operational score from completion and violations.

#
operational_skipped

fn operational_skipped() -> OperationalState

#
operational_state_equal

fn operational_state_equal(left : OperationalState, right : OperationalState) -> Bool

#
operational_state_name

fn operational_state_name(state : OperationalState) -> String

#
operational_state_terminal

fn operational_state_terminal(state : OperationalState) -> Bool

#
operational_succeeded

fn operational_succeeded() -> OperationalState

#
operational_summary_balance

fn operational_summary_balance(summary : OperationalSummary) -> Bool

#
operational_summary_report

fn operational_summary_report(summary : OperationalSummary) -> String

#
operational_summary_valid

fn operational_summary_valid(summary : OperationalSummary) -> Bool

#
operational_window

fn operational_window(ledger : OperationalLedger, start : Int, finish : Int) -> Array[OperationalRecord]

#
operational_window_output

fn operational_window_output(ledger : OperationalLedger, start : Int, finish : Int) -> Int

#
overloaded_capacity_points

fn overloaded_capacity_points(project : ProjectPlan, starts : Array[Int]) -> Array[PlanningCapacityPoint]

Return overloaded capacity points.

#
overloaded_resources

fn overloaded_resources(metrics : Array[ResourceMetric]) -> Array[Int]

Return overloaded resource ids.

#
pairwise_assignment_changes

fn pairwise_assignment_changes(values : Array[Int]) -> Bool

Return whether every adjacent pair is different.

#
pairwise_distance_sum

fn pairwise_distance_sum(values : Array[Int]) -> Int

#
pareto_rows

fn pareto_rows(rows : Array[Array[Int]], directions : Array[PortfolioDirection]) -> Array[Array[Int]]

Return nondominated rows.

#
parse_csv

fn parse_csv(input : String) -> Array[Array[String]]

Parse a CSV document.

#
parse_csv_row

fn parse_csv_row(input : String) -> Array[String]

Parse one CSV row with quoted fields.

#
parse_domain

fn parse_domain(input : String) -> Domain?

Parse a finite domain from a comma-separated integer list.

#
parse_edge_list

fn parse_edge_list(input : String, vertices : Int, directed : Bool) -> WeightedGraph?

Parse a small edge list with one from,to,weight row per line.

#
parse_int_matrix

fn parse_int_matrix(input : String) -> IntMatrix?

Parse a rectangular integer CSV matrix.

#
parse_integer_list

fn parse_integer_list(input : String) -> Array[Int]?

Parse a comma-separated integer list.

#
parse_integer_sequence

fn parse_integer_sequence(input : String) -> Array[Int]?

Parse a whitespace-separated integer sequence.

#
parse_key_values

fn parse_key_values(input : String) -> Array[(String, String)]

Parse key-value pairs separated by =.

#
plan_csv

fn plan_csv(plan : RoutingPlan) -> String

Render all routes as CSV rows.

#
plan_distance

fn plan_distance(instance : RoutingInstance, plan : RoutingPlan) -> Int

Return a plan's total travel distance.

#
plan_load

fn plan_load(instance : RoutingInstance, plan : RoutingPlan) -> Int

Return a plan's total load.

#
plan_makespan

fn plan_makespan(instance : RoutingInstance, plan : RoutingPlan) -> Int

Return a plan's largest route distance.

#
plan_objective

fn plan_objective(instance : RoutingInstance, plan : RoutingPlan) -> Int

Return a plan-level objective with deterministic penalties.

#
plan_visit_count

fn plan_visit_count(plan : RoutingPlan) -> Int

Return the number of customers served by a plan.

#
planning_capacity_point

fn planning_capacity_point(resource : Int, time : Int, load : Int, capacity : Int) -> PlanningCapacityPoint

Create a capacity point.

#
planning_chain

fn planning_chain(count : Int, duration : Int, resource : Int, demand : Int, horizon : Int, capacity : Int) -> ProjectPlan?

Construct a chain of equal-duration tasks.

#
planning_dependency

fn planning_dependency(before : Int, after : Int, lag : Int) -> PlanningDependency

Create a dependency with a minimum lag after the predecessor.

#
planning_task

fn planning_task(id : Int, name : String, duration : Int, resource : Int, demand : Int) -> PlanningTask

Create a task with no release restriction and an open due date.

#
portfolio_audit

fn portfolio_audit(pool : SolutionPool) -> PortfolioAudit

Summarize a portfolio.

#
portfolio_direction

fn portfolio_direction(prefer_low : Bool) -> PortfolioDirection

Choose the direction for a scalar metric.

#
portfolio_objective_term

fn portfolio_objective_term(name : String, direction : PortfolioDirection, weight : Int) -> PortfolioObjectiveTerm

Construct an objective term.

#
post_absolute_table

fn post_absolute_table(solver : Solver, source : Int, result : Int, source_domain : Domain) -> Unit

Post an absolute-value relation.

#
post_addition

fn post_addition(solver : Solver, left : Int, right : Int, result : Int, left_domain : Domain, right_domain : Domain) -> Unit

Post a finite addition relation result = left + right.

#
post_arithmetic_relation

fn post_arithmetic_relation(solver : Solver, left : Int, right : Int, result : Int, left_domain : Domain, right_domain : Domain, operation : (Int, Int) -> Int) -> Bool

Post a finite custom arithmetic relation.

#
post_assignments

fn post_assignments(solver : Solver, variables : Array[Int], values : Array[Int]) -> Bool

Add a sequence of fixed assignments to a model.

#
post_at_most_one

fn post_at_most_one(solver : Solver, indicators : Array[Int]) -> Unit

Post at-most-one for Boolean indicator variables.

#
post_binary_table

fn post_binary_table(solver : Solver, left : Int, right : Int, relation : RelationTable) -> Bool

Post a binary relation table for two variables.

#
post_binary_vector

fn post_binary_vector(builder : ConstraintBuilder, variables : Array[Int]) -> Bool

Add a zero-or-one vector constraint.

#
post_boolean_and

fn post_boolean_and(solver : Solver, left : Int, right : Int, result : Int) -> Unit

Post Boolean conjunction.

#
post_boolean_equivalent

fn post_boolean_equivalent(solver : Solver, left : Int, right : Int) -> Unit

Post Boolean equivalence.

#
post_boolean_implies

fn post_boolean_implies(solver : Solver, left : Int, right : Int) -> Unit

Post implication left -> right.

#
post_boolean_not

fn post_boolean_not(solver : Solver, input : Int, result : Int) -> Unit

Post a unary Boolean negation relation: result = !input.

#
post_boolean_or

fn post_boolean_or(solver : Solver, left : Int, right : Int, result : Int) -> Unit

Post Boolean disjunction.

#
post_boolean_xor

fn post_boolean_xor(solver : Solver, left : Int, right : Int, result : Int) -> Unit

Post exclusive-or.

#
post_chain_not_equal

fn post_chain_not_equal(solver : Solver, variables : Array[Int]) -> Unit

Add a pairwise inequality chain to a model.

#
post_clause

fn post_clause(solver : Solver, literals : Array[(Int, Bool)]) -> Bool

Post a disjunctive clause over positive or negative literals. A literal is encoded as (variable, polarity), where polarity true means the variable itself and false means its negation.

#
post_division_table

fn post_division_table(solver : Solver, dividend : Int, divisor : Int, result : Int, dividend_domain : Domain, divisor_domain : Domain) -> Bool

Post an integer division relation for a non-zero divisor.

#
post_exactly_k

fn post_exactly_k(solver : Solver, indicators : Array[Int], count : Int) -> Unit

Post an exactly-k cardinality constraint over Boolean indicators.

#
post_exactly_one

fn post_exactly_one(solver : Solver, indicators : Array[Int]) -> Unit

Post exactly-one for Boolean indicator variables.

#
post_indicator

fn post_indicator(builder : ConstraintBuilder, source : Int, value : Int, indicator : Int) -> Bool

Create a Boolean indicator for an exact value through a two-row table.

#
post_maximum_table

fn post_maximum_table(solver : Solver, left : Int, right : Int, result : Int, left_domain : Domain, right_domain : Domain) -> Unit

Post a maximum relation for two input variables.

#
post_minimum_table

fn post_minimum_table(solver : Solver, left : Int, right : Int, result : Int, left_domain : Domain, right_domain : Domain) -> Unit

Post a minimum relation for two input variables.

#
post_modulo_table

fn post_modulo_table(solver : Solver, dividend : Int, divisor : Int, result : Int, dividend_domain : Domain, divisor_domain : Domain) -> Bool

Post a modulo relation for a positive divisor.

#
post_one_hot

fn post_one_hot(builder : ConstraintBuilder, indicators : Array[Int]) -> Bool

Add a one-hot vector constraint.

#
post_pairwise_different

fn post_pairwise_different(solver : Solver, variables : Array[Int]) -> Unit

Add all pairwise inequality constraints for small models.

#
post_product

fn post_product(solver : Solver, left : Int, right : Int, result : Int, left_domain : Domain, right_domain : Domain) -> Unit

Post a finite product relation.

#
post_reified_equal

fn post_reified_equal(solver : Solver, indicator : Int, left : Int, right : Int, left_domain : Domain, right_domain : Domain) -> Unit

Post a reified equality: indicator=1 iff left=right.

#
post_reified_less_than

fn post_reified_less_than(solver : Solver, indicator : Int, left : Int, right : Int, left_domain : Domain, right_domain : Domain) -> Unit

Post a reified ordering: indicator=1 iff left<right.

#
post_relation_pairs

fn post_relation_pairs(solver : Solver, left : Int, right : Int, left_domain : Domain, right_domain : Domain, predicate : (Int, Int) -> Bool) -> Bool

Post any binary finite relation supplied by the caller.

#
post_subtraction

fn post_subtraction(solver : Solver, left : Int, right : Int, result : Int, left_domain : Domain, right_domain : Domain) -> Unit

Post a finite subtraction relation result = left - right.

#
primary_ties

fn primary_ties(pool : SolutionPool) -> Array[SolutionRecord]

Return all records with the best primary objective.

#
probe_batch

fn probe_batch() -> ProbeBatch

Create an empty probe batch.

#
project_capacity_points

fn project_capacity_points(project : ProjectPlan, starts : Array[Int]) -> Array[PlanningCapacityPoint]

Return all project capacity points.

#
project_dependency_count

fn project_dependency_count(project : ProjectPlan) -> Int

Return the number of dependency arcs.

#
project_plan

fn project_plan(tasks : Array[PlanningTask], horizon : Int, capacities : Array[Int]) -> ProjectPlan?

Construct a project plan and its start variables.

#
project_planning_report

fn project_planning_report(project : ProjectPlan, starts : Array[Int]) -> String

Return a compact planning report.

#
project_predecessor_count

fn project_predecessor_count(project : ProjectPlan) -> Int

Return the total number of predecessor relationships.

#
project_schedule_score

fn project_schedule_score(project : ProjectPlan, starts : Array[Int]) -> Int

Return a project schedule score.

#
project_tardiness

fn project_tardiness(project : ProjectPlan, starts : Array[Int]) -> Int

Return total tardiness.

#
pruning_explanation

fn pruning_explanation() -> PruningExplanation

Create an empty explanation.

#
pruning_reason

fn pruning_reason(variable : Int, value : Int, constraint : String, detail : String) -> PruningReason

Create a pruning reason.

#
quality_gate_result

fn quality_gate_result(name : String, status : QualityStatus, observed : Int, threshold : Int, detail : String) -> QualityGateResult

Construct a result.

#
quality_review

fn quality_review() -> QualityReview

Create an empty review.

#
quality_score

fn quality_score(review : QualityReview) -> Int

#
queue_length_trace

fn queue_length_trace(simulation : QueueSimulation) -> Int

Return the maximum queue length observed in a trace.

#
queue_simulation

fn queue_simulation(horizon : Int, entities : Array[SimulationEntity]) -> QueueSimulation?

Create a queue simulation and seed arrivals.

#
quota_sequence

fn quota_sequence(length : Int, lower : Int, upper : Int, total : Int, maximum_run : Int) -> SequenceModel?

Build a bounded sequence with a fixed total and no long runs.

#
range_completion

fn range_completion(values : Array[Int], lower : Int, upper : Int) -> Int

#
rebalance

fn rebalance(instance : AllocationInstance, plan : AllocationPlan) -> Int

Apply local balancing until no improving move remains.

#
rebalance_once

fn rebalance_once(instance : AllocationInstance, plan : AllocationPlan) -> Bool

Move one item from a heavier bin to a lighter feasible bin.

#
recipe_balanced_binary

fn recipe_balanced_binary(recipe : ConstraintRecipe, name : String, length : Int, ones : Int) -> Array[Int]

Add a balanced binary vector.

#
recipe_coloring

fn recipe_coloring(recipe : ConstraintRecipe, name : String, vertices : Int, colors : Int, edges : Array[(Int, Int)]) -> Array[Int]

Add a graph coloring vector.

#
recipe_coverage

fn recipe_coverage(recipe : ConstraintRecipe, name : String, slots : Int, workers : Int, per_worker : Int) -> Array[Int]

Add a worker coverage vector.

#
recipe_interval_chain

fn recipe_interval_chain(recipe : ConstraintRecipe, name : String, count : Int, horizon : Int, duration : Int) -> Array[Int]

Add an interval chain.

#
recipe_knapsack

fn recipe_knapsack(recipe : ConstraintRecipe, name : String, weights : Array[Int], capacity : Int) -> Array[Int]

Add a bounded knapsack selection vector.

#
recipe_latin

fn recipe_latin(recipe : ConstraintRecipe, name : String, size : Int) -> Array[Int]

Add a Latin square.

#
recipe_magic_square

fn recipe_magic_square(recipe : ConstraintRecipe, name : String, size : Int) -> Array[Int]

Add a magic-square sum model.

#
recipe_permutation

fn recipe_permutation(recipe : ConstraintRecipe, name : String, size : Int) -> Array[Int]

Add a finite-domain permutation.

#
recipe_resource_chain

fn recipe_resource_chain(recipe : ConstraintRecipe, name : String, count : Int, horizon : Int, duration : Int, height : Int, capacity : Int) -> Array[Int]

Add a cumulative resource chain.

#
recipe_result

fn recipe_result() -> RecipeResult

Create an empty recipe result.

#
recipe_rotating_roster

fn recipe_rotating_roster(recipe : ConstraintRecipe, name : String, slots : Int, workers : Int) -> Array[Int]

Add a roster with no adjacent repeated worker.

#
recipe_sequence

fn recipe_sequence(recipe : ConstraintRecipe, name : String, length : Int, lower : Int, upper : Int) -> Array[Int]

Add a bounded sequence with adjacent changes.
fn recommended_capacity(metric : ResourceMetric, target_percent : Int) -> Int

Return a capacity recommendation for a target utilization percentage.

#
rectangle_sum

fn rectangle_sum(prefix : IntMatrix, top : Int, left : Int, bottom : Int, right : Int) -> Int?

Query an inclusive rectangle sum using a prefix matrix.

#
redact_key_values

fn redact_key_values(input : String, keys : Array[String], replacement : String) -> String

Redact values after configured key prefixes.

#
regressed

fn regressed(baseline : Int, candidate : Int, tolerance_percent : Int) -> Bool

Return whether a metric regressed beyond a tolerance percentage.

#
relation_pair

fn relation_pair(left : Int, right : Int) -> RelationPair

Construct a relation pair.

#
relation_pairs

fn relation_pairs(left : Domain, right : Domain, predicate : (Int, Int) -> Bool) -> Array[Array[Int]]

Return all finite pairs that satisfy a predicate.

#
relation_table

fn relation_table(rows : Array[Array[Int]]) -> RelationTable?

Build a relation table from rows with a common arity.

#
render_csv

fn render_csv(rows : Array[Array[String]]) -> String

Render CSV rows.

#
render_csv_row

fn render_csv_row(fields : Array[String]) -> String

Render a CSV row with quote escaping.

#
render_integer_sequence

fn render_integer_sequence(values : Array[Int]) -> String

Render integer values with stable spacing.

#
render_model_reports

fn render_model_reports(reports : Array[ModelReport]) -> String

Render reports as a markdown table.

#
repair_capacity

fn repair_capacity(instance : RoutingInstance, plan : RoutingPlan) -> Int

Move one customer from an overloaded route to the best insertion point.

#
repeat_benchmark

fn repeat_benchmark(name : String, repeats : Int, run : () -> BenchmarkResult) -> BenchmarkResult

Aggregate counters across repeated deterministic runs.

#
replace_text

fn replace_text(input : String, target : String, replacement : String) -> String

Replace all occurrences of a substring.

#
report_within_tolerance

fn report_within_tolerance(baseline : ModelReport, candidate : ModelReport, tolerance_percent : Int) -> Bool

Return whether the candidate is within a work tolerance.

#
report_work_change_percent

fn report_work_change_percent(baseline : ModelReport, candidate : ModelReport) -> Int?

Return a regression ratio in integer percentage points.

#
residual_reachable

fn residual_reachable(residual : IntMatrix, source : Int) -> Array[Int]

Return vertices reachable from source in the residual network.

#
resource_balance_score

fn resource_balance_score(metrics : Array[ResourceMetric]) -> Int

Return a scaled load balance score.

#
resource_metric

fn resource_metric(resource : Int, capacity : Int, profile : Array[Int]) -> ResourceMetric

Build a metric from a profile.

#
resource_metrics_report

fn resource_metrics_report(metrics : Array[ResourceMetric]) -> String

Return a report of metrics.

#
resource_metrics_signature

fn resource_metrics_signature(metrics : Array[ResourceMetric]) -> Int

Return a stable metrics fingerprint.

#
resource_scenario

fn resource_scenario() -> Scenario

Return a small resource scheduling scenario.

#
resource_schedule

fn resource_schedule(horizon : Int, capacity : Int) -> ResourceSchedule?

Create an empty resource schedule.

#
resource_timeline

fn resource_timeline(horizon : Int, capacities : Array[Int]) -> ResourceTimeline?

Create an empty timeline.

#
result_counter

fn result_counter() -> ResultCounter

#
review_project

fn review_project(project : ProjectPlan, starts : Array[Int]) -> QualityReview

Check a project schedule.

#
review_routing

fn review_routing(instance : RoutingInstance, plan : RoutingPlan) -> QualityReview

Check a route plan.

#
review_solver

fn review_solver(solver : Solver, solution : Solution?) -> QualityReview

Check a solver model and optional solution.

#
review_timeline

fn review_timeline(timeline : ResourceTimeline) -> QualityReview

Check a resource timeline.

#
risk_band

fn risk_band(score : Int) -> RiskBand

Classify a score.

#
risk_band_name

fn risk_band_name(band : RiskBand) -> String

Return a stable band label.

#
risk_item

fn risk_item(id : Int, name : String, likelihood : Int, impact : Int, mitigation : Int) -> RiskItem

Create a risk item with values in 0..100.

#
risk_meets_target

fn risk_meets_target(item : RiskItem, target : Int) -> Bool

Return whether residual risk meets a target.

#
risk_priority

fn risk_priority(item : RiskItem) -> Int

Return the risk-weighted mitigation priority.

#
risk_scenario

fn risk_scenario(items : Array[RiskItem], budget : Int) -> RiskScenario

Create a risk scenario.

#
risk_sensitivity

fn risk_sensitivity(item : RiskItem, likelihood_delta : Int) -> Int

Return sensitivity of residual risk to a likelihood change.

#
rolling_majority

fn rolling_majority(values : Array[Int], window : Int) -> Array[Int]

Return a rolling majority label.

#
roster_model

fn roster_model(workers : Int, days : Int, shifts : Int) -> RosterModel?

Build an unconstrained roster with one shift variable per worker/day.

#
rotating_roster

fn rotating_roster(workers : Int, days : Int) -> RosterModel?

Build a small rotating-shift roster template.

#
rotating_schedule

fn rotating_schedule(people : Int, days : Int, shifts : Int) -> ScheduleProblem?

Return a canonical small rotating schedule used by docs and benchmarks.

#
round_robin_plan

fn round_robin_plan(instance : RoutingInstance) -> RoutingPlan

Return a plan created by assigning each customer round-robin.

#
route_arrivals

fn route_arrivals(instance : RoutingInstance, route : VehicleRoute) -> Array[Int]

Arrival and departure times for a route under its time windows.

#
route_crossings

fn route_crossings(instance : RoutingInstance, route : VehicleRoute) -> Int

Return the number of route crossings in a coordinate instance.

#
route_csv

fn route_csv(route : VehicleRoute) -> String

Return a compact CSV row for a route.

#
route_distance

fn route_distance(instance : RoutingInstance, route : VehicleRoute) -> Int

Route distance including the depot departure and return.

#
route_load

fn route_load(instance : RoutingInstance, route : VehicleRoute) -> Int

Sum customer demand on a route.

#
route_objective

fn route_objective(instance : RoutingInstance, route : VehicleRoute) -> Int

Return a route-level objective combining distance, lateness, and crossings.

#
route_service

fn route_service(instance : RoutingInstance, route : VehicleRoute) -> Int

Return the route's service time excluding travel.

#
route_slacks

fn route_slacks(instance : RoutingInstance, route : VehicleRoute) -> Array[Int]

Return a route's cumulative arrival slack values.

#
routing_ids_are_dense

fn routing_ids_are_dense(instance : RoutingInstance) -> Bool

Return whether every point identifier matches its array position.

#
routing_instance

fn routing_instance(points : Array[RoutingPoint], depot : Int, capacities : Array[Int]) -> RoutingInstance?

Build a routing instance from customer points and vehicle capacities.

#
routing_instance_with_distances

fn routing_instance_with_distances(points : Array[RoutingPoint], depot : Int, capacities : Array[Int], distances : Array[Array[Int]]) -> RoutingInstance?

Build a square instance with an explicit distance matrix.

#
routing_matrix

fn routing_matrix(plan : RoutingPlan) -> Array[Array[Int]]

Return a plan's visit sequence grouped by vehicle.

#
routing_plan

fn routing_plan(vehicle_count : Int) -> RoutingPlan

Create an empty plan with one route per vehicle.

#
routing_point

fn routing_point(id : Int, x : Int, y : Int, demand : Int) -> RoutingPoint

Create a customer or depot point with a wide time window.

#
routing_report

fn routing_report(instance : RoutingInstance, plan : RoutingPlan) -> RoutingReport

Produce a report without mutating the plan.

#
routing_score

fn routing_score(instance : RoutingInstance, plan : RoutingPlan) -> Int

A scalar score useful for comparing heuristic plans.

#
routing_signature

fn routing_signature(instance : RoutingInstance, plan : RoutingPlan) -> Int

Return an integer route signature for caching and regression tests.

#
same_int_array

fn same_int_array(left : Array[Int], right : Array[Int]) -> Bool

Return whether two integer assignments are equal.

#
same_project_order

fn same_project_order(project : ProjectPlan, left : Array[Int], right : Array[Int]) -> Bool

Return whether two project schedules have the same precedence order.

#
scenario

fn scenario(name : String, solver : Solver, expected_solutions : Int) -> Scenario

Construct a scenario record.

#
scenario_axis

fn scenario_axis(name : String, values : Array[Int]) -> ScenarioAxis

Create an axis.

#
scenario_evaluation_signature

fn scenario_evaluation_signature(evaluation : ScenarioEvaluation) -> Int

Return a stable evaluation fingerprint.

#
scenario_product

fn scenario_product(axes : Array[ScenarioAxis], limit : Int) -> Array[WhatIfScenario]

Generate all combinations up to a hard limit.

#
scenario_product_size

fn scenario_product_size(axes : Array[ScenarioAxis], limit : Int) -> Int

Return the number of combinations, capped at a limit.

#
scenario_report

fn scenario_report(limit : Int) -> String

Run every smoke scenario and return a concise report.

#
scenario_score_spread

fn scenario_score_spread(evaluations : Array[ScenarioEvaluation]) -> Int

Return score spread among evaluations.

#
scenario_suite

fn scenario_suite() -> Array[Scenario]

Return a canonical model scenario collection.

#
scenario_value

fn scenario_value(name : String, value : Int) -> ScenarioValue

Create a named scenario value.

#
scenarios_pass

fn scenarios_pass(limit : Int) -> Bool

Return whether every smoke scenario meets its expected count.

#
schedule_from_pattern

fn schedule_from_pattern(people : Int, pattern : Array[Array[Int]]) -> ScheduleProblem?

Build a schedule from a fixed pattern and verify its dimensions.

#
schedule_preference

fn schedule_preference(day : Int, shift : Int, preferred_person : Int, penalty : Int) -> SchedulePreference

Construct a preference record.

#
schedule_scenario

fn schedule_scenario() -> Scenario

Return a schedule scenario with rotation rules.

#
schema_field

fn schema_field(id : Int, name : String, lower : Int, upper : Int, default : Int) -> SchemaField

Create a field.

#
schemas_compatible

fn schemas_compatible(left : ModelSchema, right : ModelSchema) -> Bool

Return whether two schemas have the same field shape.

#
score_preferences

fn score_preferences(solution : Solution, variables : Array[Int], preferred : Array[Int], penalty : Array[Int]) -> Int

Return a score for a schedule preference set.

#
score_solution

fn score_solution(solution : Solution, terms : Array[PortfolioObjectiveTerm]) -> Array[Int]

Compute objective scores from a solution using variable indices.

#
scored_solution

fn scored_solution(solution : Solution, score : Int, rank : Int) -> ScoredSolution

Build a scored solution.

#
sequence_checksum

fn sequence_checksum(values : Array[Int]) -> Int

Compute a deterministic checksum.

#
sequence_contains

fn sequence_contains(values : Array[Int], pattern : Array[Int]) -> Bool

Return whether a sequence contains a contiguous pattern.

#
sequence_convolve

fn sequence_convolve(values : Array[Int], kernel : Array[Int]) -> Array[Int]

Return a weighted convolution with a same-length output.

#
sequence_cumulative

fn sequence_cumulative(values : Array[Int]) -> Array[Int]

Return a cumulative sum sequence.

#
sequence_cyclic_alternates

fn sequence_cyclic_alternates(values : Array[Int]) -> Bool

Return whether a sequence is cyclically alternating.

#
sequence_delta

fn sequence_delta(values : Array[Int]) -> Array[Int]

Return a first-difference sequence with an initial zero.

#
sequence_edit_distance

fn sequence_edit_distance(left : Array[Int], right : Array[Int]) -> Int

Return Levenshtein edit distance.

#
sequence_lcs_length

fn sequence_lcs_length(left : Array[Int], right : Array[Int]) -> Int

Return the longest common subsequence length.

#
sequence_model

fn sequence_model(length : Int, lower : Int, upper : Int) -> SequenceModel?

Build a sequence of length variables in the inclusive value interval.

#
sequence_normalize

fn sequence_normalize(values : Array[Int]) -> Array[Int]

Normalize values by subtracting the minimum.

#
sequence_report

fn sequence_report(values : Array[Int]) -> SequenceReport

Analyze an integer sequence.

#
sequence_run_count

fn sequence_run_count(values : Array[Int]) -> Int

Count maximal runs.

#
sequence_run_lengths

fn sequence_run_lengths(values : Array[Int]) -> Array[Int]

Return run lengths.

#
sequence_runs

fn sequence_runs(values : Array[Int]) -> Array[(Int, Int)]

Return run values paired with their lengths.

#
sequence_summary

fn sequence_summary(values : Array[Int]) -> SequenceSummary?

Compute summary statistics for an array of values.

#
service_gap

fn service_gap(metrics : ServiceMetrics, target_percent : Int) -> Int

Return a service-level gap.

#
service_ids_dense

fn service_ids_dense(observations : Array[ServiceObservation]) -> Bool

Return whether ids are dense.

#
service_ids_ordered

fn service_ids_ordered(observations : Array[ServiceObservation]) -> Bool

Return whether all observations are ordered by id.

#
service_lateness_percentile

fn service_lateness_percentile(observations : Array[ServiceObservation], percent : Int) -> Int?

Return the lateness percentile.

#
service_lateness_values

fn service_lateness_values(observations : Array[ServiceObservation]) -> Array[Int]

Return a sorted lateness vector.

#
service_metrics

fn service_metrics(observations : Array[ServiceObservation]) -> ServiceMetrics

Aggregate observations.

#
service_metrics_signature

fn service_metrics_signature(observations : Array[ServiceObservation]) -> Int

Return a stable aggregate signature.

#
service_observation

fn service_observation(id : Int, promised : Int, actual : Int, quantity : Int, penalty : Int) -> ServiceObservation

Create a service observation.

#
service_score

fn service_score(observations : Array[ServiceObservation], lateness_weight : Int, quantity_weight : Int) -> Int

Return weighted service score.

#
set_covering

fn set_covering(universe_size : Int, covers : Array[Array[Int]], costs : Array[Int]) -> SetCovering?

Build a covering problem. Each row lists the universe elements covered by one candidate set; every universe element must be covered at least once.

#
setup_time

fn setup_time(instance : ManufacturingInstance, machine : Int, from_family : Int, to_family : Int) -> Int

Return setup time between two operation families on a machine.

#
shift_project_schedule

fn shift_project_schedule(project : ProjectPlan, starts : Array[Int], offset : Int) -> Array[Int]

Shift a schedule by a constant offset.

#
shift_timeline

fn shift_timeline(intervals : Array[TimelineInterval], offset : Int) -> Array[TimelineInterval]

Shift all intervals by an offset.

#
simulation_entity

fn simulation_entity(id : Int, arrival : Int, service : Int, priority : Int) -> SimulationEntity

Create an entity.

#
simulation_event

fn simulation_event(time : Int, sequence : Int, entity : Int, resource : Int, kind : SimulationEventKind, payload : Int) -> SimulationEvent

Construct an event.

#
single_objective

fn single_objective(variable : Int, direction : OptimizationDirection) -> Objective

Construct a one-variable objective.

#
singleton_domain

fn singleton_domain(value : Int) -> Domain

Create a domain containing one value.

#
singleton_domain_ids

fn singleton_domain_ids(domains : Array[Domain]) -> Array[Int]

Return variables with singleton domains.

#
snapshot_assume

fn snapshot_assume(snapshot : ModelSnapshot, set : AssumptionSet) -> ModelSnapshot?

Apply assumptions to a snapshot and return the resulting state.

#
snapshot_assumptions

fn snapshot_assumptions(snapshot : ModelSnapshot) -> AssumptionSet

Return all fixed values in a snapshot as variable/value assumptions.

#
snapshot_deltas

fn snapshot_deltas(before : ModelSnapshot, after : ModelSnapshot) -> Array[DomainDelta]

Compute changed domains between two snapshots.

#
snapshots_equal

fn snapshots_equal(left : ModelSnapshot, right : ModelSnapshot) -> Bool

Compare two snapshots by their available values.

#
solution_delta

fn solution_delta(left : Solution, right : Solution) -> Array[SolutionDelta]

Return all changed positions between two solutions.

#
solution_delta_report

fn solution_delta_report(left : Solution, right : Solution) -> String

Return a solution delta report.

#
solution_distance

fn solution_distance(left : Solution, right : Solution) -> Int

Count positions that differ between two solutions.

#
solution_pool

fn solution_pool(limit : Int, terms : Array[PortfolioObjectiveTerm]) -> SolutionPool

Create an empty portfolio pool.

#
solution_record

fn solution_record(solution : Solution, scores : Array[Int]) -> SolutionRecord

Build a record from a solution and score vector.

#
solution_replace

fn solution_replace(solution : Solution, variable : Int, value : Int) -> Solution?

Return a copied solution with one variable changed.

#
solution_signature

fn solution_signature(solution : Solution) -> Int

Return a solution fingerprint.

#
solution_values

fn solution_values(solution : Solution) -> Array[Int]

Return a solution as a copied integer array.

#
solutions_csv

fn solutions_csv(solutions : Array[Solution]) -> String

Render a set of solutions as newline-separated CSV.

#
solutions_equal

fn solutions_equal(left : Solution, right : Solution) -> Bool

Compare two solutions by all variable values.

#
solve_attempt

fn solve_attempt(index : Int, solved : Bool, solution_count : Int, stats : SearchStats, signature : Int) -> SolveAttempt

Create an attempt record.

#
solve_session

fn solve_session(name : String) -> SolveSession

Create an empty session.

#
solved_report_count

fn solved_report_count(reports : Array[ModelReport]) -> Int

Return solved report count.

#
solver_domain_changes

fn solver_domain_changes(before : Solver, after : Solver) -> Array[DomainChange]

Return a change list between two solvers.

#
solver_domains

fn solver_domains(solver : Solver) -> Array[Domain]

Return a domain snapshot from a solver.

#
solver_validation_report

fn solver_validation_report(solver : Solver, solution : Solution?) -> ValidationReport

Return a report from a solver solve attempt.

#
sort_attempts_by_work

fn sort_attempts_by_work(attempts : Array[SolveAttempt]) -> Array[SolveAttempt]

Return attempts ordered by work.

#
sort_integers

fn sort_integers(values : Array[Int]) -> Unit

Sort an integer array in ascending order.

#
sort_scenario_evaluations

fn sort_scenario_evaluations(evaluations : Array[ScenarioEvaluation], minimize : Bool) -> Array[ScenarioEvaluation]

Return the feasible evaluations ordered by score.

#
source_scale_evidence

fn source_scale_evidence(lines : Int, target : Int) -> EvidenceBundle

Build source-scale evidence.

#
speedup_percent

fn speedup_percent(baseline : Int, candidate : Int) -> Int?

Return a benchmark speedup percentage.

#
strong_all_different

fn strong_all_different(variables : Array[Int]) -> ConstraintSet

Generate an all-different global constraint and a redundant pairwise set.

#
subset_sum

fn subset_sum(values : Array[Int], target : Int) -> Knapsack?

Solve a subset-sum instance using Boolean selection variables.

#
sudoku

fn sudoku(puzzle : String) -> Sudoku?

Parse a Sudoku puzzle. Digits 1-9 are givens; 0 and . are blanks. Whitespace is ignored so puzzles can be copied from formatted grids.

#
sudoku_from_grid

fn sudoku_from_grid(grid : Array[Array[Int]]) -> Sudoku?

Construct a Sudoku from a 9x9 matrix, returning None for malformed data.

#
sudoku_grid

fn sudoku_grid(compact : String) -> Array[Array[Int]]?

Convert a compact board string into a 9x9 integer matrix.

#
sum

fn sum(variables : Array[Int], target : Int) -> Constraint

Require the listed variables to add up to target.

#
sum_table

fn sum_table(left : Domain, right : Domain, target : Int) -> RelationTable?

Return a table for a finite arithmetic sum.

#
table

fn table(variables : Array[Int], rows : Array[Array[Int]]) -> Constraint

Restrict a tuple of variables to rows in an extensional table.

#
table_scenario

fn table_scenario() -> Scenario

Return a finite table scenario.

#
tasks_by_slack

fn tasks_by_slack(project : ProjectPlan) -> Array[Int]

Return tasks sorted by slack.

#
text_document

fn text_document(input : String) -> TextDocument

Split a document into owned lines.

#
text_signature

fn text_signature(input : String) -> Int

Return a stable text fingerprint.

#
text_token

fn text_token(value : String, line : Int, column : Int) -> TextToken

Create a token.

#
tightest_capacity_point

fn tightest_capacity_point(project : ProjectPlan, starts : Array[Int]) -> PlanningCapacityPoint?

Return the tightest capacity point.

#
tightest_resource

fn tightest_resource(metrics : Array[ResourceMetric]) -> Int?

Return the resource with minimum idle time.

#
timeline_interval

fn timeline_interval(id : Int, resource : Int, start : Int, end : Int, weight : Int, label : String) -> TimelineInterval

Create an interval.

#
timeline_objective

fn timeline_objective(timeline : ResourceTimeline) -> Int

Return a timeline quality score.

#
timeline_overlap

fn timeline_overlap(left : TimelineInterval, right : TimelineInterval) -> Bool

Return interval overlap.

#
timeline_resource_metrics

fn timeline_resource_metrics(timeline : ResourceTimeline) -> Array[ResourceMetric]

Build metrics for every resource of a timeline.

#
tokenize_text

fn tokenize_text(input : String) -> Array[TextToken]

Tokenize non-whitespace runs while preserving locations.

#
total_actual

fn total_actual(observations : Array[ServiceObservation]) -> Int

Return total actual time.

#
total_allocated_value

fn total_allocated_value(instance : AllocationInstance, plan : AllocationPlan) -> Int

Return total assigned value.

#
total_allocated_weight

fn total_allocated_weight(instance : AllocationInstance, plan : AllocationPlan) -> Int

Return total assigned weight.

#
total_promised

fn total_promised(observations : Array[ServiceObservation]) -> Int

Return total promised time.

#
total_resource_capacity

fn total_resource_capacity(metrics : Array[ResourceMetric]) -> Int

Return total capacity across metrics.

#
total_resource_load

fn total_resource_load(metrics : Array[ResourceMetric]) -> Int

Return total load across metrics.

#
trace_is_ordered

fn trace_is_ordered(simulation : QueueSimulation) -> Bool

Return whether every event timestamp is nondecreasing.

#
trace_solution

fn trace_solution(ids : Array[Int], solution : Solution) -> DecisionTrace

Create a trace from a complete solution and its variable ids.

#
two_shift_roster

fn two_shift_roster(workers : Int, days : Int, minimum_per_shift : Int) -> RosterModel?

Build a two-shift roster with a minimum number of workers on each shift.

#
two_way_partition

fn two_way_partition(values : Array[Int], target : Int) -> BinPacking?

Build a partition model with two groups and an exact target sum.

#
unassigned_items

fn unassigned_items(plan : AllocationPlan) -> Array[Int]

Return unassigned item ids.

#
union_domain_values

fn union_domain_values(domains : Array[Domain]) -> IntegerSet

Return the union of domain candidates.

#
unserved_count

fn unserved_count(instance : RoutingInstance, plan : RoutingPlan) -> Int

Return the number of unserved customers.

#
utility_best_swap

fn utility_best_swap(items : Array[UtilityItem], selected : Array[Int], capacity : Int) -> (Array[Int], Bool)

Return the best single-item replacement for a selected subset.

#
utility_item

fn utility_item(id : Int, weight : Int, value : Int) -> UtilityItem

Create a utility item.

#
utility_subset_value

fn utility_subset_value(items : Array[UtilityItem], selected : Array[Int]) -> Int

Return total value of selected items.

#
utility_subset_weight

fn utility_subset_weight(items : Array[UtilityItem], selected : Array[Int]) -> Int

Return total weight of selected items.

#
validate_allocation

fn validate_allocation(instance : AllocationInstance, plan : AllocationPlan) -> Array[String]

Return a stable validation error list.

#
validate_assignment_domains

fn validate_assignment_domains(report : ValidationReport, domains : Array[Domain], values : Array[Int]) -> Bool

Validate every assignment fits its variable domain.

#
validate_domain_table

fn validate_domain_table(report : ValidationReport, table : Array[Array[Int]]) -> Bool

Validate a rectangular domain table.

#
validate_domains

fn validate_domains(report : ValidationReport, domains : Array[Domain]) -> Bool

Validate all domains are non-empty.

#
validate_increasing

fn validate_increasing(report : ValidationReport, path : String, values : Array[Int]) -> Bool

Validate an array is strictly increasing.

#
validate_length

fn validate_length(report : ValidationReport, path : String, values : Array[Int], expected : Int) -> Bool

Validate an array's exact length.

#
validate_manufacturing_schedule

fn validate_manufacturing_schedule(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Array[String]

Validate precedence, machine order, and due dates.

#
validate_matrix_shape

fn validate_matrix_shape(report : ValidationReport, path : String, matrix : Array[Array[Int]], rows : Int, columns : Int) -> Bool

Validate matrix shape.

#
validate_membership

fn validate_membership(report : ValidationReport, path : String, values : Array[Int], allowed : Array[Int]) -> Bool

Validate every value belongs to a finite set.

#
validate_model

fn validate_model(report : ValidationReport, solver : Solver) -> Bool

Validate a finite-domain model before solving.

#
validate_names

fn validate_names(report : ValidationReport, path : String, names : Array[String]) -> Bool

Validate a set of names is unique and non-empty.

#
validate_nondecreasing

fn validate_nondecreasing(report : ValidationReport, path : String, values : Array[Int]) -> Bool

Validate an array is nondecreasing.

#
validate_nonnegative

fn validate_nonnegative(report : ValidationReport, path : String, value : Int) -> Bool

Validate a non-negative integer.

#
validate_plan

fn validate_plan(instance : RoutingInstance, plan : RoutingPlan) -> Array[String]

Validate that every customer appears exactly once.

#
validate_range

fn validate_range(report : ValidationReport, path : String, value : Int, lower : Int, upper : Int) -> Bool

Validate an inclusive integer range.

#
validate_route

fn validate_route(instance : RoutingInstance, route : VehicleRoute) -> String?

Validate a single route and return a stable error code.

#
validate_routing_report

fn validate_routing_report(report : ValidationReport, routing : RoutingReport) -> Bool

Validate route errors into a structured report.

#
validate_solution

fn validate_solution(report : ValidationReport, solver : Solver, solution : Solution) -> Bool

Validate a solver solution against its variable declarations.

#
validate_text

fn validate_text(report : ValidationReport, path : String, value : String) -> Bool

Validate a text field is not blank.

#
validate_unique

fn validate_unique(report : ValidationReport, path : String, values : Array[Int]) -> Bool

Validate uniqueness.

#
validate_utility_subset

fn validate_utility_subset(items : Array[UtilityItem], selected : Array[Int], capacity : Int) -> Bool

Validate a selected subset.

#
validation_issue

fn validation_issue(code : String, path : String, message : String, severity : ValidationSeverity) -> ValidationIssue

Construct an issue.

#
validation_report

fn validation_report() -> ValidationReport

Create an empty report.

#
value_density_plan

fn value_density_plan(instance : AllocationInstance) -> AllocationPlan

Allocate items in descending value-density order.

#
variable

fn variable(name : String, lower : Int, upper : Int) -> Variable

Define a variable with an inclusive integer range.

#
variable_group

fn variable_group(ids : Array[Int]) -> VariableGroup

Create a group from identifiers.

#
variable_with_domain

fn variable_with_domain(name : String, value_domain : Domain) -> Variable

Define a variable from an explicit finite domain.

#
vehicle_route

fn vehicle_route(vehicle : Int) -> VehicleRoute

Create an empty route for a vehicle.

#
vehicle_route_from

fn vehicle_route_from(vehicle : Int, stops : Array[Int]) -> VehicleRoute

Create a route from a stop sequence.

#
weighted_graph

fn weighted_graph(vertices : Int, directed : Bool) -> WeightedGraph

Create an empty graph.

#
weighted_graph_from_edges

fn weighted_graph_from_edges(vertices : Int, directed : Bool, edges : Array[GraphEdge]) -> WeightedGraph?

Create a graph from an edge list.

#
weighted_score

fn weighted_score(values : Array[Int], weights : Array[Int]) -> Int

Return a scaled weighted score.

#
weighted_sum_bundle

fn weighted_sum_bundle(terms : Array[(Int, Int)], target : Int) -> ConstraintSet

Generate a weighted equality and both safe bound relaxations.

#
what_if_scenario

fn what_if_scenario(name : String, values : Array[ScenarioValue]) -> WhatIfScenario

Create a scenario.

#
within_resource_limit

fn within_resource_limit(metrics : Array[ResourceMetric], limit_percent : Int) -> Bool

Return whether all resources stay below a utilization limit.

#
word_frequency

fn word_frequency(input : String) -> Array[(String, Int)]

Return word frequencies in first-seen order.

#
workflow_chain

fn workflow_chain(task_count : Int) -> Solver?

Build a precedence-chain solver for workflow examples.