tabel simpleks

24
TABEL SIMPLEKS >> Penyelesaian: Membuat program untuk menunjang kemajuan perusahaan. Tujuan memaximalkan Z = 50 x1 + 40 x2 Kendala-kendala: 0,4x1 + 0,5x2 < 326 0,5x1 + 0,3x2 < 354 0,05x1 + 0,1 < 62 Bentuk bakunya : Z = 50x1 + 40x2 + 0.s1 +0.s2 + 0.s3 0,4x1 + 0,4x2 + s1 = 326 0,5x1 + 0,3x2 + s2 = 354 0,05x1 + 0,1 + s3 = 62 Tabel simpleks VD Z X1 X2 S1 S2 S3 NK Z 1 -50 -40 0 0 0 0 S1 0 0,4 0,5 1 0 0 326 S2 0 0,5 0,3 0 1 0 354 S3 0 0,05 0,1 0 0 1 62 KOLOM KERJA BARIS PIVOT

Upload: cw3thy99

Post on 19-Nov-2014

191 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: TABEL SIMPLEKS

TABEL SIMPLEKS

>> Penyelesaian:

Membuat program untuk menunjang kemajuan perusahaan.

Tujuan memaximalkan Z = 50 x1 + 40 x2

Kendala-kendala:

0,4x1 + 0,5x2 < 326

0,5x1 + 0,3x2 < 354

0,05x1 + 0,1 < 62

Bentuk bakunya :

Z = 50x1 + 40x2 + 0.s1 +0.s2 + 0.s3

0,4x1 + 0,4x2 + s1 = 326

0,5x1 + 0,3x2 + s2 = 354

0,05x1 + 0,1 + s3 = 62

Tabel simpleks

VD Z X1 X2 S1 S2 S3 NK

Z 1 -50 -40 0 0 0 0

S1 0 0,4 0,5 1 0 0 326

S2 0 0,5 0,3 0 1 0 354

S3 0 0,05 0,1 0 0 1 62

KOLOM KERJA

BARIS PIVOT

Page 2: TABEL SIMPLEKS

Kolom kerja adalah nilai negatif terbesar

Baris pivot adalah perbandingan nilai solusi dengan nilai pada kolom kerja

S1 $ 326 : 0,4 = 815

S2 $ 354 : 0,5 = 708

S3 $ 62 : 0,05 = 1240

Rubah semua nilai pada baris Pivot dengan cara membagi nilai lama bari pivot dengan baris pivot (0,5)

Maka tabel simpleks alan berubah

VD Z X1 X2 S1 S2 S3 NK

Z 1 -50 -40 0 0 0 0

S1 0 0,4 0,5 1 0 0 326

CB 0 1 0,6 0 2 0 708

S3 0 0,05 0,1 0 0 1 62

Lakukan interasi pertama

Rubah nilai dengan nilai baru dengan cara:

Nilai baru = nilai lama – (nilai kolom kerja X nilai baru baris pivot)

Tabel simpleks

VD Z CB X2 S1 S2 S3 NK

Z 1 0 -10 0 100 0 35400

S1 0 0,4 0,26 1 -0,8 0 32,8

CB 0 1 0,6 0 2 0 708

S3 0 0 0,07 0 -0,1 1 26,6

Karena masih terdapat nilai negatif pada baris CB dan PR, lakukan interasi kedua

Lakukan hal yang sama, yaitu tentukan dulu kolom kerja sampai menghitung nilai baru.

Tabel simpleks

BARIS PIVOT

Page 3: TABEL SIMPLEKS

VD Z CB PR S1 S2 S3 NK

Z 1 0 0 38,46 69,23 0 37046,15

PR 0 0 1 3,84 -3,07 0 164,61

CB 0 1 0 -2,30 3,84 0 609,23

S3 0 0 0 -0,26 0,11 1 15,07

Pada tabel diatas sudah tidak terdapat nilai negatif pada baris CB dan PR, maka didapatkan nilai :

max CB = 609,23

max PR = 164,61

1. Buat tablenya terlebih dahulu: Form1

Page 4: TABEL SIMPLEKS

Kodingnya codding Proses (untuk menampilkan form2 dari form1)

Private Sub PROSES_Click()

Form2.Show

End Sub

codding Ulang Private Sub ULANG_Click()CB.Text = ""PR.Text = ""CB1.Text = ""CB2.Text = ""CB3.Text = ""PR1.Text = ""PR2.Text = ""PR3.Text = ""NKEN1.Text = ""NKEN2.Text = ""NKEN3.Text = ""End Sub

