ConstraintSystem
Given a set of constraints of the form t1 ≤ t2
, finds the unique maximum solution if it exists.
A solution to a set of constraints is an assignment of values to all variables in the system. A maximum solution assigns the greatest possible value to each variable, where greatest is with respect to PartialOrder.lessThanOrEqualTo.
Parameters
A
domain of values
T
type of exceptions thrown when there are unsatisfiable constraints
top
greatest element of A
Constructors
ConstraintSystem
Link copied to clipboard
Functions
addLessThanOrEqualToConstraint
Link copied to clipboard
fun addLessThanOrEqualToConstraint(lhs: AtomicTerm<A>, rhs: RightHandTerm<A>, failWith: (A, A) -> T)
Content copied to clipboard
fun addLessThanOrEqualToConstraint(lhs: LeftHandTerm<A>, rhs: AtomicTerm<A>, failWith: (A, A) -> T)
Content copied to clipboard
Add the constraint lhs <= rhs
to the system.
addNewVariable
Link copied to clipboard
Creates a fresh variable and add it to the system.
exportDotGraph
Link copied to clipboard
Output the constraint system as a DOT graph.
solve
Link copied to clipboard
Returns the greatest solution to the set of constraints in the system.