AnyLogic
Expand
Font size
All Known Implementing Classes:
BaseNetworkAStarProvider, ConveyorNetworkAStarProvider, NetworkAStarProvider

public interface IAStarProvider
Graph provider for AStar algorithm

Example:

 
 public class SimpleNetworkProvider implements IAStarProvider {
     public List getOutgoingEdges(Object vertex, Object fromEdge) {
         Node node = (Node)vertex;
         List result = new ArrayList<>(node.getConnectionsCount());
         for (int i = 0; i < node.getConnectionsCount(); i++) {
         Path path = node.getConnection(i);
             if (path.isBidirectional() || path.getSource() == vertex) {
                 result.add(path);
             }
         }
         return result;
     }

     public List getOppositeVertices(Object vertex, Object edge) {
         return Collections.singletonList(((Path)edge).getOtherNode((Node)vertex));
     }

     public double getEdgeScore(Object edge, Object fromVertex, Object toVertex) {
         return ((Path)edge).length();
     }

     public double getVertexScore(Object vertex, Object fromEdge, Object toEdge) {
         return ((Node)vertex).getTransferDistance((Path)fromEdge, (Path)toEdge);
     }
        
     public double getHeuristicScore(Object sourceVertex, Object targetVertex) {
         Position sourcePos = ((Node)sourceVertex).getPosition(0, 1, null);
         Position targetPos = ((Node)sourceVertex).getPosition(0, 1, null);
         return sourcePos.distance(targetPos);
     }
 }
 
 



Method Summary

All Methods Instance Methods Abstract Methods Default Methods 
double getEdgeScore​(java.lang.Object edge, java.lang.Object fromVertex, java.lang.Object toVertex)  
double getHeuristicScore​(java.lang.Object sourceVertex, java.lang.Object targetVertex)  
java.util.List<java.lang.Object> getOppositeVertices​(java.lang.Object vertex, java.lang.Object edge)  
java.util.List<java.lang.Object> getOutgoingEdges​(java.lang.Object vertex, java.lang.Object fromEdge)  
double getVertexScore​(java.lang.Object vertex, java.lang.Object fromEdge, java.lang.Object toEdge)  
default boolean skipEdge​(java.lang.Object edge, java.util.function.Predicate<java.lang.Object> filter)  
default boolean skipVertex​(java.lang.Object vertex, java.util.function.Predicate<java.lang.Object> filter)  
Modifier and Type Method Description

Method Detail

skipEdge

default boolean skipEdge​(java.lang.Object edge,
                         java.util.function.Predicate<java.lang.Object> filter)

skipVertex

default boolean skipVertex​(java.lang.Object vertex,
                           java.util.function.Predicate<java.lang.Object> filter)

getOutgoingEdges

java.util.List<java.lang.Object> getOutgoingEdges​(java.lang.Object vertex,
                                                  java.lang.Object fromEdge)

getOppositeVertices

java.util.List<java.lang.Object> getOppositeVertices​(java.lang.Object vertex,
                                                     java.lang.Object edge)

getEdgeScore

double getEdgeScore​(java.lang.Object edge,
                    java.lang.Object fromVertex,
                    java.lang.Object toVertex)

getVertexScore

double getVertexScore​(java.lang.Object vertex,
                      java.lang.Object fromEdge,
                      java.lang.Object toEdge)

getHeuristicScore

double getHeuristicScore​(java.lang.Object sourceVertex,
                         java.lang.Object targetVertex)
How can we improve this article?