Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi,
I have an intriguing problem that looks like a travelling salesman problem but I want to see whether someone has a better solution. So what I have is an NxM matrix with both positive and negative numbers (ints):
What Iam looking for is a path that has the highest total sum from aa > bb
From the above it follows that I can slide or I can go by one position in any direction except the diagonal. Given a starting position (x - any random position) the task is to discover the value in the matrix (let say N=10, M=10) so that the number of moves (summing operations) from x to that position is the minimum possible and the total sum (summarized values) of the path is the maximum possible. In tha above example path C would be the best candidate but i haven't worked out all possible paths so I don't know. Is there a clever (meaning fast) way to compute this? thank you In reply to Highest total sum path problem by baxy77bax
|
|