• Articles
  • Api Documentation
Show / Hide Table of Contents
  • AnyPath
    • Graphs
      • Extra
        • Line2D
        • Line3D
        • Triangle
      • HexGrid
        • HexGrid
        • HexGrid.Enumerator
        • HexGridCell
        • HexGridHeuristicProvider
        • HexGridType
      • Line
        • ClosestLineLocationPredicate
        • LineGraph
        • LineGraph.Edge
        • LineGraph.Enumerator
        • LineGraphBuilder
        • LineGraphBuilder.ProtoEdge
        • LineGraphDrawer
        • LineGraphHeuristic
        • LineGraphLocation
        • LineGraphPopulator
        • LineGraphProcessor
        • LineGraphWelder
        • SceneGraph
          • LineGraphNode
          • LineSceneGraph
          • LineSceneGraphEdge
          • SceneGraphNodeEditor
      • NavMesh
        • ClosestNavMeshLocationPredicate
        • CornerAndNormal
        • IUnrolledNavMeshGraphPortal
        • NavMeshGraph
        • NavMeshGraph.EnterCostAndFlags
        • NavMeshGraph.Enumerator
        • NavMeshGraphCorners
        • NavMeshGraphCorners3D
        • NavMeshGraphHeuristic
        • NavMeshGraphLocation
        • NavMeshGraphUnroller
        • NavMeshLineBitmaskMod
        • NavMeshLineMod
        • NavMeshPlaneBitmaskMod
        • NavMeshPlaneMod
        • NavMeshPopulator
        • NavMeshWelder
        • SSFA
        • UnrolledNavMeshGraphPortal
      • Node
        • NodeGraph
        • NodeGraphNode
      • PlatformerGraph
        • ClosestPlatformerGraphLocationPredicate
        • PlatformerGraph
        • PlatformerGraph.Enumerator
        • PlatformerGraphBuilder
        • PlatformerGraphBuilder.ProtoEdge
        • PlatformerGraphDrawer
        • PlatformerGraphHeuristic
        • PlatformerGraphLocation
        • PlatformerGraphPopulator
        • PlatformerGraphProcessor
        • PlatformerGraphWelder
        • SceneGraph
          • PlatformerSceneGraph
          • PlatformerSceneGraphEdge
          • PlatformerSceneGraphNode
          • SceneGraphNodeEditor
      • SquareGrid
        • SquareGrid
        • SquareGrid.Enumerator
        • SquareGridCell
        • SquareGridHeuristicProvider
        • SquareGridHeuristicProviderEightDirectional
        • SquareGridHeuristicProviderManhattanDistance
        • SquareGridType
      • VoxelGrid
        • VoxelGrid
        • VoxelGrid.DirCost
        • VoxelGrid.Enumerator
        • VoxelGridCell
        • VoxelGridDirectionFlags
        • VoxelGridDirectionMod
        • VoxelGridHeuristicProvider
        • VoxelGridHeuristicProviderManhattanDistance
    • Managed
      • ClearFinderFlags
      • FinderExtensions
      • IFinder
      • IOptionReserver<TOption>
      • IOptionValidator<TOption>
      • ImmutableFinderException
      • ManagedDisposeExtensions
      • Results
        • DijkstraResult<TNode>
        • Eval
        • Eval<TOption>
        • MultiEvalResult
        • MultiPathResult<TSeg>
        • Path<TSeg>
        • Path<TOption, TSeg>
    • Native
      • AStarCheapestOption
      • AStarEvalOptionResult
      • AStarEvalResult
      • AStarFindOptionResult
      • AStarFindPathResult
      • AStarOption
      • AStarStops
      • AStar<TNode>
      • ComposedGraph<TGraph, TNode>
      • Edge<TNode>
      • FlagBitmask<TNode>
      • IEdgeMod<TNode>
      • IGraph<TNode>
      • IHeuristicProvider<TNode>
      • INodeFlags
      • IPathProcessor<TNode, TSeg>
      • NativeListWrapper<TSeg>
      • NoEdgeMod<TNode>
      • NoProcessing<TNode>
      • OffsetInfo
      • ReversedGraph<TNode>
      • EdgeMods
        • AdditionalAndExcludeEdges<TNode>
        • AdditionalEdges<TNode>
        • ExcludeEdges<TNode>
        • ExcludeLocations<TNode>
      • Heuristics
        • ALTCompute<TGraph, TNode>
        • ALTSerialization
        • ALT<TNode>
        • LandmarkSelection<TGraph, TNode, TEnumerator>
      • Util
        • IRefComparer<T>
        • NativeMinHeap<T, TComp>
        • NativeRefMinHeap<T, TComp>

Class ALTCompute<TGraph, TNode>

Utility class to generate ALT<TNode> heuristics. This class contains static methods that run burst accelerated code for generating the ALT heuristics. The included SquareGrid example demonstrates how to use this.

