Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Algorithm Design and Analysis

Nama : Muhammad Rizal Ariyanto


NIM : 2402008573
Kelas : LNCA
Diskusi : Forum Session 5

Job Sequencing
Dalam pekerjaan sehari2, kita sering mendapatkan tugas atau pekerjaan yang banyak tetapi
dalam waktu yang terbatas. Masalah penjadwalan pekerjaan (job sequencing w/ deadline) juga
dapat diselesaikan dengan metode greedy. Coba berikan contoh penyelesaian dan bandingkan
dengan metode biasa, apakah hasil dengan metode greedy optimal?

JAWABAN

Berikut ini merupakan contoh job sequencing with deadline menggunakan konsep metode
greedy.

There are 4 jobs.


- Job 1 can generate profits 110 if completed by the deadline in the second order
(sequence).
- Job 2 can generate profits 47 if completed by the deadline in the first order (sequence).
- Job 3 can generate profits 25 if completed by the deadline in the second order (sequence).
- Job 4 can generate profits 20 if completed by the deadline in the first order (sequence).

n=4;
(p1,p2,p3,p4) = (110,47,25,20);
(d1,d2,d3,d4)=(2,1,2,1)
d1,d2,d3,d4  deadline
p1,p2,p3,p4  profit
Algorithm Design and Analysis

Dengan teknik biasa (complete) :

(1) sequence (1) profit 110


(2) sequence (2) profit 47
(3) sequence (3) profit 25
(4) sequence (4) profit 20
(1, 2) sequence (2, 1) profit 157
(1, 3) sequence (1, 3) or (3, 1) profit 135
(1, 4) sequence (4, 1) profit 130
(2, 3) sequence (2, 3) profit 72
(3, 4) sequence (4, 3) profit 45

Dengan metode greedy :

Job Consideration Action


Job 1 Can be assigned to [1,2], accept
{1} Job 2 Can’t fit, reject
{1} Job 3 Can be assigned to [1,2], accept
{1,3} Job 4 Can’t fit, reject

You might also like