Exemplo n.º 1
0
 /// <summary>
 /// Constructs the initial state labels.
 /// </summary>
 /// <param name="initialState">Initial state of the original problem.</param>
 public StateLabels(RelaxedState initialState)
 {
     for (int i = 0; i < initialState.GetLength(); ++i)
     {
         Add(new Assignment(i, initialState.GetValue(i)), 0);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructs the state layer from the initial state of the problem.
 /// </summary>
 /// <param name="state">State.</param>
 /// <param name="initLabels">Should the labels be initialized?</param>
 public StateLayer(RelaxedState state, bool initLabels = true)
 {
     State = state;
     if (initLabels)
     {
         Labels = new StateLabels(state);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Checks the equality of objects.
        /// </summary>
        /// <param name="obj">Object to be checked.</param>
        /// <returns>True if the objects are equal, false otherwise.</returns>
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }

            RelaxedState other = obj as RelaxedState;

            if (other == null)
            {
                return(false);
            }

            return(CollectionsEquality.Equals(Values, other.Values));
        }