Class SolverBase<T>
The base of the Generic Solvers, which handles all the common functionality.
Namespace: PathFinder.Solvers.Generic
Assembly: PathFinder.dll
Syntax
public abstract class SolverBase<T> : object, IGraphSolver<T>, IComparer<GraphNodeMetaData<T>> where T : IEquatable<T>
Type Parameters
Name | Description |
---|---|
T | The type of the nodes to traverse. |
Properties
| Improve this Doc View SourceClosed
A list of nodes which have already been checked.
Declaration
public IEnumerable<T> Closed { get; }
Property Value
Type | Description |
---|---|
IEnumerable<T> |
ClosedCount
Count of closed nodes.
Declaration
public int ClosedCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Current
The last node to be checked.
Declaration
public T Current { get; }
Property Value
Type | Description |
---|---|
T |
CurrentBestPath
The current best path to get as close as possible to the Destination.
Declaration
public IList<T> CurrentBestPath { get; }
Property Value
Type | Description |
---|---|
IList<T> |
Remarks
Not guaranteed to be a "good" path, and may vary greatly each tick.
Destination
The destination node to search for.
Declaration
public T Destination { get; }
Property Value
Type | Description |
---|---|
T |
MaxTicks
The maximum number of ticks this solver can perform before giving up.
Declaration
public int MaxTicks { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Open
A List of nodes which still need to be checked.
Declaration
public IEnumerable<T> Open { get; }
Property Value
Type | Description |
---|---|
IEnumerable<T> |
OpenCount
Count of open nodes.
Declaration
public int OpenCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Origin
The starting node to search from.
Declaration
public T Origin { get; }
Property Value
Type | Description |
---|---|
T |
Path
Declaration
public IList<T> Path { get; }
Property Value
Type | Description |
---|---|
IList<T> |
PathCost
The cost to get from the Origin to the Destination via the path.
Declaration
public double PathCost { get; }
Property Value
Type | Description |
---|---|
System.Double |
State
The current SolverState.
Declaration
public SolverState State { get; protected set; }
Property Value
Type | Description |
---|---|
SolverState |
Ticks
The number of ticks this solver has performed.
Declaration
public int Ticks { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceRun(Int32)
Runs the solver until a path is found, the allotted ticks is exhausted, or a path could not be found.
Declaration
public SolverState Run(int numTicks = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numTicks |
Returns
Type | Description |
---|---|
SolverState | The SolverState the solver is in after the run. |
Stop()
Stop the current solver.
Declaration
public void Stop()