140 likes | 252 Views
B&B Bed & Breakfast Branch-and-Bound. Chapter 6. Task 11 p. 255. is a bonus task Microsoft belief network (MSBN) troubleshooting office assistant. Methods for 0-1-knapsack problem. Dyn programming W(2 n ) Backtracking W(2 n )
E N D
B&BBed & BreakfastBranch-and-Bound Chapter 6
Task 11 p. 255 • is a bonus task • Microsoft belief network (MSBN) • troubleshooting • office assistant
Methods for 0-1-knapsack problem • Dyn programming W(2n) • Backtracking W(2n) • B&B improvement over Backtracking if have a good bound function
Backtracking way of traversing the tree is selected in advance (depth-first) different of problems threshold bound value selecting any promising child node slower search depth-first search with threshold pruning B&B way of traversing the tree is not selected in advance only optimization problems best bound value selecting best promising child node faster search best-first search with pruning by the best value Backtracking and B&B
Breadth-first search • All nodes at level 1 • All nodes at level 2 • … • All nodes at level n • fig 6.1 (p.223)
v u1 u2 Breadth-first search tree w1 w2 w3 w4 Voidbreadth_first_tree_search(tree T) { queue_of_node Q;// no simple recursion; use a queue node u,v, initialize(Q); // initialize Q= v=root of T; visit v; enqueue(Q,v); // insert item at the end of the queue while(! Empty(Q)) { dequeue(Q,v); //remove an item from the front of the queue for (each child u of v) {visit u; enqueue;} } }
v u1 u2 Breadth-first search tree w1 w2 w3 w4 Voidbreadth_first_tree_search(tree T) { queue_of_node Q;// no simple recursion; use a queue node u,v, initialize(Q); // initialize Q= v=root of T; visit v; enqueue(Q,v); // insert item at the end of the queue while(! Empty(Q)) { dequeue(Q,v); //remove an item from the front of the queue for (each child u of v) {visit u; enqueue;} } } v
v u1 u2 Breadth-first search tree w1 w2 w3 w4 Voidbreadth_first_tree_search(tree T) { queue_of_node Q;// no simple recursion; use a queue node u,v, initialize(Q); // initialize Q= v=root of T; visit v; enqueue(Q,v); // insert item at the end of the queue while(! Empty(Q)) { dequeue(Q,v); //remove an item from the front of the queue for (each child u of v) {visit u; enqueue;} } }
v u1 u2 Breadth-first search tree w1 w2 w3 w4 Voidbreadth_first_tree_search(tree T) { queue_of_node Q;// no simple recursion; use a queue node u,v, initialize(Q); // initialize Q= v=root of T; visit v; enqueue(Q,v); // insert item at the end of the queue while(! Empty(Q)) { dequeue(Q,v); //remove an item from the front of the queue for (each child u of v) {visit u; enqueue;} } } u1
v u1 u2 Breadth-first search tree w1 w2 w3 w4 Voidbreadth_first_tree_search(tree T) { queue_of_node Q;// no simple recursion; use a queue node u,v, initialize(Q); // initialize Q= v=root of T; visit v; enqueue(Q,v); // insert item at the end of the queue while(! Empty(Q)) { dequeue(Q,v); //remove an item from the front of the queue for (each child u of v) {visit u; enqueue;} } } u2
v u1 u2 Breadth-first search tree w1 w2 w3 w4 Voidbreadth_first_tree_search(tree T) { queue_of_node Q;// no simple recursion; use a queue node u,v, initialize(Q); // initialize Q= v=root of T; visit v; enqueue(Q,v); // insert item at the end of the queue while(! Empty(Q)) { dequeue(Q,v); //remove an item from the front of the queue for (each child u of v) {visit u; enqueue;} } } w1
v u1 u2 Breadth-first search tree w1 w2 w3 w4 Voidbreadth_first_tree_search(tree T) { queue_of_node Q;// no simple recursion; use a queue node u,v, initialize(Q); // initialize Q= v=root of T; visit v; enqueue(Q,v); // insert item at the end of the queue while(! Empty(Q)) { dequeue(Q,v); //remove an item from the front of the queue for (each child u of v) {visit u; enqueue;} } } w2
B&B and 0-1 Knapsack problem • Algorithm number of • nodes visited • Backtracking p. 210 fig 5.14 13 • B&B #1 p. 226 fig 6.2 17 • B&B #2 p. 231 fig 6.3 11 • complexity is measured as the number of visited nodes
Traveling salesperson • bound function • greater than current maximum profit • lower bound for the profit • the length of the edge taken when leaving a vertex must be at least as great as the length of the shortest of the edge taken of leaving vertex