public override bool Equals(object obj)
        {
            MMStarConstraint other = (MMStarConstraint)obj;

            if (this.agentNum != other.agentNum)
            {
                return(false);
            }

            if (this.vertexConflict || other.vertexConflict) // This way if the constraint is a vertex constraint than it will be equal to a query containing a move from any direction to that position,
                                                             // and if it is an edge constraint than it will only be equal to queries containing a move from that specific direction to that position.
            {
                return(this.move.Equals(other.move));
            }
            else // A vertex constraint is different to an edge constraint for the same agentNum and position.
                 // Must check the direction explicitly because vertex constraints have no direction and moves with no direction
                 // compare equal to moves with any direction
            {
                return(this.move.Equals(other.move) && this.move.direction == other.move.direction);
            }
        }
Beispiel #2
0
        private bool Expand
        (
            MAM_AgentState node
        )
        {
            MMStarConstraint queryConstraint = new MMStarConstraint(node.agentIndex, node.lastMove.x, node.lastMove.y, node.lastMove.direction, node.lastMove.time);

            if (constraints.Contains(queryConstraint))
            {
                return(false);
            }
            if (expandedNodes.Contains(node))
            {
                nodesExpanded--;
                return(false);
            }
            expandedNodes.Add(node);
            foreach (MAM_AgentState child in node.GetChildrenStates())
            {
                Generate(node, child);
            }
            return(true);
        }