Page
Library
Module
Module type
Parameter
Class
Class type
Source
Sat.ConstraintSourceLogical, linear, and other constraints.
This is the raw form of constraints accepted by CP-SAT. See below for more convenient functions.
An equality between a target linear expression and an operation, given externally, applied to multiple linear expression arguments. The target must be a (scaled) variable or constant, otherwise add raises Invalid_argument.
An equality between a target linear expression and a operation, given externally, applied to a linear expression and a constant argument. The target must be a (scaled) variable or constant, otherwise add raises Invalid_argument. Similarly, arg2 must be a (scaled) constant, but this cannot always be fully checked.
type t = | Or of Var.t_bool listAt least one of the literals must be true.
*)| And of Var.t_bool listAll literals must be true.
*)| At_most_one of Var.t_bool listAt most one literal is true. Sum literals <= 1.
*)| Exactly_one of Var.t_bool listExactly one literal is true. Sum literals == 1.
*)| Xor of Var.t_bool listAn odd number of literals is true.
*)| Div of equality2Integer division by a constant.
*)| Mod of equality2Integer modulo a constant.
*)| Prod of equalityConstrain a variable to equal the product of linear expressions.
*)| Max of equalityConstrain a variable to equal the maximum of a list of linear expressions.
*)| Linear of LinearExpr.t * Domain.tConstrains a linear expression to a domain. Values of type Linear of lt are created by the (<=), (==), and similar operators.
| All_diff of LinearExpr.t listRequire that a list of (scaled) variables and constants have different values from each other.
*)The primitive constraints treated by CP-SAT.
At least one of the literals must be true. Same as Or.
All literals must be true. Same as And.
An odd number of literals is true. Same as Xor.
At most one literal is true. Sum literals <= 1. Same as At_most_one.
Exactly one literal is true. Sum literals == 1. Same as Exactly_one.
At least one of the literals must be true. Same as Or.
Logical implication between two literals. (implication a b is the same as Or [(Var.not a); b] .)
Constrain a variable to equal the product of linear expressions. Slightly less general than Prod since the left-hand-side may also be a scaled variable or a constant. multiplication_equality v [x y z] means v = x * y * z.
Integer division by a constant. Slightly less general than Div, since the left-hand-side may also be a scaled variable or a constant. division_equality x e c means x = e // c.
Integer modulo a constant. Slightly less general than Mod, since the left-hand-side may also be a scaled variable or a constant. modulo_equality x e c means x = e % c.
Constrain a variable to equal the maximum of a list of linear expressions. Slightly less general than Max since the left-hand-side may also be a scaled variable or a constant.
Slightly less general than min since the left-hand-side may also be a scaled variable or a constant.
Slightly less general than abs since the left-hand-side may also be a scaled variable or a constant.
Require that a list of (scaled) variables and constants have different values from each other. Same as All_diff.
A Linear constraint: of_expr e lb ub means lb <= e <= ub.
include module type of LinearExpr.LAn empty linear expression.
A single variable.
A single term.
Concatenatation of two linear expressions.
Concatenatation of the left expression with the negation of the right expression.
Multiplication of a linear expression by a constant.
A constant linear expression.
Complement a boolean literal. Same as Var.nto.
Pretty-printer for linear expressions.