Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can linear conflict heuristic cause more nodes to be created and explored than Manhattan heuristic with A-Star for 15-Puzzle?

I have coded A-star Algorithm for 15-puzzle using just Manhattan Heuristic and Manhattan and linear conflict heuristic.

My question is, can for some specific puzzle instances linear conflict cause more nodes to be created and explored than Manhattan heuristic alone using a-Star?

Since most of the puzzle instances I tried solving through my program which require <50 Moves solve in decent time with the given memory using just Manhattan and solve faster combining it with linear conflict as heuristic, instances which require >50 Moves causes the program to run indefinitely and hang up my machine, but for a specific problem which takes 42 moves is solved by my program in ~8 seconds using Manhattan but using linear conflict on the same causes the program to run indefinitely and hang up my machine.

I have gone through my code over and over and I can't find an error in my linear conflict or Manhattan heuristic code.Thus, this general question to make sure.

The following instance causes the problem as stated above.

2,8,7,11                 //Takes 42 Moves to solve
5,0,4,15
13,9,14,3
1,10,6,12
like image 380
PhoenixDD Avatar asked Mar 14 '23 05:03

PhoenixDD


1 Answers

Both Manhattan Heuristic and Manhattan with linear conflict are admissible heuristics, i.e. they never overestimate the effort to reach the goal. In addition, Manhattan with linear conflict is more informed than simple Manhattan.

We say a heuristic h2 dominates, or is more informed than a heuristic h1 if h2(n) >= h1(n) for every node n. In this case, A* using h2 as heuristic will always expand a subset of the nodes expanded by h1. Answering your question, A* with the Manhattan and linear conflict heuristic can not expand more nodes, in fact, can not expand any node that was not expanded by A* with the simple Manhattan heuristic, i.e. the set of nodes expanded by A* with Manhattan-linear-conflict is a subset of the nodes expanded by A* with plain Manhattan.

Try to review your code with the debugger and find this scenario, this will probably help you finding the bug in the implementation.

For a more formal answer I encourage you to read carefully this post.

Regarding your issue with your machine hanged up in difficult problems, A* must store all closed and open nodes, incurring in exponential waste of memory. To solve 15-puzzle problems go for iterative deepening (IDA*) where the execution time and memory consumption are better.

like image 96
FrankS101 Avatar answered Apr 28 '23 02:04

FrankS101