public Builder() { heuristic = ZeroPathCostHeuristic; maxSearchDepth = UnlimitedSearchDepth; maxSecondsPerSearch = UnlimitedSecondsPerSearch; assumeNonNegativeCosts = DefaultAssumeNonNegativeCosts; }
//Maximum depth defines maximum number of edges, allowed in a path. //A negative value indicates no depth limit. public AStarPathfinder( PathCostHeuristic <TGraphNode> heuristic) : this(new AStarPathfinderConfiguration <TGraphNode> .Builder() .UseHeuristic(heuristic) .AssumeNonNegativeCosts() .Build()) { }
//private bool assumeNonNegativeCosts; /// <summary> /// Initializes a new instance of the <see cref="Terrapass.GameAi.Goap.Graphs.AstarPathfinderConfiguration`1+Builder"/> /// with default configuration (zero heuristic, no limit on search depth, no assumptions). /// </summary> public Builder() { this.heuristic = ZeroPathCostHeuristic; this.maxSearchDepth = UNLIMITED_SEARCH_DEPTH; this.maxSecondsPerSearch = UNLIMITED_SECONDS_PER_SEARCH; //this.assumeNonNegativeCosts = DEFAULT_ASSUME_NON_NEGATIVE_COSTS; }
/// <summary> /// Initializes a new instance of the <see cref="Terrapass.GameAi.Goap.Graphs.AstarPathfinder`1"/> class. /// </summary> /// <param name="heuristic">Heuristic to be used.</param> /// <param name="maxSearchDepth"> /// Maximum depth for search, i.e. maximum number of edges, allowed in a path. /// A negative value indicates no depth limit. /// </param> public AstarPathfinder( PathCostHeuristic <GraphNode> heuristic, int maxSearchDepth = AstarPathfinderConfiguration <GraphNode> .UNLIMITED_SEARCH_DEPTH ) : this(new AstarPathfinderConfiguration <GraphNode> .Builder() .UseHeuristic(heuristic) .LimitSearchDepth(maxSearchDepth) .Build()) { }
public AStarPathfinder(AStarPathfinderConfiguration <TGraphNode> configuration = null) { if (configuration == null) { configuration = new AStarPathfinderConfiguration <TGraphNode> .Builder().Build(); } heuristic = configuration.Heuristic; maxSearchDepth = configuration.MaxSearchDepth; maxSecondsPerSearch = configuration.MaxSecondsPerSearch; assumeNonNegativeCosts = configuration.AssumeNonNegativeCosts; }
private AStarPathfinderConfiguration( PathCostHeuristic <TGraphNode> heuristic, int maxSearchDepth = UnlimitedSearchDepth, float maxSecondsPerSearch = UnlimitedSecondsPerSearch, bool assumeNonNegativeCosts = DefaultAssumeNonNegativeCosts ) { Heuristic = PreconditionUtils.EnsureNotNull(heuristic, "heuristic must not be null"); MaxSearchDepth = maxSearchDepth; MaxSecondsPerSearch = maxSecondsPerSearch; AssumeNonNegativeCosts = assumeNonNegativeCosts; }
//public bool AssumeNonNegativeCosts { get; } private AstarPathfinderConfiguration( PathCostHeuristic <GraphNode> heuristic, int maxSearchDepth, float maxSecondsPerSearch //, //bool assumeNonNegativeCosts ) { this.Heuristic = PreconditionUtils.EnsureNotNull(heuristic, "heuristic must not be null"); this.MaxSearchDepth = maxSearchDepth; this.MaxSecondsPerSearch = maxSecondsPerSearch; //this.AssumeNonNegativeCosts = assumeNonNegativeCosts; }
//private readonly bool assumeNonNegativeCosts; public AstarPathfinder(AstarPathfinderConfiguration <GraphNode> configuration = null) { // If no configuration is provided, use default. if (configuration == null) { configuration = new AstarPathfinderConfiguration <GraphNode> .Builder().Build(); } this.heuristic = configuration.Heuristic; this.maxSearchDepth = configuration.MaxSearchDepth; this.maxSecondsPerSearch = configuration.MaxSecondsPerSearch; //this.assumeNonNegativeCosts = configuration.AssumeNonNegativeCosts; }
// Specifies the heuristic to be used by A*. public Builder UseHeuristic(PathCostHeuristic <TGraphNode> pathCostHeuristic) { heuristic = PreconditionUtils.EnsureNotNull(pathCostHeuristic, "heuristic"); return(this); }