0% found this document useful (0 votes)
49 views4 pages

Tugas Personal Ke-2 (Minggu 7 / Sesi 11)

The document contains 4 problems related to optimization algorithms: 1) The knapsack problem to find the maximum value combination of items with a total weight of 19kg. 2) Finding the shortest path from node A to J in a multistage graph using forward and backward dynamic programming. 3) Solving the travelling salesman problem to find the shortest route visiting Luhu, Piru, and Kairatu starting and ending in Supe. 4) Finding the maximum combination of coin denominations (2, 3, 7) that sum to 47.

Uploaded by

Kristianto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views4 pages

Tugas Personal Ke-2 (Minggu 7 / Sesi 11)

The document contains 4 problems related to optimization algorithms: 1) The knapsack problem to find the maximum value combination of items with a total weight of 19kg. 2) Finding the shortest path from node A to J in a multistage graph using forward and backward dynamic programming. 3) Solving the travelling salesman problem to find the shortest route visiting Luhu, Piru, and Kairatu starting and ending in Supe. 4) Finding the maximum combination of coin denominations (2, 3, 7) that sum to 47.

Uploaded by

Kristianto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Tugas Personal ke-2

(Minggu 7 / Sesi 11)

1. [Knapsack Problem] Berikut ini merupakan permasalahan Knapsack tentukan kombinasi barang yang dapat
diambil yang mampu memberikan keuntungan maksimum dengan menggunakan konsep metode Dynamic
Programming apabila diketahui barang terbatas dan tak dapat dipecah dimana kapasitas maksimum dari tas
adalah 19 Kg.

Item Value Weight


Diamond $4,120 3
Zamrud $4,580 4
Ruby $3,720 2
Sapphire $3,860 3
Gold $5,125 6
Pearl $2,250 2
Silver $5,450 8
Jawaban = gold, sapphire, ruby, zamrud, diamond = $21405

2. [Multistage Graph] Carilah jalur terpendek dari node A ke node J pada multistage graph dibawah
menggunakan metode dynamic programming (pendekatan forward dan backward)!

1
D G
3 4
7
B 4
5 6
3 3
E H
A J
5 4 2
3
C 8 6 3
F 3 I
Pendekatan Forward

cost(5, J) =0
cost(4, G) = min{c (G, J) + cost(5, J)} = 7
cost(4, H) = min{c (H, J) + cost(5, J)} = 3
cost(4, I) = min{c (I, J) + cost(5, J)} = 3

This study source was downloaded by 100000838835617 from CourseHero.com on 09-19-2022 19:24:55 GMT -05:00
COMP6127 - Algorithm Design and Analysis
https://www.coursehero.com/file/38829807/20171026101838-TP2-W7-S11-R0doc/
cost(3, D) = min{c (D, G) + cost(4, G) | c (D, H) + cost(4, H)}
= min{(1) + 7 | (4) + 3} = 7
cost(3, E) = min{c (E, G) + cost(4, G) | c (E, H) + cost(4, H) | c (E, I) + cost(4, I)}
= min{(6) + 7 | (3) + 3 | (2) + 3} = 5
cost(3, F) = min{c (F, H) + cost(4, H) | c (F, I) + cost(4, I)}
= min{(6) + 3 | (3) + 3} = 6
cost(2, B) = min{c (B, D) + cost(3, D) | c (B, E) + cost(3, E) | c (B, F) + cost(3, F)}
= min{(3) + 7 | (4) + 5 | (4) + 6} = 9
cost(2, C) = min{c (C, D) + cost(3, D) | c (C, F) + cost(3, F)}
= min{(5) + 7 | (8) + 6} = 12
cost(1, A) = min{c (A, B) + cost(2, B) | c (A, C) + cost(2, C)}

= min{(5) + 9 | (3) + 12} = 14

Pendekatan Backward

