Finite-domain constraint programming library for MoonBit
///|
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")
}
}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 infopub struct AllocationInstance {
items : Array[AllocationItem]
capacities : Array[Int]
group_limits : Array[(Int, Int, Int, Int)]
}fn AllocationInstance::add_group_limit(self : AllocationInstance, bin : Int, group : Int, minimum : Int, maximum : Int) -> Boolpub struct AllocationItem {
id : Int
weight : Int
value : Int
group : Int
}pub struct ArtifactBenchmark {
name : String
work : Int
solved : Bool
signature : Int
}pub struct AssignmentMetrics {
count : Int
categories : Int
minimum : Int
maximum : Int
spread : Int
transitions : Int
changes : Int
}pub struct AssumptionResult {
satisfiable : Bool
solution : Solution?
stats : SearchStats
assumptions : AssumptionSet
}fn BenchmarkArtifactSuite::add(self : BenchmarkArtifactSuite, benchmark : ArtifactBenchmark) -> Boolpub struct BenchmarkResult {
name : String
solved : Bool
solutions : Int
nodes : Int
propagations : Int
checks : Int
pruned : Int
depth : Int
repeat_count : Int
}pub struct CalendarModel {
solver : Solver
tasks : Array[CalendarTask]
horizon : Int
resources : Int
}fn CalendarModel::add_task(self : CalendarModel, name : String, duration : Int, resource : Int) -> Int?fn CalendarModel::intervals(self : CalendarModel, solution : Solution) -> Array[(String, Int, Int, Int)]fn CalendarModel::post_allowed_starts(self : CalendarModel, task_id : Int, starts : Array[Int]) -> Unitfn CalendarModel::post_precedence(self : CalendarModel, first : Int, second : Int, gap : Int) -> Unitfn CalendarModel::post_resource_capacity(self : CalendarModel, resource : Int, capacity : Int) -> Unitfn CalendarModel::post_start_window(self : CalendarModel, task_id : Int, lower : Int, upper : Int) -> Unitpub struct CalendarTask {
name : String
start : Int
end : Int
duration : Int
resource : Int
}pub struct CalendarWindow {
start : Int
end : Int
}pub struct CapacityArc {
from : Int
to : Int
capacity : Int
cost : Int
}fn CapacityNetwork::add_arc(self : CapacityNetwork, from : Int, to : Int, capacity : Int, cost : Int) -> Boolpub struct ConflictReport {
satisfiable : Bool
core : AssumptionSet
probes : Int
original_size : Int
}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)fn ConstraintBuilder::add_int(self : ConstraintBuilder, name : String, lower : Int, upper : Int) -> Intfn ConstraintBuilder::at_least_count(self : ConstraintBuilder, variables : Array[Int], value : Int, count : Int) -> Boolfn ConstraintBuilder::at_most_count(self : ConstraintBuilder, variables : Array[Int], value : Int, count : Int) -> Boolfn ConstraintBuilder::cumulative(self : ConstraintBuilder, starts : Array[Int], durations : Array[Int], heights : Array[Int], capacity : Int) -> Boolfn ConstraintBuilder::exact_count(self : ConstraintBuilder, variables : Array[Int], value : Int, count : Int) -> Boolfn ConstraintBuilder::exact_sum(self : ConstraintBuilder, variables : Array[Int], target : Int) -> Boolfn ConstraintBuilder::grid(self : ConstraintBuilder, name : String, rows : Int, columns : Int, lower : Int, upper : Int) -> Array[Int]fn ConstraintBuilder::grid_columns(self : ConstraintBuilder, grid : Array[Int], rows : Int, columns : Int) -> Boolfn ConstraintBuilder::grid_rows(self : ConstraintBuilder, grid : Array[Int], rows : Int, columns : Int) -> Boolfn ConstraintBuilder::minimum_distance(self : ConstraintBuilder, variables : Array[Int], distance : Int) -> Boolfn ConstraintBuilder::no_overlap(self : ConstraintBuilder, starts : Array[Int], durations : Array[Int]) -> Boolfn ConstraintBuilder::transition_table(self : ConstraintBuilder, variables : Array[Int], transitions : Array[Array[Int]]) -> Boolfn ConstraintBuilder::weighted_at_least(self : ConstraintBuilder, terms : Array[(Int, Int)], target : Int) -> Boolfn ConstraintBuilder::weighted_at_most(self : ConstraintBuilder, terms : Array[(Int, Int)], target : Int) -> Boolpub struct ConstraintInfo {
kind : ConstraintKind
arity : Int
variables : Array[Int]
label : String
}fn ConstraintRecipe::post_at_least(self : ConstraintRecipe, variables : Array[Int], value : Int, count : Int) -> Boolfn ConstraintRecipe::post_at_most(self : ConstraintRecipe, variables : Array[Int], value : Int, count : Int) -> Boolfn ConstraintRecipe::post_cumulative(self : ConstraintRecipe, starts : Array[Int], durations : Array[Int], heights : Array[Int], capacity : Int) -> Boolfn ConstraintRecipe::post_exact_count(self : ConstraintRecipe, variables : Array[Int], value : Int, count : Int) -> Boolfn ConstraintRecipe::post_exact_sum(self : ConstraintRecipe, variables : Array[Int], target : Int) -> Boolfn ConstraintRecipe::post_grid_rules(self : ConstraintRecipe, grid : Array[Int], rows : Int, columns : Int) -> Boolfn ConstraintRecipe::post_lower(self : ConstraintRecipe, terms : Array[(Int, Int)], target : Int) -> Boolfn ConstraintRecipe::post_minimum_distance(self : ConstraintRecipe, variables : Array[Int], distance : Int) -> Boolfn ConstraintRecipe::post_no_overlap(self : ConstraintRecipe, starts : Array[Int], durations : Array[Int]) -> Boolfn ConstraintRecipe::post_transition(self : ConstraintRecipe, variables : Array[Int], transitions : Array[Array[Int]]) -> Boolfn ConstraintRecipe::post_upper(self : ConstraintRecipe, terms : Array[(Int, Int)], target : Int) -> Boolpub struct DecisionStep {
variable : Int
value : Int
accepted : Bool
depth : Int
}fn DomainCatalog::add(self : DomainCatalog, name : String, value_domain : Domain, tag : String) -> Int?pub struct DomainProfile {
minimum : Int?
maximum : Int?
size : Int
interval_count : Int
removed_count : Int
}fn EvidenceBundle::exact(self : EvidenceBundle, name : String, metric : String, value : Int, expected : Int) -> Unitfn EvidenceBundle::maximum(self : EvidenceBundle, name : String, metric : String, value : Int, expected : Int) -> Unitfn EvidenceBundle::minimum(self : EvidenceBundle, name : String, metric : String, value : Int, expected : Int) -> Unitpub struct EvidenceRecord {
name : String
metric : String
value : Int
expected : Int
passed : Bool
}fn FiniteRelation::restrict(self : FiniteRelation, left : IntegerSet, right : IntegerSet) -> FiniteRelationpub struct GraphEdge {
from : Int
to : Int
weight : Int
}pub struct GuardedSolve {
status : SolveStatus
solution : Solution?
stats : SearchStats
reason : String?
}pub struct IntegerRegression {
slope_scaled : Int
intercept : Int
error : Int
}pub struct IntegerSummary {
count : Int
total : Int
minimum : Int
maximum : Int
median : Int
mean : Int
}pub struct IntervalTask {
name : String
start : Int
duration : Int
demand : Int
latest_start : Int
}pub struct KnapsackItem {
name : String
weight : Int
value : Int
selected : Int
}pub struct MachineSpec {
id : Int
name : String
capacity : Int
}pub struct ManufacturingInstance {
machines : Array[MachineSpec]
operations : Array[ManufacturingOperation]
setup_matrix : Array[Array[Int]]
}fn ManufacturingInstance::operation(self : ManufacturingInstance, id : Int) -> ManufacturingOperationpub struct ManufacturingOperation {
id : Int
job : Int
sequence : Int
machine : Int
setup : Int
duration : Int
family : Int
due : Int
}fn ManufacturingSchedule::machine_sequence(self : ManufacturingSchedule, machine : Int) -> Array[Int]fn ManufacturingSchedule::queue(self : ManufacturingSchedule, machine : Int, operation : Int) -> Boolfn ManufacturingSchedule::set_start(self : ManufacturingSchedule, operation : Int, start : Int) -> Boolfn ModelBuilder::post_count(self : ModelBuilder, names : Array[String], value : Int, count : Int) -> Unitpub struct ModelLimits {
max_variables : Int
max_constraints : Int
max_domain_size : Int
}pub struct ModelReport {
name : String
variables : Int
constraints : Int
solved : Bool
solutions : Int
nodes : Int
propagations : Int
checks : Int
pruned : Int
signature : Int
}pub struct ModelSnapshot {
domains : Array[Domain]
max_solutions : Int
search_config : SearchConfig
}pub struct NonogramPuzzle {
rows : Array[NonogramLine]
columns : Array[NonogramLine]
cells : IntMatrix
}fn Objective::then(self : Objective, variable : Int, direction : OptimizationDirection, weight : Int) -> Objectivefn OperationalLedger::filter_state(self : OperationalLedger, state : OperationalState) -> Array[OperationalRecord]pub struct OperationalRecord {
key : String
state : OperationalState
started_at : Int
finished_at : Int
attempts : Int
output_count : Int
error_code : Int
}pub enum OperationalState {
LedgerQueued
LedgerRunning
LedgerSucceeded
LedgerFailed
LedgerSkipped
}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
}pub struct PlanningCapacityPoint {
resource : Int
time : Int
load : Int
capacity : Int
}pub struct PlanningDependency {
before : Int
after : Int
lag : Int
}pub struct PlanningTask {
id : Int
name : String
duration : Int
resource : Int
demand : Int
release : Int
due : Int
}pub struct PortfolioAudit {
candidates : Int
distinct : Int
retained : Int
pareto : Int
}pub enum PortfolioDirection {
Minimize
Maximize
}pub struct ProjectPlan {
solver : Solver
tasks : Array[PlanningTask]
starts : Array[Int]
dependencies : Array[PlanningDependency]
horizon : Int
capacities : Array[Int]
}fn ProjectPlan::resource_profile(self : ProjectPlan, starts : Array[Int], resource : Int) -> Array[Int]fn ProjectPlan::resource_utilization(self : ProjectPlan, starts : Array[Int], resource : Int) -> Intfn ProjectPlan::task_at(self : ProjectPlan, starts : Array[Int], resource : Int, time : Int) -> Int?fn PruningExplanation::for_variable(self : PruningExplanation, variable : Int) -> Array[PruningReason]pub struct PruningReason {
variable : Int
value : Int
constraint : String
detail : String
}pub struct QualityGateResult {
name : String
status : QualityStatus
observed : Int
threshold : Int
detail : String
}fn QualityReview::maximum(self : QualityReview, name : String, observed : Int, threshold : Int, detail : String) -> Unitfn QualityReview::minimum(self : QualityReview, name : String, observed : Int, threshold : Int, detail : String) -> Unitfn QualityReview::require(self : QualityReview, name : String, condition : Bool, detail : String) -> Unitpub enum QualityStatus {
GatePassed
GateWarning
GateFailed
}pub struct QueueSimulation {
horizon : Int
entities : Array[SimulationEntity]
queue : EventQueue
trace : Array[SimulationEvent]
next_sequence : Int
server_free : Int
total_wait : Int
completed : Int
}fn QueueSimulation::schedule(self : QueueSimulation, time : Int, entity : Int, resource : Int, kind : SimulationEventKind, payload : Int) -> Boolfn QueueSimulation::schedule_maintenance(self : QueueSimulation, start : Int, duration : Int) -> Boolpub struct RecipeResult {
posted : Int
rejected : Int
}pub struct ResourceMetric {
resource : Int
capacity : Int
total_load : Int
peak_load : Int
busy_slots : Int
horizon : Int
}pub struct ResourceSchedule {
solver : Solver
tasks : Array[IntervalTask]
horizon : Int
capacity : Int
}fn ResourceSchedule::add_flexible_task(self : ResourceSchedule, name : String, duration : Int, demand : Int) -> Int?fn ResourceSchedule::add_task(self : ResourceSchedule, name : String, duration : Int, demand : Int, latest_start : Int) -> Int?fn ResourceSchedule::avoid_window(self : ResourceSchedule, window_start : Int, window_end : Int) -> Boolpub struct ResourceTimeline {
horizon : Int
capacities : Array[Int]
intervals : Array[TimelineInterval]
}fn ResourceTimeline::on_resource(self : ResourceTimeline, resource : Int) -> Array[TimelineInterval]pub struct ResultCounter {
accepted : Int
rejected : Int
}pub enum RiskBand {
LowRisk
MediumRisk
HighRisk
CriticalRisk
}pub struct RiskItem {
id : Int
name : String
likelihood : Int
impact : Int
mitigation : Int
}fn RosterModel::post_worker_interval(self : RosterModel, worker : Int, lower_shift : Int, upper_shift : Int, minimum : Int, maximum : Int) -> Unitfn RosterModel::post_worker_shift_bounds(self : RosterModel, worker : Int, shift : Int, minimum : Int, maximum : Int) -> Unitfn RosterModel::shift_count_for(self : RosterModel, solution : Solution, worker : Int, shift : Int) -> Intpub struct RosterScore {
spread : Int
violations : Int
coverage_total : Int
}pub struct RoutingInstance {
points : Array[RoutingPoint]
depot : Int
vehicles : Int
capacities : Array[Int]
distances : Array[Array[Int]]
}pub struct RoutingPoint {
id : Int
x : Int
y : Int
demand : Int
service : Int
ready : Int
due : Int
}pub struct RoutingReport {
distance : Int
makespan : Int
load : Int
visits : Int
errors : Array[String]
}pub struct ScenarioValue {
name : String
value : Int
}pub struct SchedulePreference {
day : Int
shift : Int
preferred_person : Int
penalty : Int
}fn ScheduleProblem::score(self : ScheduleProblem, solution : Solution, preferences : Array[SchedulePreference]) -> Intpub struct SchemaField {
id : Int
name : String
lower : Int
upper : Int
default : Int
}pub struct SearchConfig {
max_solutions : Int
variable_heuristic : VariableHeuristic
value_heuristic : ValueHeuristic
propagation_rounds : Int
enable_learning : Bool
node_limit : Int
} derive(Debug)fn SearchConfig::choose_variables(self : SearchConfig, heuristic : VariableHeuristic) -> SearchConfigpub 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)fn SequenceModel::post_edge_transitions(self : SequenceModel, tables : Array[Array[Array[Int]]]) -> Unitfn SequenceModel::post_window_count(self : SequenceModel, width : Int, value : Int, count : Int) -> Unitfn SequenceModel::post_window_table(self : SequenceModel, width : Int, rows : Array[Array[Int]]) -> Unitpub struct SequenceReport {
length : Int
minimum : Int
maximum : Int
transitions : Int
runs : Int
checksum : Int
}pub struct ServiceMetrics {
orders : Int
on_time : Int
late : Int
total_lateness : Int
maximum_lateness : Int
quantity : Int
cost : Int
}pub struct ServiceObservation {
id : Int
promised : Int
actual : Int
quantity : Int
penalty : Int
}fn SetCovering::covers_all(self : SetCovering, solution : Solution, covers : Array[Array[Int]]) -> Boolpub struct SimulationEntity {
id : Int
arrival : Int
service : Int
priority : Int
}pub struct SimulationEvent {
time : Int
sequence : Int
entity : Int
resource : Int
kind : SimulationEventKind
payload : Int
}pub enum SimulationEventKind {
Arrival
ServiceStart
ServiceFinish
Maintenance
CustomEvent
}pub struct SolutionDelta {
variable : Int
before : Int
after : Int
}pub struct SolutionPool {
records : Array[SolutionRecord]
limit : Int
terms : Array[PortfolioObjectiveTerm]
}pub struct SolveAttempt {
index : Int
solved : Bool
solution_count : Int
work : Int
signature : Int
}pub struct Solver {
variables : Array[Variable]
constraints : Array[Constraint]
max_solutions : Int
search_config : SearchConfig
last_stats : SearchStats
}fn Solver::optimize(self : Solver, variable : Int, direction : OptimizationDirection) -> OptimizationResult?fn Solver::ranked_solutions(self : Solver, objective : Objective, limit : Int) -> Array[ScoredSolution]fn Solver::solve_all_with_assumptions(self : Solver, set : AssumptionSet, limit : Int) -> Array[Solution]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
}pub struct TextToken {
value : String
line : Int
column : Int
}pub struct TimelineInterval {
id : Int
resource : Int
start : Int
end : Int
weight : Int
label : String
}pub struct UtilityItem {
id : Int
weight : Int
value : Int
}pub struct ValidationIssue {
code : String
path : String
message : String
severity : ValidationSeverity
}fn ValidationReport::error(self : ValidationReport, code : String, path : String, message : String) -> Unitfn ValidationReport::info(self : ValidationReport, code : String, path : String, message : String) -> Unitfn ValidationReport::warning(self : ValidationReport, code : String, path : String, message : String) -> Unitpub enum ValidationSeverity {
ValidationInfo
ValidationWarning
ValidationError
}fn WeightedGraph::shortest_path(self : WeightedGraph, source : Int, destination : Int) -> Array[Int]?fn allocation_group_count(instance : AllocationInstance, plan : AllocationPlan, bin : Int, group : Int) -> Intfn allocation_instance(items : Array[AllocationItem], capacities : Array[Int]) -> AllocationInstance?fn arithmetic_relation(left_domain : Domain, right_domain : Domain, operation : (Int, Int) -> Int) -> RelationTable?fn artifact_benchmark(name : String, work : Int, solved : Bool, signature : Int) -> ArtifactBenchmarkfn assignment_metrics(values : Array[Int], category_count : Int, previous : Array[Int]) -> AssignmentMetricsfn benchmark_regressions(baseline : BenchmarkArtifactSuite, candidate : BenchmarkArtifactSuite, tolerance : Int) -> Array[String]fn benchmark_result(name : String, solved : Bool, solutions : Int, stats : SearchStats, repeat_count : Int) -> BenchmarkResultfn best_objective_row(rows : Array[Array[Int]], directions : Array[PortfolioDirection]) -> Array[Int]?fn bipartite_matching(left_size : Int, right_size : Int, relation : FiniteRelation) -> Array[RelationPair]fn bipartite_network(left_size : Int, right_size : Int, relation : FiniteRelation) -> CapacityNetworkfn calendar_clip(windows : Array[CalendarWindow], lower : Int, upper : Int) -> Array[CalendarWindow]fn classic_solution_string() -> Stringfn collect_solution_pool(solver : Solver, limit : Int, terms : Array[PortfolioObjectiveTerm]) -> SolutionPoolfn compare_benchmark_suites(baseline : BenchmarkArtifactSuite, candidate : BenchmarkArtifactSuite) -> Array[(String, Int, Int)]fn compare_service_sets(baseline : Array[ServiceObservation], candidate : Array[ServiceObservation]) -> Stringfn critical_operations(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Array[Int]fn eight_queens_solution() -> String?fn evidence_record(name : String, metric : String, value : Int, expected : Int, passed : Bool) -> EvidenceRecordfn first_solvable_n_queens(lower : Int, upper : Int) -> Int?fn fm_abs(value : Int) -> Intfn fm_interpolate(left : Int, right : Int, numerator : Int, denominator : Int) -> Intfn improve_utility_subset(items : Array[UtilityItem], selected : Array[Int], capacity : Int) -> Array[Int]fn integer_objective(values : Array[Int], directions : Array[PortfolioDirection]) -> IntegerObjectivefn lines_within_width(input : String, width : Int) -> Boolfn machine_busy_time(instance : ManufacturingInstance, schedule : ManufacturingSchedule, machine : Int) -> Intfn machine_setup_transitions(instance : ManufacturingInstance, schedule : ManufacturingSchedule, machine : Int) -> Intfn machine_utilization(instance : ManufacturingInstance, schedule : ManufacturingSchedule, machine : Int) -> Intfn manufacturing_feasible(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Boolfn manufacturing_instance(machines : Array[MachineSpec], operations : Array[ManufacturingOperation], setup_matrix : Array[Array[Int]]) -> ManufacturingInstance?fn manufacturing_makespan(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Intfn manufacturing_objective(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Intfn manufacturing_operation(id : Int, job : Int, sequence : Int, machine : Int, setup : Int, duration : Int, family : Int, due : Int) -> ManufacturingOperationfn manufacturing_render(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Stringfn manufacturing_signature(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Intfn manufacturing_tardiness(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Intfn matrix_sum_constraints(matrix : Array[Array[Int]], rows : Int, columns : Int, row_target : Int, column_target : Int) -> ConstraintSet?fn normalize_objective(value : Int, lower : Int, upper : Int) -> Intfn objective_from_directions(variables : Array[Int], directions : Array[OptimizationDirection]) -> Objective?fn observations_from_times(promised : Array[Int], actual : Array[Int], penalty : Int) -> Array[ServiceObservation]fn operation_finish(instance : ManufacturingInstance, schedule : ManufacturingSchedule, operation : Int) -> Intfn operational_record(key : String, state : OperationalState, started_at : Int, finished_at : Int, attempts : Int, output_count : Int, error_code : Int) -> OperationalRecordfn operational_records_sorted_by_finish(records : Array[OperationalRecord]) -> Array[OperationalRecord]fn operational_score(completion_percent : Int, violations : Int, penalty : Int) -> Intfn operational_window(ledger : OperationalLedger, start : Int, finish : Int) -> Array[OperationalRecord]fn overloaded_capacity_points(project : ProjectPlan, starts : Array[Int]) -> Array[PlanningCapacityPoint]fn planning_capacity_point(resource : Int, time : Int, load : Int, capacity : Int) -> PlanningCapacityPointfn planning_chain(count : Int, duration : Int, resource : Int, demand : Int, horizon : Int, capacity : Int) -> ProjectPlan?fn planning_task(id : Int, name : String, duration : Int, resource : Int, demand : Int) -> PlanningTaskfn portfolio_objective_term(name : String, direction : PortfolioDirection, weight : Int) -> PortfolioObjectiveTermfn project_capacity_points(project : ProjectPlan, starts : Array[Int]) -> Array[PlanningCapacityPoint]fn project_plan(tasks : Array[PlanningTask], horizon : Int, capacities : Array[Int]) -> ProjectPlan?fn pruning_reason(variable : Int, value : Int, constraint : String, detail : String) -> PruningReasonfn quality_gate_result(name : String, status : QualityStatus, observed : Int, threshold : Int, detail : String) -> QualityGateResultfn quota_sequence(length : Int, lower : Int, upper : Int, total : Int, maximum_run : Int) -> SequenceModel?fn recipe_balanced_binary(recipe : ConstraintRecipe, name : String, length : Int, ones : Int) -> Array[Int]fn recipe_coloring(recipe : ConstraintRecipe, name : String, vertices : Int, colors : Int, edges : Array[(Int, Int)]) -> Array[Int]fn recipe_coverage(recipe : ConstraintRecipe, name : String, slots : Int, workers : Int, per_worker : Int) -> Array[Int]fn recipe_interval_chain(recipe : ConstraintRecipe, name : String, count : Int, horizon : Int, duration : Int) -> Array[Int]fn recipe_knapsack(recipe : ConstraintRecipe, name : String, weights : Array[Int], capacity : Int) -> Array[Int]fn recipe_resource_chain(recipe : ConstraintRecipe, name : String, count : Int, horizon : Int, duration : Int, height : Int, capacity : Int) -> Array[Int]fn recipe_rotating_roster(recipe : ConstraintRecipe, name : String, slots : Int, workers : Int) -> Array[Int]fn recipe_sequence(recipe : ConstraintRecipe, name : String, length : Int, lower : Int, upper : Int) -> Array[Int]fn regressed(baseline : Int, candidate : Int, tolerance_percent : Int) -> Boolfn replace_text(input : String, target : String, replacement : String) -> Stringfn report_within_tolerance(baseline : ModelReport, candidate : ModelReport, tolerance_percent : Int) -> Boolfn routing_instance(points : Array[RoutingPoint], depot : Int, capacities : Array[Int]) -> RoutingInstance?fn routing_instance_with_distances(points : Array[RoutingPoint], depot : Int, capacities : Array[Int], distances : Array[Array[Int]]) -> RoutingInstance?fn scenario_report(limit : Int) -> Stringfn scenarios_pass(limit : Int) -> Boolfn schedule_preference(day : Int, shift : Int, preferred_person : Int, penalty : Int) -> SchedulePreferencefn service_observation(id : Int, promised : Int, actual : Int, quantity : Int, penalty : Int) -> ServiceObservationfn service_score(observations : Array[ServiceObservation], lateness_weight : Int, quantity_weight : Int) -> Intfn set_covering(universe_size : Int, covers : Array[Array[Int]], costs : Array[Int]) -> SetCovering?fn setup_time(instance : ManufacturingInstance, machine : Int, from_family : Int, to_family : Int) -> Intfn simulation_event(time : Int, sequence : Int, entity : Int, resource : Int, kind : SimulationEventKind, payload : Int) -> SimulationEventfn solve_attempt(index : Int, solved : Bool, solution_count : Int, stats : SearchStats, signature : Int) -> SolveAttemptfn sort_scenario_evaluations(evaluations : Array[ScenarioEvaluation], minimize : Bool) -> Array[ScenarioEvaluation]fn speedup_percent(baseline : Int, candidate : Int) -> Int?fn timeline_interval(id : Int, resource : Int, start : Int, end : Int, weight : Int, label : String) -> TimelineIntervalfn utility_best_swap(items : Array[UtilityItem], selected : Array[Int], capacity : Int) -> (Array[Int], Bool)fn validate_assignment_domains(report : ValidationReport, domains : Array[Domain], values : Array[Int]) -> Boolfn validate_length(report : ValidationReport, path : String, values : Array[Int], expected : Int) -> Boolfn validate_manufacturing_schedule(instance : ManufacturingInstance, schedule : ManufacturingSchedule) -> Array[String]fn validate_matrix_shape(report : ValidationReport, path : String, matrix : Array[Array[Int]], rows : Int, columns : Int) -> Boolfn validate_membership(report : ValidationReport, path : String, values : Array[Int], allowed : Array[Int]) -> Boolfn validate_range(report : ValidationReport, path : String, value : Int, lower : Int, upper : Int) -> Boolfn validate_utility_subset(items : Array[UtilityItem], selected : Array[Int], capacity : Int) -> Boolfn validation_issue(code : String, path : String, message : String, severity : ValidationSeverity) -> ValidationIssuefn weighted_graph_from_edges(vertices : Int, directed : Bool, edges : Array[GraphEdge]) -> WeightedGraph?Finite-domain constraint programming library for MoonBit