Class AI::CSP::Constraint
In: ai/csp/constraint.rb
Parent: Object

A generic constraint on a number of variables. The propagate method, performs forward checking, however many subclasses (implementing specialized constraing types) will want override this method and provide more efficient pruning and possibly enforce stronger consistency.

See AI::CSP for an overview and more examples.

Methods

Attributes

checks  [RW] 
variables  [R] 

Public Class methods

Public Instance methods

Checks this constraint on the current values for the participating variables.

Returns true if all variables in this constraint have been instantiated, and false otherwise.

Returns true if exactly one of the variables participating in this constraint are uninstantiated.

Performs generic forward checking when all but one of the participating variables has been instantiated. Subclasses of course can do something more clever. The specified variable is the most recently instantiated variable.

[Validate]