codding KeluarPrivate Sub KELUAR_Click()EndEnd Sub

Form2

Page 5: TABEL SIMPLEKS

Coddingnya Codding Proses

Private Sub cmdproses_Click()

ZZ.Text = 1

ZS1.Text = 0

ZS2.Text = 0

ZS3.Text = 0

Form2.X1Z.Text = Form1.CB * -1

Form2.X1S1.Text = Form1.CB1

Form2.X1S2.Text = Form1.CB2

Form2.X1S3.Text = Form1.CB3

Form2.X2Z.Text = Form1.PR * -1

Form2.X2S1.Text = Form1.PR1

Form2.X2S2.Text = Form1.PR2

Form2.X2S3.Text = Form1.PR3

S1Z.Text = 0

S1S1.Text = 1

S1S2.Text = 0

S1S3.Text = 0

S2Z.Text = 0

S2S1.Text = 0

S2S2.Text = 1

S2S3.Text = 0

S3Z.Text = 0

S3S1.Text = 0

S3S2.Text = 0

Page 6: TABEL SIMPLEKS

S3S3.Text = 1

NKZ.Text = 0

Form2.NK1 = Form1.NKEN1

Form2.NK2 = Form1.NKEN2

Form2.NK3 = Form1.NKEN3

End Sub

Codding Iterasi

Private Sub cmditerasi_Click()

If Int(X1Z) < Int(X2Z) Then

KK1 = X1Z

KK2 = X1S1

KK3 = X1S2

KK4 = X1S3

lblX1.Caption = "CB"

VGANTI_BP = "CB"

Else

KK1 = X2Z

KK2 = X2S1

KK3 = X2S2

KK4 = X2S3

Label22.Caption = "PR"

VGANTI_BP = "PR"

End If

If KK2 = 0 Then

Page 7: TABEL SIMPLEKS

A = 0

Else

A = NK1 / KK2

If KK3 = 0 Then

B = 0

Else

B = NK2 / KK3

If KK4 = 0 Then

C = 0

Else

C = NK3 / KK4

End If

End If

End If

If A < B And B < C And A < C Then

x = A

F = KK2

P = ZS1 / F

Q = X1S1 / F

R = X2S1 / F

S = S1S1 / F

T = S2S1 / F

U = S3S1 / F

V = NK1 / F

Page 8: TABEL SIMPLEKS

ZZ.Text = ZZ - (KK1 * P)

X1Z.Text = X1Z - (KK1 * Q)

X2Z.Text = X2Z - (KK1 * R)

S1Z.Text = S1Z - (KK1 * S)

S2Z.Text = S2Z - (KK1 * T)

S3Z.Text = S3Z - (KK1 * U)

NKZ.Text = NKZ - (KK1 * V)

ZS2.Text = ZZ - (KK3 * P)

X1S2.Text = X1S2 - (KK3 * Q)

X2S2.Text = X2S2 - (KK3 * R)

S1S2.Text = S1S2 - (KK3 * S)

S2S2.Text = S2S2 - (KK3 * T)

S3S2.Text = S3S2 - (KK3 * U)

NK2.Text = NK2 - (KK3 * V)

ZS3.Text = ZS3 - (KK4 * P)

X1S3.Text = X1S3 - (KK4 * Q)

X2S3.Text = X2S3 - (KK4 * R)

S1S3.Text = S1S3 - (KK4 * S)

S2S3.Text = S2S3 - (KK4 * T)

S3S3.Text = S3S3 - (KK4 * U)

NK3.Text = NK3 - (KK4 * V)

ZS1.Text = P

X1S1.Text = Q

X2S1.Text = R

Page 9: TABEL SIMPLEKS

S1S1.Text = S

S2S1.Text = T

S3S1.Text = U

NK1.Text = V

Label17.Caption = VGANTI_BP

ElseIf A < B And B > C And A > C Then

x = C

F = KK4

P = ZS3 / F

Q = X1S3 / F

R = X2S3 / F

S = S1S3 / F

T = S2S3 / F

U = S3S3 / F

V = NK3 / F

ZZ.Text = ZZ - (KK1 * P)

X1Z.Text = X1Z - (KK1 * Q)

X2Z.Text = X2Z - (KK1 * R)

S1Z.Text = S1Z - (KK1 * S)

S2Z.Text = S2Z - (KK1 * T)

S3Z.Text = S3Z - (KK1 * U)

NKZ.Text = NKZ - (KK1 * V)

ZS1.Text = ZS1 - (KK2 * P)

X1S1.Text = X1S1 - (KK2 * Q)

