I’m a CS student and I’m trying to understand the searching algorithms used in AI.
My problem is that I don’t really understand how to treat a problem like a search problem. I don’t know which would be the first steps for solving it and how shall I choose the right algorithm for that.
For example, I have a problem like that:
n vehicles occupy squares (1, 1) through (n, 1) (i.e., the bottom row) of an n×n n grid. The vehicles must be moved to the top row but in reverse order; so the vehicle i that starts in (i, 1) must end up in (n−i+ 1, n). On each time step, every one of the n vehicles can move one square up, down, left, or right, or stay put; but if a vehicle stays put, one other adjacent vehicle (but not more than one) can hop over it. Two vehicles cannot occupy the same square.
I understood that the start state of each car is the bottom row, each car has at most five possible moves from any position and if each car has a 3×3 grid of empty space around it, then all five moves are possible.
My idea is that I should treat the car route like a tree where each node is a position of the car at a time, but I don’t know how correct is it.
Which would be my first steps regarding this problem to solve it like a search problem?
I would be very thankful for any advice!