19
1 Aplikasi Riset Operasional Dalam MATLAB Arif Rahman, ST MT

Aplikom11 matlab or

Embed Size (px)

Citation preview

Page 1: Aplikom11 matlab or

1

Aplikasi Riset Operasional

Dalam MATLABArif Rahman, ST MT

Page 2: Aplikom11 matlab or

OptimtoolOptimization Toolbox™ Optimtool

2

Page 3: Aplikom11 matlab or

3

Linear ProgrammingVariables

Decision variablesStructural variablesAuxiliary variablesSlack variablesArtificial variables

CoefficientsCost coefficientsTechnological coefficientsConstraint parameter or Right Hand Side value

FunctionObjective or criterion functionRestriction or functional constraintsNonnegativity constraints

Page 4: Aplikom11 matlab or

4

Linear ProgrammingMinimize f(x) = c1x1 + c2x2 + … + cnxn

Subject toa11x1 + a12x2 + … + a1nxn b1

a21x1 + a22x2 + … + a2nxn b2

am1x1 + am2x2 + … + amnxn bm

andx1 0; x2 0; … ; xn 0

Maximize or Minimize

or or =

0 or 0 or unrestricted

Page 5: Aplikom11 matlab or

Linear Programming[x,fval,exitflag] = linprog(f,A,b,Aeq,beq,lb)Di mana

f Vector koefisien fungsi tujuan (cost coefficient).A Matrix koefisien fungsi kendala pertidaksamaan (technological coefficient).b Vector parameter batas fungsi kendala pertidaksamaan(right-hand side or constraint parameter).Aeq Matrix koefisien fungsi kendala persamaan (technological coefficient).beq Vector parameter batas fungsi kendala persamaan(right-hand side or constraint parameter).lb Vector batas bawahvariabel keputusanub Vector batas bawahvariabel keputusan

5

Page 6: Aplikom11 matlab or

Linear ProgrammingMinimize f(x) = –5x1 – 4x2 – 6x3

Subject to : x1 – x2 + x3 20

3.x1 + 2.x2 + 4.x3 42

3.x1 + 2.x2 30

where x1 0; x2 0; x3 0

Ketikkan perintah berikut di dalam command window: f = [-5; -4; -6]; x = 0.000 x1

A = [1 -1 1; 3 2 4; 3 2 0]; 15.000 x2

b = [20; 42; 30]; 3.000 x3

lb=zeros(3,1); fval = -78.000[x,fval,exitflag]= linprog(f,A,b,[],[],lb)

6

Page 7: Aplikom11 matlab or

7Binary Integer ProgrammingMinimize f(x) = c1x1 + c2x2 + … + cnxn

Subject toa11x1 + a12x2 + … + a1nxn b1

a21x1 + a22x2 + … + a2nxn b2

am1x1 + am2x2 + … + amnxn bm

andx1; … ; xn {0;1}

Maximize or Minimize

or or =

0 or 1

Page 8: Aplikom11 matlab or

Binary Integer Programming

x = bintprog(f,A,b)Di mana

f Vector koefisien fungsi tujuan (cost coefficient).A Matrix koefisien fungsi kendala (technological coefficient).b Vector parameter batas fungsi kendala (right-hand side or constraint parameter).

8

Page 9: Aplikom11 matlab or

Binary Integer ProgrammingMinimize f(x) = –9x1 – 5x2 – 6x3 – 4x4,

Subject to :6.x1 + 3.x2 + 5.x3 + 2.x4 9

x3 + x4 1

-x1 + x3 0

-x2 + x4 0

where x1, x2, x3, and x4 are binary integers

Ketikkan perintah berikut di dalam command window: f = [-9; -5; -6; -4]; x = 1 x1

A = [6 3 5 2; 0 0 1 1; -1 0 1 0; 0 -1 0 1]; 1 x2

b = [9; 1; 0; 0]; 0 x3

x = bintprog(f,A,b) 0 x4

9

Page 10: Aplikom11 matlab or

10

Quadratic ProgrammingMinimize f(x) = c1x1

