Example #1
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);
     }
 }
Example #2
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);
            }

            StateLabels other = obj as StateLabels;

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

            return(CollectionsEquality.Equals(this, other));
        }
Example #3
0
        /// <summary>
        /// Computes the operator label in the relaxed planning graph.
        /// </summary>
        /// <param name="stateLabels">State labels from the predecessor layer in the graph.</param>
        /// <param name="evaluationStrategy">Evaluation strategy of the planning graph.</param>
        /// <returns>Computed operator label in the relaxed planning graph.</returns>
        public double EvaluateOperatorPlanningGraphLabel(IStateLabels stateLabels, ForwardCostEvaluationStrategy evaluationStrategy)
        {
            StateLabels labels = (StateLabels)stateLabels;

            double result = 0;

            foreach (var assignment in this)
            {
                double variableLabel = labels[assignment];
                if (evaluationStrategy == ForwardCostEvaluationStrategy.ADDITIVE_VALUE)
                {
                    result += variableLabel;
                }
                else
                {
                    result = Math.Max(result, variableLabel);
                }
            }

            return(result);
        }
Example #4
0
 /// <summary>
 /// Constructs the state layer from other state layer.
 /// </summary>
 /// <param name="other">Other state layer.</param>
 public StateLayer(StateLayer other)
 {
     State  = (RelaxedState)other.State.Clone();
     Labels = new StateLabels(other.Labels);
 }
Example #5
0
 /// <summary>
 /// Constructs state labels from other state labels.
 /// </summary>
 public StateLabels(StateLabels other) : base(other)
 {
 }