Java icon indicating copy to clipboard operation
Java copied to clipboard

Travelling Salesman - DP Optimisation using BitManipulation

Open Rytnix opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. In this algo we are going to use Bitmasking technique to solve famous NP-hard Traveling Salesman Problem. As we know working with bits decreases the time complexity little bit.

Describe the solution you'd like For min. distance between two cells we are going to use BFS. For the overall we are going to maintain a dp state to track the visited houses and the last visited house to uniquely identify a state in this problem. Therefore, we will be taking dp[index][mask] as our DP state.

Describe alternatives you've considered. I didn't find the implementation of naive approach too. I will implement that also.

Additional context The Time complexity of naive approach is (n!) where as the TC of bitmask dp approach will be (n^2 * 2^n) which is better than the naive approach.

Rytnix avatar Sep 16 '22 07:09 Rytnix

Hi @siriak I will love to work on this feature. Please assign me.

Rytnix avatar Sep 16 '22 07:09 Rytnix

Can you assign me this if not done? @siriak

Siddharthqr avatar Oct 01 '22 18:10 Siddharthqr

Hello, I want to work over this, please assign it to me.

hd2342-dubey avatar Oct 02 '22 00:10 hd2342-dubey

Hi @siriak i was working on this project.

Rytnix avatar Oct 02 '22 13:10 Rytnix

Here is my fix @siriak. Please review.

Rytnix avatar Oct 15 '22 18:10 Rytnix

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 27 '23 00:01 github-actions[bot]

Please reopen this issue once you add more information and updates here. If this is not the case and you need some help, feel free to seek help from our Gitter or ping one of the reviewers. Thank you for your contributions!

github-actions[bot] avatar Feb 03 '23 00:02 github-actions[bot]