One possible approach would be to create it in reverse order.
- Create a random board that has a red car in a winning position.
- Build a chart of all reachable positions.
- Choose the position with the greatest distance from each winning position.
The number of reachable positions is not so large (probably always below 100 thousand), therefore, options (2) and (3) are possible.
How to create more complex instances using local search
It is possible that the above approach will not lead to hard cases, since most random cases do not lead to complex vehicle interactions.
You can perform a local search that requires
- way to create other boards from an existing
- rating / suitability function
(2) simple, perhaps use the length of the longest solution, see above. Although it is quite expensive.
(1) requires some thought. Possible changes:
- add a car somewhere
- remove the car (I assume this will always make the board easier).
These two are enough to cover all possible boards. But you can add other methods, since removal makes the board easier. Here are some ideas:
- move the car perpendicular to its direction of movement
- exchange cars in one lane
(aaa..bb.) -> (bb..aaa.)
Hillclimbing / sceepest ascend is probably bad due to a large branching factor. You can try to query a set of possible neighboring boards, i.e. Do not look at everything, but only at a few random ones.
source share