Page 10: TABEL SIMPLEKS

X2S1.Text = X2S1 - (KK2 * R)

S1S1.Text = S1S1 - (KK2 * S)

S2S1.Text = S2S1 - (KK2 * T)

S3S1.Text = S3S1 - (KK2 * U)

NK1.Text = NK1 - (KK2 * V)

ZS2.Text = ZZ - (KK3 * P)

X1S2.Text = X1S2 - (KK3 * Q)

X2S2.Text = X2S2 - (KK3 * R)

S1S2.Text = S1S2 - (KK3 * S)

S2S2.Text = S2S2 - (KK3 * T)

S3S2.Text = S3S2 - (KK3 * U)

NK2.Text = NK2 - (KK3 * V)

ZS3.Text = P

X1S3.Text = Q

X2S3.Text = R

S1S3.Text = S

S2S3.Text = T

S3S3.Text = U

NK3.Text = V

Label19.Caption = "CB"

ElseIf A < B And B > C And A < C Then

x = A

F = KK2

P = ZS1 / F

Q = X1S1 / F

R = X2S1 / F

Page 11: TABEL SIMPLEKS

S = S1S1 / F

T = S2S1 / F

U = S3S1 / F

V = NK1 / F

ZZ.Text = ZZ - (KK1 * P)

X1Z.Text = X1Z - (KK1 * Q)

X2Z.Text = X2Z - (KK1 * R)

S1Z.Text = S1Z - (KK1 * S)

S2Z.Text = S2Z - (KK1 * T)

S3Z.Text = S3Z - (KK1 * U)

NKZ.Text = NKZ - (KK1 * V)

ZS2.Text = ZZ - (KK3 * P)

X1S2.Text = X1S2 - (KK3 * Q)

X2S2.Text = X2S2 - (KK3 * R)

S1S2.Text = S1S2 - (KK3 * S)

S2S2.Text = S2S2 - (KK3 * T)

S3S2.Text = S3S2 - (KK3 * U)

NK2.Text = NK2 - (KK3 * V)

ZS3.Text = ZS3 - (KK4 * P)

X1S3.Text = X1S3 - (KK4 * Q)

X2S3.Text = X2S3 - (KK4 * R)

S1S3.Text = S1S3 - (KK4 * S)

S2S3.Text = S2S3 - (KK4 * T)

S3S3.Text = S3S3 - (KK4 * U)

NK3.Text = NK3 - (KK4 * V)

ZS1.Text = P

Page 12: TABEL SIMPLEKS

X1S1.Text = Q

X2S1.Text = R

S1S1.Text = S

S2S1.Text = T

S3S1.Text = U

NK1.Text = V

Label17.Caption = VGANTI_BP

ElseIf A < B And B = C And A < C Then

x = A

F = KK2

P = ZS1 / F

Q = X1S1 / F

R = X2S1 / F

S = S1S1 / F

T = S2S1 / F

U = S3S1 / F

V = NK1 / F

ZZ.Text = ZZ - (KK1 * P)

X1Z.Text = X1Z - (KK1 * Q)

X2Z.Text = X2Z - (KK1 * R)

S1Z.Text = S1Z - (KK1 * S)

S2Z.Text = S2Z - (KK1 * T)

S3Z.Text = S3Z - (KK1 * U)

NKZ.Text = NKZ - (KK1 * V)

ZS2.Text = ZZ - (KK3 * P)

Page 13: TABEL SIMPLEKS

X1S2.Text = X1S2 - (KK3 * Q)

X2S2.Text = X2S2 - (KK3 * R)

S1S2.Text = S1S2 - (KK3 * S)

S2S2.Text = S2S2 - (KK3 * T)

S3S2.Text = S3S2 - (KK3 * U)

NK2.Text = NK2 - (KK3 * V)

ZS3.Text = ZS3 - (KK4 * P)

X1S3.Text = X1S3 - (KK4 * Q)

X2S3.Text = X2S3 - (KK4 * R)

S1S3.Text = S1S3 - (KK4 * S)

S2S3.Text = S2S3 - (KK4 * T)

S3S3.Text = S3S3 - (KK4 * U)

NK3.Text = NK3 - (KK4 * V)

ZS1.Text = P

X1S1.Text = Q

X2S1.Text = R

S1S1.Text = S

S2S1.Text = T

S3S1.Text = U

NK1.Text = V

Label17.Caption = VGANTI_BP

ElseIf A > B And B < C And A > C Then

x = B

Page 14: TABEL SIMPLEKS

F = KK3

P = ZS2 / F

