Question
Q. Implement the branch-and-bound algorithm for the Partial Digest Problem (PDP) using your favoriate programming language (e.g., C, C++, Java or Python). Test your program
Q. Implement the branch-and-bound algorithm for the Partial Digest Problem (PDP) using your favoriate programming language (e.g., C, C++, Java or Python). Test your program on the following three datasets. Here, each number in parentheses indicates the multiplicity of the preceding number. L1 = {1(9), 2(8), 3(7), 4(6), 5(5), 6(4), 7(3), 8(2), 9(1)}. L2 = {1(1), 2(1), 3(2), 4(1), 5(2), 6(1), 7(1), 9(2), 10(1), 12(1), 14(1), 15(1)}. L3 = {1(16), 2(15), 3(14), 4(13), 5(12), 6(11), 7(10), 8(9), 9(8), 10(9), 11(8), 12(7), 13(6), 14(5), 15(4), 16(3), 17(2), 18(1)}. To simpify your output, please print only the number of distinct solutions for each dataset (symmetric solutions are considered as the same) and up to three actual distinct solutions (in any order).
PARTIALDIGEST(L) 1 width = Maximum element in L 2 DELETE(width, L) 3 X = {0, width} 4 PLACE(L, X) + PLACE(L, X) 1 if L is empty 2 output X 3 return 4 y Maximum element in L 5 if Aly, X) CL 6 Add y to X and remove lengths Aly, X) from L y 7 PLACE(L, X) 8 Remove y from X and add lengths Aly, X) to L 9 if Alwidth y, X) CL 10 Add width y to X and remove lengths A(width y, X) from L X , 11 PLACE(L, X) 12 Remove width y from X and add lengths A(width y, X) to L 13 returnStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started