Expand description
Defines the constraints that Pumpkin provides out of the box which can be added to the
Solver.
A constraint is a relation over variables. In the solver, constraints are enforced through propagators, and therefore constraints can be viewed as a collection of propagators.
§Example
let mut solver = Solver::default();
let a = solver.new_bounded_integer(0, 3);
let b = solver.new_bounded_integer(0, 3);
// All constraints require a constraint tag.
let constraint_tag = solver.new_constraint_tag();
solver
.add_constraint(constraints::equals([a, b], 0, constraint_tag))
.post();§Note
At the moment, the API for posting propagators is not yet publicly accessible as it is unstable. Consumers of the Pumpkin library can therefore only define constraints by decomposing them into the constraints that are predefined in the library. Once the propagator API is stabilized, it will become part of the public API.
Structs§
- Constraint
Poster - A structure which is responsible for adding the created
Constraints to theSolver. For an example on how to use this, seecrate::constraints.
Traits§
- Constraint
- A
Constraintis a relation over variables. It disqualifies certain partial assignments of making it into a solution of the problem. - Negatable
Constraint - A
Constraintwhich has a well-defined negation.
Functions§
- absolute
- Creates the
Constraint|signed| = absolute. - all_
different - Creates the
Constraintthat enforces that all the givenvariablesare distinct. - binary_
equals - Creates the
NegatableConstraintlhs = rhs. - binary_
greater_ than - Creates the
NegatableConstraintlhs > rhs. - binary_
greater_ than_ or_ equals - Creates the
NegatableConstraintlhs >= rhs. - binary_
less_ than - Creates the
NegatableConstraintlhs < rhs. - binary_
less_ than_ or_ equals - Creates the
NegatableConstraintlhs <= rhs. - binary_
not_ equals - Creates the
NegatableConstraintlhs != rhs. - boolean_
equals - Creates the
Constraint\sum weights_i * bools_i == rhs. - boolean_
less_ than_ or_ equals - Creates the
Constraint\sum weights_i * bools_i <= rhs. - clause
- Creates the
NegatableConstraint\/ literal - conjunction
- Creates the
NegatableConstraint/\ literal - cumulative
- Creates the Cumulative
Constraint. - cumulative_
with_ options - Creates the Cumulative constraint
with the provided
CumulativeOptions. - disjunctive_
strict - Creates the Disjunctive
Constraint(also called theNoOverlapConstraint or theUnary ResourceConstraint). - division
- Creates the
Constraintnumerator / denominator = rhs. - element
- Creates the element
Constraintwhich states thatarray[index] = rhs. - equals
- Creates the
NegatableConstraint\sum terms_i = rhs. - greater_
than - Create the
NegatableConstraint\sum terms_i > rhs. - greater_
than_ or_ equals - Create the
NegatableConstraint\sum terms_i >= rhs. - less_
than - Create the
NegatableConstraint\sum terms_i < rhs. - less_
than_ or_ equals - Create the
NegatableConstraint\sum terms_i <= rhs. - maximum
- Creates the
Constraintmax(array) = m. - minimum
- Creates the
Constraintmin(array) = m. - negative_
table - Create a negative table constraint over the variables
xs. - not_
equals - Create the
NegatableConstraint\sum terms_i != rhs. - plus
- Creates the
Constrainta + b = c. - table
- Create a table constraint over the variables
xs. - times
- Creates the
Constrainta * b = c.