Skip to content

Commit

Permalink
Update frontier sort method (using minor f and major g)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreKavalerski committed Jul 4, 2020
1 parent 4946b85 commit 0874665
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function run(goalState: State, frontier: NodeInfo[], expandedStates: State[]): N
expandedStates.push(actualNode.state);
}

frontier.sort((a, b) => (a.evaluationFunctionValue.f < b.evaluationFunctionValue.f) ? -1 : 1); // Order frontier according to heuristic value of nodes
frontier.sort((a, b) => (a.evaluationFunctionValue.f < b.evaluationFunctionValue.f) ? -1 : ((a.evaluationFunctionValue.f === b.evaluationFunctionValue.f) ? ((a.evaluationFunctionValue.g > b.evaluationFunctionValue.g) ? -1 : 1): 1)); // Order frontier according to heuristic value of nodes

return run(goalState, frontier, expandedStates);
}
Expand Down

0 comments on commit 0874665

Please sign in to comment.