A * algorithm
Path scoring
The key to choosing which squares to go through in the path is the following equation:
F = G + H
Over here:
* G = move from Start a, along the resulting path, to the specified squares on the grid. The upper and lower left and right walk is 10, diagonal diagonal Walk is 14, the basic proportion.
* H = estimated movement cost of moving from that square on the grid to end B. h values can be estimated in different ways. The method we use here is called the Manhattan method, which calculates the sum of the horizontal and vertical squares from the current grid to the destination, ignoring the diagonal direction.
F is printed in the upper left corner, G in the lower left corner, and h in the lower right corner.
Genetic algorithm Reference 1 example reference 3
Basic process of genetic algorithm:
He has three basic operations: Select operation (also called copy operation), crossover operation crossover, mutation operation mutation
A * algorithm, genetic algorithm