Branch and bound method - loading problem

In the previous section, we learned what the branch-and-bound method is. As usual, we have to summarize the ideas and patterns of the branch-and-bound method based on examples.

To put it simply, we learned that the branch and bound method is actually a breadth-first traversal of the solution space tree, and its core can be broken down into two words: branch and limit. Branch represents the possible branches expanded according to breadth, and limit represents what we have specified. Upper and lower bound conditions for pruning. Feasible nodes are added to the live node table, and unfeasible nodes are pruned until we find a branch that meets the output conditions.


Let's review the loading issue, 

 This is a subset tree problem. Remember when we used the backtracking method to solve it, we traversed the entire solution space in sequence and pruned according to the limiting conditions. Now we need to use the branch and bound method to solve it, so for this problem we need to figure out the branches. Starting from the root node is c1c2c3. If c1 is selected, the branch is c2c3, and if c1c2 is selected, the branch is c3. Of course you can choose not to. The limit is to stipulate that the total weight does not exceed c and requires the maximum bestw to be recorded.

 (Note that MaxLoading is not executed only once, but requires traversing the entire subset tree)

 After improvement, a pruning condition was added, pruning the current weight Ew + remaining weight r <= bestw, because adding all of them will not exceed bestw, so there is no need to traverse again.


The above code is a queue-type branch and bound method, and there is also a priority queue-type branch and bound method.

I found a picture online

 To put it simply, for a product, our only choice is to select it or not. If you want to load heavier goods as much as possible, then its upper bound must be as large as possible. In the example given in the figure, we find that up = the weight of all selected goods + the weight of available goods, which represents the upper bound of the maximum weight. So if we want to find the optimal solution, we must start from the above Search in the sub-tree of Jie Da. The value of this up will be subtracted from the weight if and only if we know that a certain product will not be selected. For example, the second layer finds that 8+6=14>c1=12. In the case of over-heavy pruning we will go directly to the right subtree. In the third level, although the upper bound of the left subtree is larger, we find that the final maximum value of up is in the right subtree when up=11. This is why we no longer traverse the path from A to C, because A Up here at C is also 11, which is not greater than the bestw=11 we recorded (bestw is only updated when it is a leaf node), so it is pruned.

 


From these two questions, we summarize the general rules of the branch and bound method:

The concepts of the branch and bound method are branches and limits. Branches are how we choose to expand nodes, and limits are the upper and lower bounds we need to define. There are many conditions for judging whether understanding is obtained:

For example, if our solution reaches the upper bound, it means that it is already optimal, and it is the solution we are looking for.

If the upper bound of a certain branch is lower than the overall lower bound, it means it is no longer within the solution range and we need to prune.

The priority queue actually expresses the dynamic update of the limit. The upper bound or lower bound of each layer is updated in real time. The optimal solution we traverse each time can be used as the new upper bound or lower bound. In this way The advantage is that part of the path can be pruned directly, resulting in less calculation.

Guess you like

Origin blog.csdn.net/milu_ELK/article/details/127956343