2 + c2x22 + c3x1x2 + c4x1 + c5x2 …

Subject toa11x1 + a12x2 + … + a1nxn b1

a21x1 + a22x2 + … + a2nxn b2

am1x1 + am2x2 + … + amnxn bm

andx1 0; x2 0; … ; xn 0

Maximize or Minimize

or or =

0 or 0 or unrestricted

Page 11: Aplikom11 matlab or

Quadratic Programmingx = quadprog(H,f,A,b)Di mana

H Matrix bujursangkar simetris koefisien interaksi fungsi tujuan (cost coefficient).f Vector koefisien fungsi tujuan (cost coefficient).A Matrix koefisien fungsi kendala (technological coefficient).b Vector parameter batas fungsi kendala (right-hand side or constraint parameter).

11

Page 12: Aplikom11 matlab or

Quadratic ProgrammingMinimize f(x) = 1/2.x1

2 + x22 – x1x2 – 2.x1 – 6.x2,

Subject to : x1 + x2 2

-x1 + 2.x2 2

2.x1 + x2 3

where x1 0; x2 0

Ketikkan perintah berikut di dalam command window: H = [1 -1; -1 2];f = [-2; -6]; x = 0.6667 x1

A = [1 1; -1 2; 2 1]; 1.3333 x2

b = [2; 2; 3];x = quadprog(H, f, A, b)

12

Page 13: Aplikom11 matlab or

Goal ProgrammingMultiobjective goal attainmentA weighting vector to control the relative underattainment or overattainment of the objectives in fgoalattain.When the values of goal are all nonzero, to ensure the same percentage of under- or overattainment of the active objectives, set the weighting function to abs(goal).The active objectives are the set of objectives that are barriers to further improvement of the goals at the solution.

13

Page 14: Aplikom11 matlab or

Goal Programmingx = fgoalattain(fun,x0,goal,weight,A,b)

Di manafun function dengan vector x menghasilkan vector F, dengan objective functions dievaluasi pada vector x x0 Vector initial x.

goal Vector koefisien fungsi tujuan (cost coefficient)weight Vector pembobotan dari underattainment atau overattainment dari tujuanA Matrix koefisien fungsi kendala (technological coefficient).b Vector parameter batas fungsi kendala (right-hand side or constraint parameter).

14

Page 15: Aplikom11 matlab or

Minimax Programmingminimizes the worst-case (largest) value of a set of multivariable functions, starting at an initial estimate.

15

Page 16: Aplikom11 matlab or

Minimax Programmingx = fminimax(fun,x0,A,b)

Di manafun function dengan vector x menghasilkan vector F, dengan objective functions dievaluasi pada vector x x0 Vector initial x.

A Matrix koefisien fungsi kendala (technological coefficient).b Vector parameter batas fungsi kendala (right-hand side or constraint parameter).

16

Page 17: Aplikom11 matlab or

Minimax ProgrammingMinimax f(x) = {f1(x); f2(x); f3(x); f4(x); f5(x)}

Where :f1 (x) =2.x1

2 + x22 – 48.x1 – 40.x2 + 304

f2 (x) =-x12 – 3.x2

2

f3 (x) =x1 + 3.x2 – 18

f4 (x) =-x1 – x2

f5 (x) =x1 + x2 – 8

17

Page 18: Aplikom11 matlab or

Minimax ProgrammingKetikkan perintah berikut di dalam command window:

function f = myfun(x)f(1)= 2*x(1)^2+x(2)^2-48*x(1)-40*x(2)+304;f(2)= -x(1)^2 - 3*x(2)^2;f(3)= x(1) + 3*x(2) -18;f(4)= -x(1)- x(2);f(5)= x(1) + x(2) – 8

x0 = [0.1; 0.1];[x,fval] = fminimax(@myfun,x0)

18

Page 19: Aplikom11 matlab or

19

Akhir Perkuliahan…Akhir Perkuliahan…

… … Ada Yang DitanyakanAda Yang Ditanyakan

help optim