I have a assignment on Knapsack(tree and bound) and went online to find out how to code tree and bound
in c++ but most of the resource are all theories.
Thus I don't know how to begin coding and need some help to start off.
I have a assignment on Knapsack(tree and bound) and went online to find out how to code tree and bound
in c++ but most of the resource are all theories.
Thus I don't know how to begin coding and need some help to start off.
I beleive you're asking about how to solve the knapsack problem with a branch and bound algorithm (using proper terminology will get you better results). Yes, most of the resources are theories, because how you implement the algorithm depends on the problem being solved (not to say that you can't implement B&B in a higher order). This page has a nice illistration of the proccess.
So, the first thing, before you even start coding, would be to decide how you want to branch, and how you want to bound. Once you've decided on paper how you want to do this, start implementing them. Test it against some cannidate solutions and see how well they work. Now implementing the rest of the algortihm should become more mechanical.
thank you
Wow. I'm sorry about all of those posts. No idea how that happened.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.