Q = X1S2 / F

R = X2S2 / F

S = S1S2 / F

T = S2S2 / F

U = S3S2 / F

V = NK2 / F

ZZ.Text = ZZ - (KK1 * P)

X1Z.Text = X1Z - (KK1 * Q)

X2Z.Text = X2Z - (KK1 * R)

S1Z.Text = S1Z - (KK1 * S)

S2Z.Text = S2Z - (KK1 * T)

S3Z.Text = S3Z - (KK1 * U)

NKZ.Text = NKZ - (KK1 * V)

ZS1.Text = ZS1 - (KK2 * P)

X1S1.Text = X1S1 - (KK2 * Q)

X2S1.Text = X2S1 - (KK2 * R)

S1S1.Text = S1S1 - (KK2 * S)

S2S1.Text = S2S1 - (KK2 * T)

S3S1.Text = S3S1 - (KK2 * U)

NK1.Text = NK1 - (KK2 * V)

ZS3.Text = ZS3 - (KK4 * P)

X1S3.Text = X1S3 - (KK4 * Q)

X2S3.Text = X2S3 - (KK4 * R)

Page 15: TABEL SIMPLEKS

S1S3.Text = S1S3 - (KK4 * S)

S2S3.Text = S2S3 - (KK4 * T)

S3S3.Text = S3S3 - (KK4 * U)

NK3.Text = NK3 - (KK4 * V)

ZS2.Text = P

X1S2.Text = Q

X2S2.Text = R

S1S2.Text = S

S2S2.Text = T

S3S2.Text = U

NK2.Text = V

Label18.Caption = VGANTI_BP

ElseIf A > B And B < C And A < C Then

x = B

F = KK3

P = ZS2 / F

Q = X1S2 / F

R = X2S2 / F

S = S1S2 / F

T = S2S2 / F

U = S3S2 / F

V = NK2 / F

ZZ.Text = ZZ - (KK1 * P)

X1Z.Text = X1Z - (KK1 * Q)

X2Z.Text = X2Z - (KK1 * R)

Page 16: TABEL SIMPLEKS

S1Z.Text = S1Z - (KK1 * S)

S2Z.Text = S2Z - (KK1 * T)

S3Z.Text = S3Z - (KK1 * U)

NKZ.Text = NKZ - (KK1 * V)

ZS1.Text = ZS1 - (KK2 * P)

X1S1.Text = X1S1 - (KK2 * Q)

X2S1.Text = X2S1 - (KK2 * R)

S1S1.Text = S1S1 - (KK2 * S)

S2S1.Text = S2S1 - (KK2 * T)

S3S1.Text = S3S1 - (KK2 * U)

NK1.Text = NK1 - (KK2 * V)

ZS3.Text = ZS3 - (KK4 * P)

X1S3.Text = X1S3 - (KK4 * Q)

X2S3.Text = X2S3 - (KK4 * R)

S1S3.Text = S1S3 - (KK4 * S)

S2S3.Text = S2S3 - (KK4 * T)

S3S3.Text = S3S3 - (KK4 * U)

NK3.Text = NK3 - (KK4 * V)

ZS2.Text = P

X1S2.Text = Q

X2S2.Text = R

S1S2.Text = S

S2S2.Text = T

S3S2.Text = U

NK2.Text = V

Label18.Caption = VGANTI_BP

Page 17: TABEL SIMPLEKS

ElseIf A > B And B < C And A = C Then

x = B

F = KK3

P = ZS2 / F

Q = X1S2 / F

R = X2S2 / F

S = S1S2 / F

T = S2S2 / F

U = S3S2 / F

V = NK2 / F

ZZ.Text = ZZ - (KK1 * P)

X1Z.Text = X1Z - (KK1 * Q)

X2Z.Text = X2Z - (KK1 * R)

S1Z.Text = S1Z - (KK1 * S)

S2Z.Text = S2Z - (KK1 * T)

S3Z.Text = S3Z - (KK1 * U)

NKZ.Text = NKZ - (KK1 * V)

ZS1.Text = ZS1 - (KK2 * P)

X1S1.Text = X1S1 - (KK2 * Q)

X2S1.Text = X2S1 - (KK2 * R)

S1S1.Text = S1S1 - (KK2 * S)

S2S1.Text = S2S1 - (KK2 * T)

S3S1.Text = S3S1 - (KK2 * U)

NK1.Text = NK1 - (KK2 * V)

ZS3.Text = ZS3 - (KK4 * P)

Page 18: TABEL SIMPLEKS

X1S3.Text = X1S3 - (KK4 * Q)

