I'm working on a NP-hard problem algorithm (like hand seller problem) and I can't find the proper algorithm. I will appreciate if anyone can help me with it. We have a (x,y)
matrix, there is a robot in the (n,m)
block and there are some rubbish in the matrix blocks.
We want the robot to go to each block that has a rubbish, after crossing all of them it comes back to its first block. There are two conditions in the related question:
- The robot can only move horizontal and vertical.
- The output is an integer that is the length of the path that it has crossed. This path must have minimum length.
For example, inputs are:
10 10 ----> x,y
1 1 ----> n,m
4 ----> number of rubbishes
position of rubbish:
2 3
5 5
9 4
6 5
output is:
24
Like this?
Point definition:
The node:
A Solver algorithm: