예제 #1
0
        /// <summary>
        /// Is the value arc consistent.
        /// </summary>
        /// <param name="value">Value.</param>
        /// <param name="assignment">Current variable label assignments.</param>
        /// <returns>True if arc consistent, False if not arc consistent.</returns>
        private bool IsConsistent(Value value, SnapshotLabelAssignment assignment)
        {
            var variable = value.Variable;

            // Has the variable been assigned a value? If it has not, then the value must be consistent
            if (!assignment.IsAssigned(variable))
            {
                return(true);
            }

            var labelAssignment = assignment.GetAssignmentFor(variable);

            /*
             * The variable has been assigned a value, it is consistent if the
             * value is the same as the assigned value.
             */
            return(labelAssignment.Value == value.Content);
        }