Class | ConstraintSolver::AbstractConstraint |
In: |
lib/AbstractConstraint.rb
|
Parent: | Object |
Represents a constraint. To be used as a guidance to see which methods constraints need to implement.
Checks whether all variables involved in the constraint have values assigned to them.
# File lib/AbstractConstraint.rb, line 16 def allAssigned? raise RuntimeError, "must implement allAssigned?" end
Iterates over all the variables involved in the constraint.
# File lib/AbstractConstraint.rb, line 26 def each raise RuntimeError, "must implement each" end
Checks whether the constraint holds for the current assignments of the involved variables. Will raise a RuntimeError if not all the variables that are involved have been asigned values.
# File lib/AbstractConstraint.rb, line 10 def holds? raise RuntimeError, "must implement holds?" end
Checks whether the constraint includes variable.
# File lib/AbstractConstraint.rb, line 21 def include?(variable) raise RuntimeError, "must implement include?(variable)" end
Prunes the values from the domains of the involved variables that cannot be assigned to the respective variables because the constraint would be violated. Returns a list of the variables whose domains were pruned and the number of times the constraint was checked.
# File lib/AbstractConstraint.rb, line 34 def revise raise RuntimeError, "must implement revise" end