X2S3.Text = X2S3 - (KK4 * R)

S1S3.Text = S1S3 - (KK4 * S)

S2S3.Text = S2S3 - (KK4 * T)

S3S3.Text = S3S3 - (KK4 * U)

NK3.Text = NK3 - (KK4 * V)

ZS2.Text = P

X1S2.Text = Q

X2S2.Text = R

S1S2.Text = S

S2S2.Text = T

S3S2.Text = U

NK2.Text = V

Label18.Caption = VGANTI_BP

ElseIf A > B And B > C And A > C Then

x = C

F = KK4

P = ZS3 / F

Q = X1S3 / F

R = X2S3 / F

S = S1S3 / F

T = S2S3 / F

U = S3S3 / F

V = NK3 / F

ZZ.Text = ZZ - (KK1 * P)

X1Z.Text = X1Z - (KK1 * Q)

Page 19: TABEL SIMPLEKS

X2Z.Text = X2Z - (KK1 * R)

S1Z.Text = S1Z - (KK1 * S)

S2Z.Text = S2Z - (KK1 * T)

S3Z.Text = S3Z - (KK1 * U)

NKZ.Text = NKZ - (KK1 * V)

ZS1.Text = ZS1 - (KK2 * P)

X1S1.Text = X1S1 - (KK2 * Q)

X2S1.Text = X2S1 - (KK2 * R)

S1S1.Text = S1S1 - (KK2 * S)

S2S1.Text = S2S1 - (KK2 * T)

S3S1.Text = S3S1 - (KK2 * U)

NK1.Text = NK1 - (KK2 * V)

ZS2.Text = ZZ - (KK3 * P)

X1S2.Text = X1S2 - (KK3 * Q)

X2S2.Text = X2S2 - (KK3 * R)

S1S2.Text = S1S2 - (KK3 * S)

S2S2.Text = S2S2 - (KK3 * T)

S3S2.Text = S3S2 - (KK3 * U)

NK2.Text = NK2 - (KK3 * V)

ZS3.Text = P

X1S3.Text = Q

X2S3.Text = R

S1S3.Text = S

S2S3.Text = T

S3S3.Text = U

NK3.Text = V

Page 20: TABEL SIMPLEKS

Label19.Caption = VGANTI_BP

Else

If A = B And B > C And A > C Then

x = C

F = KK4

P = ZS3 / F

Q = X1S3 / F

R = X2S3 / F

S = S1S3 / F

T = S2S3 / F

U = S3S3 / F

V = NK3 / F

ZZ.Text = ZZ - (KK1 * P)

X1Z.Text = X1Z - (KK1 * Q)

X2Z.Text = X2Z - (KK1 * R)

S1Z.Text = S1Z - (KK1 * S)

S2Z.Text = S2Z - (KK1 * T)

S3Z.Text = S3Z - (KK1 * U)

NKZ.Text = NKZS1.Text = ZS1 - (KK2 * P)

X1S1.Text = X1S1 - (KK2 * Q)

X2S1.Text = X2S1 - (KK2 * R)

S1S1.Text = S1S1 - (KK2 * S)

S2S1.Text = S2S1 - (KK2 * T)

S3S1.Text = S3S1 - (KK2 * U)

NK1.Text = NK1 - (KK2 * V)

ZS2.Text = ZZ - (KK3 * P)

Page 21: TABEL SIMPLEKS

X1S2.Text = X1S2 - (KK3 * Q)

X2S2.Text = X2S2 - (KK3 * R)

S1S2.Text = S1S2 - (KK3 * S)

S2S2.Text = S2S2 - (KK3 * T)

S3S2.Text = S3S2 - (KK3 * U)

NK2.Text = NK2 - (KK3 * V)

ZS3.Text = P

X1S3.Text = Q

X2S3.Text = R

S1S3.Text = S

S2S3.Text = T

S3S3.Text = U

NK3.Text = V

Label19.Caption = VGANTI_BP

If Label17.Caption = "CB" Then

Text8.Text = NK1

ElseIf Label18.Caption = "CB" Then

Text8.Text = NK2

ElseIf Label19.Caption = "CB" Then

Text8.Text = NK3

ElseIf Label17.Caption = "PR" Then

Text9.Text = NK1

ElseIf Label18.Caption = "PR" Then

Text9.Text = NK2

ElseIf Label19.Caption = "PR" Then

Text9.Text = NK3

Page 22: TABEL SIMPLEKS

End If

End If

End If

End Sub

Codding KeluarPrivate Sub KELUAR_Click()EndEnd Sub