Class AI::CSP::Variable
In: ai/csp/variable.rb
Parent: Object

Variables

A variable and its domain. Also supports instantiating the variable and pruning values when propagating constraints.

See AI::CSP for an overview and examples.

Methods

Constants

MAXINT = 2**16   Just needs to be larger than the number of variables in problem

Attributes

domain  [R] 
name  [R] 
value  [RW] 

Public Class methods

domain must respond to .to_a

Public Instance methods

Calls provided block with each value that is valid at the specified level.

Calls provided block with each value (and its index) that is valid at the specified level.

Marks the value at value_index as pruned at the specified level.

Returns true if the value at value_index has been pruned at this level (or at any previous levels). If no value_index is specified, returns true if any values have been pruned at the specified level.

Unprunes all values that were pruned at specified level or at higher (deeper) levels.

[Validate]