## org.opencyc.constraintsolver
Class NodeConsistencyAchiever

    java.lang.Object
      |
      +--org.opencyc.constraintsolver.NodeConsistencyAchiever

public class NodeConsistencyAchiever
extends java.lang.Object

The `NodeConsistencyAchiever` object achieves node consistency for the parent `ConstraintProblem` object. Node consistency is the application of all unary constraint rules and the subsequent propagation of domain value reductions through applicable all-different rules

Author:
  Stephen L. Reed

  Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

  the license

  www.opencyc.org

  OpenCyc at SourceForge

  THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

See Also:
  `UnitTest#testConstraintProblem`

Field Summary
`protected java.util.ArrayList` `affectedVariables` The `ArrayList` of `CycVariable` variables which are affected by unary constraint rules belonging to the parent `ConstraintProblem`.
`protected java.util.ArrayList` `allDifferentRules` The `ArrayList` of #$different constraint rules.
`protected ConstraintProblem` `constraintProblem` Reference to the parent `ConstraintProblem` object.
`protected java.util.ArrayList` `singletons` The `ArrayList` of variables having only one domain value after achieving node consistency.
`protected java.util.ArrayList` `unaryConstraintRules` The `ArrayList` of unary constraint rules belonging to the parent `ConstraintProblem`.
`protected int` `verbosity` Sets verbosity of the constraint solver output.

Constructor Summary
`NodeConsistencyAchiever(ConstraintProblem constraintProblem)` Constructs a new `NodeConsistencyAchiever` object for the parent `ConstraintProblem`.

Method Summary
`protected void` `achieveAllDifferentConsistencyWrtSingletons()` Achieves all-different consistency with regard to singletons, by propagating the affects of single-valued variables through all #$different constraint rules.
`void` `applyUnaryRulesAndPropagate()` Apply the unary constraint rules to restrict domain values and subsequently propagate the effects through any #$different constraint rules.
`void` `setVerbosity(int verbosity)` Sets verbosity of the constraint solver output.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### constraintProblem

    protected ConstraintProblem constraintProblem

  Reference to the parent `ConstraintProblem` object.

### verbosity

    protected int verbosity

  Sets verbosity of the constraint solver output. 0 --> quiet ... 9 -> maximum diagnostic input.

### unaryConstraintRules

    protected java.util.ArrayList unaryConstraintRules

  The `ArrayList` of unary constraint rules belonging to the parent `ConstraintProblem`.

### affectedVariables

    protected java.util.ArrayList affectedVariables

  The `ArrayList` of `CycVariable` variables which are affected by unary constraint rules belonging to the parent `ConstraintProblem`.

### allDifferentRules

    protected java.util.ArrayList allDifferentRules

  The `ArrayList` of #$different constraint rules.

### singletons

    protected java.util.ArrayList singletons

  The `ArrayList` of variables having only one domain value after achieving node consistency.

Constructor Detail

### NodeConsistencyAchiever

    public NodeConsistencyAchiever(ConstraintProblem constraintProblem)

  Constructs a new `NodeConsistencyAchiever` object for the parent `ConstraintProblem`.
  Parameters:
    `constraintProblem` - the parent constraint problem

Method Detail

### setVerbosity

    public void setVerbosity(int verbosity)

  Sets verbosity of the constraint solver output. 0 --> quiet ... 9 -> maximum diagnostic input.
  Parameters:
    `verbosity` - 0 --> quiet ... 9 -> maximum diagnostic input

### applyUnaryRulesAndPropagate

    public void applyUnaryRulesAndPropagate()
                                     throws java.io.IOException,
                                            CycApiException

  Apply the unary constraint rules to restrict domain values and subsequently propagate the effects through any #$different constraint rules.

### achieveAllDifferentConsistencyWrtSingletons

    protected void achieveAllDifferentConsistencyWrtSingletons()
                                                        throws java.io.IOException

  Achieves all-different consistency with regard to singletons, by propagating the affects of single-valued variables through all #$different constraint rules.