Class ConstraintSolver::AbstractConstraint
In: lib/AbstractConstraint.rb
Parent: Object
Test::Unit::TestCase AllDifferentConstraintTest SolutionTest ConstraintSolverTest ConstraintListTest VariableTest DomainTest BinaryConstraintTest ProblemTest BinaryRelationTest Exception DomainWipeoutException UndoStackEmptyException AbstractConstraint BinaryConstraint AllDifferentConstraint Array ConstraintList BinaryRelation Variable Solution ConstraintSolver Problem Domain test/DomainTest.rb test/SolutionTest.rb lib/BinaryConstraint.rb lib/Variable.rb test/ConstraintListTest.rb lib/ConstraintList.rb test/ProblemTest.rb lib/Solution.rb test/BinaryConstraintTest.rb lib/ConstraintSolver.rb test/VariableTest.rb test/AllDifferentConstraintTest.rb lib/AllDifferentConstraint.rb lib/Problem.rb test/ConstraintSolverTest.rb lib/Domain.rb lib/AbstractConstraint.rb ConstraintSolver dot/m_19_0.png

Represents a constraint. To be used as a guidance to see which methods constraints need to implement.

Methods

allAssigned?   each   holds?   include?   revise  

Public Instance methods

Checks whether all variables involved in the constraint have values assigned to them.

[Source]

# File lib/AbstractConstraint.rb, line 16
        def allAssigned?
            raise RuntimeError, "must implement allAssigned?"
        end

Iterates over all the variables involved in the constraint.

[Source]

# 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.

[Source]

# File lib/AbstractConstraint.rb, line 10
        def holds?
            raise RuntimeError, "must implement holds?"
        end

Checks whether the constraint includes variable.

[Source]

# 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.

[Source]

# File lib/AbstractConstraint.rb, line 34
        def revise
            raise RuntimeError, "must implement revise"
        end

[Validate]