Inheritance
object
ALTCompute<TGraph, TNode>
Namespace: AnyPath.Native.Heuristics
Assembly: AnyPath.dll
Syntax
public class ALTCompute<TGraph, TNode> where TGraph : struct, IGraph<TNode> where TNode : unmanaged, IEquatable<TNode>
Type Parameters
Name Description
TGraph

The type of graph to generate ALT heuristics for

TNode

The type of node, tied to the graph

Remarks

Because of a limitation of the burst compiler, you need to explicity provide the types to this class when calling any of the static methods it contains. See https://docs.unity3d.com/Packages/com.unity.burst@1.8/manual/compilation-generic-jobs.html for more information.

Constructors

ALTCompute()

Declaration
public ALTCompute()

Methods

ComputeDirected(ALT<TNode>, ref TGraph, ref ReversedGraph<TNode>, TNode[])

Computes ALT heuristics for a set of landmarks. Use this version if your graph contains directed edges.

Declaration
public static void ComputeDirected(ALT<TNode> alt, ref TGraph graph, ref ReversedGraph<TNode> reversedGraph, TNode[] landmarks)
Parameters
Type Name Description
ALT<TNode> alt
TGraph graph

The graph to compute ALt heuristics for

ReversedGraph<TNode> reversedGraph

The reversed version of the graph. ReversedGraph<TNode>.

TNode[] landmarks

Array containing the landmarks. Ideally, landmarks should be placed "behind" frequent starting and goal locations in the graph. Currently a maximum of 31 landmarks is supported.

Remarks

The computation can be resource intensive for large graphs. This operation is done in parallel and using Unity's Burst compiler to maximize performance.

ComputeUndirected(ALT<TNode>, ref TGraph, TNode[])

Declaration
public static void ComputeUndirected(ALT<TNode> alt, ref TGraph graph, TNode[] landmarks)
Parameters
Type Name Description
ALT<TNode> alt
TGraph graph
TNode[] landmarks

ScheduleComputeDirected(ALT<TNode>, ref TGraph, ref ReversedGraph<TNode>, NativeArray<TNode>, JobHandle)

Computes this ALT heuristic provider in parallel using Unity's Job system. This is the fastest way to compute ALT heuristics.

Declaration
public static JobHandle ScheduleComputeDirected(ALT<TNode> alt, ref TGraph graph, ref ReversedGraph<TNode> reversedGraph, NativeArray<TNode> landmarks, JobHandle dependsOn = default)
Parameters
Type Name Description
ALT<TNode> alt
TGraph graph
ReversedGraph<TNode> reversedGraph
NativeArray<TNode> landmarks
JobHandle dependsOn
Returns
Type Description
JobHandle

A jobhandle that must be completed before this heuristic provider can be used

ScheduleComputeUndirected(ALT<TNode>, ref TGraph, NativeArray<TNode>, JobHandle)

Computes this ALT heuristic provider in parallel using Unity's Job system. This is the fastest way to compute ALT heuristics.

Declaration
public static JobHandle ScheduleComputeUndirected(ALT<TNode> alt, ref TGraph graph, NativeArray<TNode> landmarks, JobHandle dependsOn = default)
Parameters
Type Name Description
ALT<TNode> alt
TGraph graph
NativeArray<TNode> landmarks
JobHandle dependsOn
Returns
Type Description
JobHandle

A jobhandle that must be completed before this heuristic provider can be used

Extension Methods

FinderExtensions.AddOption<T, TNode, TOption>(T, TOption, TNode, TNode)
FinderExtensions.AddOptions<T, TNode, TOption>(T, IEnumerable<TOption>, TNode, Func<TOption, TNode>)
FinderExtensions.AddRange<T, TNode, TOption>(T, IEnumerable<TOption>, TNode, Func<TOption, TNode>)
FinderExtensions.AddRequest<T, TNode>(T, TNode, TNode)
FinderExtensions.AddRequests<T, TNode>(T, IEnumerable<TNode>)
FinderExtensions.AddStop<T, TNode>(T, TNode)
FinderExtensions.AddStops<T, TNode>(T, IEnumerable<TNode>)
FinderExtensions.SetComparer<T, TOption>(T, IComparer<TOption>)
FinderExtensions.SetEdgeMod<T, TMod>(T, TMod)
FinderExtensions.SetGraph<T, TGraph>(T, TGraph)
FinderExtensions.SetHeuristicProvider<T, TH>(T, TH)
FinderExtensions.SetPathProcessor<T, TProc>(T, TProc)
FinderExtensions.SetReserver<T, TOption>(T, IOptionReserver<TOption>)
FinderExtensions.SetStartAndGoal<T, TNode>(T, TNode, TNode)
FinderExtensions.SetValidator<T, TOption>(T, IOptionValidator<TOption>)
In This Article
Back to top Generated by DocFX