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.
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 |