cost(1, A) =0
cost(2, B) = min{c (A, B) + cost(1, A)} = 5
cost(2, C) = min{c (A, C) + cost(1, A)} = 3
cost(3, D) = min{c (B, D) + cost(2, B) | c (C, D) + cost(2, C)}
= min{(3) + 5 | (5) + 3} = 8
cost(3, E) = min{c (B, E) + cost(2, B)}
= min{(4) + 5} = 9
cost(3, F) = min{c (B, F) + cost(2, B) | c (C, F) + cost(2, C)}
= min{(4) + 5 | (8) + 3} = 9
cost(4, G) = min{c (D, G) + cost(3, D) | c (E, G) + cost(3, E)}
= min(1) + 8 | (6) + 9} = 9
cost(4, H) = min{c (D, H) + cost(3, D) | c (E, H) + cost(3, E) | c (F, H) + cost(3, F)}
= min{(4) + 8 | (3) + 9 | (6) +9} = 12
cost(4, I) = min{c (E, I) + cost(3, E) | c (F, I) + cost(3, F)}
= min{(2) + 9 | (3) + 9} = 11
cost(5, J) = min{c (G, J) + cost(4, G) | c (H, J) + cost(4, H) | c (I, J) + cost(4, I)}

= min{(7) + 9 | (3) + 12 | (3) + 11)} = 14

B
J
5 4
E
A 2 3

3. [Travelling Salesman Problem] Carilah jalur terpendek dari Supe mengunjungi Luhu, Piru, dan Kairatu dan
kembali ke Supe jika diketahui biaya transportasi sebagai berikut menggunakan metode dynamic
programming.

From To Cost

Supe Luhu Rp. 20.000

This study source was downloaded by 100000838835617 from CourseHero.com on 09-19-2022 19:24:55 GMT -05:00
COMP6127 - Algorithm Design and Analysis
https://www.coursehero.com/file/38829807/20171026101838-TP2-W7-S11-R0doc/
Supe Piru Rp. 15.000

Supe Kairatu Rp. 25.000

Luhu Supe Rp. 19.000

Luhu Piru Rp. 21.000

Luhu Kairatu Rp. 27.000

Piru Supe Rp. 18.000

Piru Kairatu Rp. 15.000

Piru Luhu Rp. 12.000

Kairatu Piru Rp. 16.000

Kairatu Supe Rp. 26.000

Kairatu Luhu Rp. 17.000

4. [Coin Change Problem] Carilah kombinasi jumlah pecahan uang maksimum yang dapat dibentuk dari
nominal uang 47 dimana pecahan nominal uang adalah 2, 3, dan 7!

This study source was downloaded by 100000838835617 from CourseHero.com on 09-19-2022 19:24:55 GMT -05:00
COMP6127 - Algorithm Design and Analysis
https://www.coursehero.com/file/38829807/20171026101838-TP2-W7-S11-R0doc/
p\i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 total
P1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 47
p2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 47
p3 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 47
p4 0 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 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p25 0 0 0 0 0 0 0 0 0 0 2 2 2 2 3 3 3 3 3 3 7 7 7 47
p26 0 0 0 0 0 0 0 0 0 0 0 2 3 3 3 3 3 3 3 3 7 7 7 47
p27 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 3 7 7 7 7 47
p28 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 3 3 3 7 7 7 7 47
p29 0 0 0 0 0 0 0 0 0 0 0 0 2 2 3 3 3 3 3 7 7 7 7 47
p30 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 7 7 7 7 7 47
p31 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 3 3 7 7 7 7 7 47
p32 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 7 7 7 7 7 47
p33 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 3 3 7 7 7 7 7 47
p34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 3 7 7 7 7 7 7 47
Paling maximum :

P1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 47

This study source was downloaded by 100000838835617 from CourseHero.com on 09-19-2022 19:24:55 GMT -05:00
COMP6127 - Algorithm Design and Analysis
https://www.coursehero.com/file/38829807/20171026101838-TP2-W7-S11-R0doc/
Powered by TCPDF (www.tcpdf.org)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy