Operatioanalyysi 2011, Harjoitus 5, viikko 41 H5t1, Exercise 5.2. H5t2, Exercise 5.3. H5t3, Exercise 5.4. H5t4, Exercise 5.5. H5t5, Exercise 6.1.
(Exercise 5.2.) 1/5 1 5.2. Consider Manuel Example s 4.0.1 optimal simplex tableau from section 4.5 and answer to the following questions (a) What are the shadow prices and reduced costs in Manuel s problem? (b) Suppose Manuel had 21 instead of 20 liters of milk. What would be Manuel s new optimal revenue? (c) Suppose Manuel had promised to sell at least one liter of Castile to José. How much will Manuel s optimal revenue decrease? (d) How much should Manuel ask for a liter of Castile so that producing it would make sense for him (assuming that the demand remains unchanged)?
(Exercise 5.2.(a)) 2/5 2 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (a) What are the shadow prices and reduced costs in Manuel s problem?
(Exercise 5.2.(a)) 2/5 2 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (a) What are the shadow prices and reduced costs in Manuel s problem? Varjohinnat luetaan nollariviltä slack-muuttujien alta:
(Exercise 5.2.(a)) 2/5 2 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (a) What are the shadow prices and reduced costs in Manuel s problem? Varjohinnat luetaan nollariviltä slack-muuttujien alta: π = (0 10 10 0)
(Exercise 5.2.(a)) 2/5 2 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (a) What are the shadow prices and reduced costs in Manuel s problem? Varjohinnat luetaan nollariviltä slack-muuttujien alta: π = (0 10 10 0) Redusoidut hinnat luetaan nollariviltä päätösmuuttujien alta:
(Exercise 5.2.(a)) 2/5 2 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (a) What are the shadow prices and reduced costs in Manuel s problem? Varjohinnat luetaan nollariviltä slack-muuttujien alta: π = (0 10 10 0) Redusoidut hinnat luetaan nollariviltä päätösmuuttujien alta: u = (0 5 0)
(Exercise 5.2.(b)) 3/5 3 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (b) Suppose Manuel had 21 instead of 20 liters of milk. What would be Manuel s new optimal revenue?
(Exercise 5.2.(b)) 3/5 3 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (b) Suppose Manuel had 21 instead of 20 liters of milk. What would be Manuel s new optimal revenue? Toinen resurssi kasvaa yhdellä b 2 = 1.
(Exercise 5.2.(b)) 3/5 3 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (b) Suppose Manuel had 21 instead of 20 liters of milk. What would be Manuel s new optimal revenue? Toinen resurssi kasvaa yhdellä b 2 = 1. Silloin z = π 2 b 2 = 10 1 = 10 ja uusi z:n arvo on 280 + 10 = 290.
(Exercise 5.2.(b)) 4/5 4 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (c) Suppose Manuel had promised to sell at least one liter of Castile to José. How much will Manuel s optimal revenue decrease?
(Exercise 5.2.(b)) 4/5 4 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (c) Suppose Manuel had promised to sell at least one liter of Castile to José. How much will Manuel s optimal revenue decrease? Nyt x 2, joka ei ole optimikannassa, saa arvon 1 ( x 2 = 1).
(Exercise 5.2.(b)) 4/5 4 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (c) Suppose Manuel had promised to sell at least one liter of Castile to José. How much will Manuel s optimal revenue decrease? Nyt x 2, joka ei ole optimikannassa, saa arvon 1 ( x 2 = 1). Tästä aiheutuu menetys z = u 2 x 2 = 5 1 = 5.
(Exercise 5.2.(b)) 5/5 5 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (d) How much should Manuel ask for a liter of Castile so that producing it would make sense for him (assuming that the demand remains unchanged)?
(Exercise 5.2.(b)) 5/5 5 opetusmonisteen sivulla 73 Row z x 1 x 2 x 3 s 1 s 2 s 3 s 4 BV RHS 1 1 0 5 0 0 10 10 0 z = 280 2 0 0 2 0 1 2 8 0 s 1 = 24 3 0 0 2 1 0 2 4 0 x 3 = 8 4 0 1 1,25 0 0 0,5 1,5 0 x 1 = 2 5 0 0 1 0 0 0 0 1 S 4 = 5 (d) How much should Manuel ask for a liter of Castile so that producing it would make sense for him (assuming that the demand remains unchanged)? Jos uusi hinta olisi redusoidun kustannuksen verran parempi, p2 uusi = p2 vanha + u 2 = 30 + 5 = 35 (e/litra), niin valmistaminen ei olisi enää tappiollista.
(Exercise 5.3.) (1/3) 6 5.3. The function simplex_lp_solver does not provide shadow prices or reduced costs as outputs. Modify the function so that it does.
(Exercise 5.3.) (1/3) 6 5.3. The function simplex_lp_solver does not provide shadow prices or reduced costs as outputs. Modify the function so that it does. Muutetaan funktion määrittely siten, että kutsuttaessa funktiota voidaan funktiokutsussa pyytää varjohinnat ja redusoidut kustannukset (tai olla pyytämättä).
(Exercise 5.3.) (1/3) 6 5.3. The function simplex_lp_solver does not provide shadow prices or reduced costs as outputs. Modify the function so that it does. Muutetaan funktion määrittely siten, että kutsuttaessa funktiota voidaan funktiokutsussa pyytää varjohinnat ja redusoidut kustannukset (tai olla pyytämättä). function [z_max, x_max, status, shadow, reduced] = simplex_lp_solver(c, A, b, maxiter=100)
Ex 5.3 (2/3) 7 Kun viimeinen simplex-taulu on todettu optimaaliseksi, luetaan vektorit shadow ja reduced viimeisen simplex-taulun riviltä 1. Funktio-rutiinin viimeiset rivit menevät muotoon:
Ex 5.3 (2/3) 7 Kun viimeinen simplex-taulu on todettu optimaaliseksi, luetaan vektorit shadow ja reduced viimeisen simplex-taulun riviltä 1. Funktio-rutiinin viimeiset rivit menevät muotoon: ## results from the last simplex tableau. status = "bounded"; z_max = T(1,columns(T)); x_max = zeros(length(c)+length(b),1); x_max(bv) = T(2:(length(b)+1),columns(T)); x_max = x\_max(1:length(c)); #------------------------------------------------------- reduced = T(1,2:length(c)+1) ; # reduced costs shadow = T(1,length(c)+2:columns(T)-1) ; # pii #------------------------------------------------------- endfunction
Ex 5.3 (3/3) 8 Testikoodi: ##esimerkki 5.1.2 (s. 80) simplex_lp_solverilla c=[4;3]; A=[2 3;-3 2;0 2;2 1]; b=[6;3;5;4]; [z,x,status,shadow,reduced]=simplex_lp_solver(c,a,b)
Ex 5.3 (3/3) 8 Testikoodi: ##esimerkki 5.1.2 (s. 80) simplex_lp_solverilla c=[4;3]; A=[2 3;-3 2;0 2;2 1]; b=[6;3;5;4]; [z,x,status,shadow,reduced]=simplex_lp_solver(c,a,b) Output: z = 9 x = 1.5000 1.0000 status = bounded shadow = 0.50000 0.00000 0.00000 1.50000 reduced = 0 0
Ex 5.3 (3/3) 8 Testikoodi: ##esimerkki 5.1.2 (s. 80) simplex_lp_solverilla c=[4;3]; A=[2 3;-3 2;0 2;2 1]; b=[6;3;5;4]; [z,x,status,shadow,reduced]=simplex_lp_solver(c,a,b) Output: z = 9 x = 1.5000 1.0000 status = bounded shadow = 0.50000 0.00000 0.00000 1.50000 reduced = 0 0 Muutama kommentti:
Ex 5.3 (3/3) 8 Testikoodi: ##esimerkki 5.1.2 (s. 80) simplex_lp_solverilla c=[4;3]; A=[2 3;-3 2;0 2;2 1]; b=[6;3;5;4]; [z,x,status,shadow,reduced]=simplex_lp_solver(c,a,b) Output: z = 9 x = 1.5000 1.0000 status = bounded shadow = 0.50000 0.00000 0.00000 1.50000 reduced = 0 0 Muutama kommentti: Optimikanta on: BV = {x 1,x 2,s 2,s 3 }.
Ex 5.3 (3/3) 8 Testikoodi: ##esimerkki 5.1.2 (s. 80) simplex_lp_solverilla c=[4;3]; A=[2 3;-3 2;0 2;2 1]; b=[6;3;5;4]; [z,x,status,shadow,reduced]=simplex_lp_solver(c,a,b) Output: z = 9 x = 1.5000 1.0000 status = bounded shadow = 0.50000 0.00000 0.00000 1.50000 reduced = 0 0 Muutama kommentti: Optimikanta on: BV = {x 1,x 2,s 2,s 3 }. Optimiratkaisu on: x = (x 1 x 2 ) = (1.5 1.0).
Ex 5.3 (3/3) 8 Testikoodi: ##esimerkki 5.1.2 (s. 80) simplex_lp_solverilla c=[4;3]; A=[2 3;-3 2;0 2;2 1]; b=[6;3;5;4]; [z,x,status,shadow,reduced]=simplex_lp_solver(c,a,b) Output: z = 9 x = 1.5000 1.0000 status = bounded shadow = 0.50000 0.00000 0.00000 1.50000 reduced = 0 0 Muutama kommentti: Optimikanta on: BV = {x 1,x 2,s 2,s 3 }. Optimiratkaisu on: x = (x 1 x 2 ) = (1.5 1.0). Vastaava kantaratkaisu on: x BV = (x 1 x 2 s 2 s 3 ) = (1.5 1.0 5.5 3.0)
(Exercise 5.4.) (1/7) 9 5.4. Find the duals for the following LPs, and solve them with your favorite method. (a) max z = 2x 1 + x 2 s.t. x 1 + x 2 1 x 1 + x 2 3 x 1 2x 2 4 x 1,x 2 0 (b) min w = y 1 y 2 s.t. 2y 1 + y 2 4 y 1 + y 2 1 y 1 + 2y 2 3 y 1,y 2 0
Ex 5.4 (a) (2/7) 10 Primaali: max z = 2x 1 + x 2 s.t. x 1 + x 2 1 x 1 + x 2 3 x 1 2x 2 4 x 1,x 2 0
Ex 5.4 (a) (2/7) 10 Primaali: max z = 2x 1 + x 2 s.t. x 1 + x 2 1 x 1 + x 2 3 x 1 2x 2 4 x 1,x 2 0 Duaali: min w = y 1 + 3y 2 + 4y 3 s.t. y 1 + y 2 + y 3 2 y 1 + y 2 2y 3 1 y 1,y 2,y 3 0
Ex 5.4 (a) (2/7) 10 Primaali: max z = 2x 1 + x 2 s.t. x 1 + x 2 1 x 1 + x 2 3 x 1 2x 2 4 x 1,x 2 0 Duaali: Ratkaistaan Primaali: min w = y 1 + 3y 2 + 4y 3 s.t. y 1 + y 2 + y 3 2 y 1 + y 2 2y 3 1 y 1,y 2,y 3 0
Ex 5.4 (a) (3/7) 11 # H4t5_4a simplex_lp_solverilla c=[2;1]; A=[-1 1; 1 1;1-2]; b=[1;3;4]; [z,x,status,shadow]=simplex_lp_solver(c,a,b) ################################# # z = 6 # x = # # 3 # 0 # # status = bounded # shadow = # # 0 # 2 # 0
Ex 5.4 (a) (4/7) 12 Saimme siis Primaalin ratkaisusta z = 6, x = ( 3 0 ), π = ( 0 2 0 ). Siis Primaalin optimi on: x 1 = 3, x 2 = 0, z = 6, ja Duaalin optimi on: y 1 = 0, y 2 = 2, y 3 = 0, w = 6.
Ex 5.4 (b) (5/7) 13 (b) Primaali: min w = y 1 y 2 s.t. 2y 1 + y 2 4 y 1 + y 2 1 y 1 + 2y 2 3 y 1,y 2 0
Ex 5.4 (b) (5/7) 13 (b) Primaali: min w = y 1 y 2 s.t. 2y 1 + y 2 4 y 1 + y 2 1 y 1 + 2y 2 3 y 1,y 2 0 Duaali: max z = 4x 1 + x 2 + 3x 3 s.t. 2x 1 + x 2 + x 3 1 x 1 + x 2 + 2x 3 1 x 1,x 2,x 3 0
Ex 5.4 (b) (5/7) 13 (b) Primaali: min w = y 1 y 2 s.t. 2y 1 + y 2 4 y 1 + y 2 1 y 1 + 2y 2 3 y 1,y 2 0 Duaali: max z = 4x 1 + x 2 + 3x 3 s.t. 2x 1 + x 2 + x 3 1 x 1 + x 2 + 2x 3 1 x 1,x 2,x 3 0 Nyt emme voi käyttää simplex_lp_solveria kummankaan ongelman ratkaisemiseen. Voimme käyttää glpk:ta, mutta katsomme malleja ensin silmällä. Aloitamme Duaalista, koska se on helpommin nähty.
Ex 5.4 (b) (6/7) 14 Duaali: max z = 4x 1 + x 2 + 3x 3 s.t. 2x 1 + x 2 + x 3 1 x 1 + x 2 + 2x 3 1 x 1,x 2,x 3 0 Koska kaikkia muuttujia koskee merkkirajoite x i 0, ei toinen LP-mallin rajoite voi olla totta. Siis: ei käypää ratkaisua. Kun malli ratkaistaan glpklla, saadaan status-koodi 213 (No primal feasible solution (LP presolver))
Ex 5.4 (b) (7/7) 15 Edellisen perusteella Primaalilla pitää olla rajoittamaton optimi. Asia varmistuu helposti seuraavasti. Jos y 1 asettaan vakioksi (vaikkapa 0:ksi) ja y 2 :lle annetaan riittävän suuri arvo, niin kaikki rajoitteet ovat tosia. Kun muuttujaa y 2 edelleen kasvatetaan, niin kaikki rajoitteet pysyvät tosina ja tavoitefunktion arvo paranee. Tätä voi jatkaa niin kauan kuin huvittaa, eli tavoitefunktion arvo saadaan miten suureksi tahansa. Primaali: min w = y 1 y 2 s.t. 2y 1 + y 2 4 y 1 + y 2 1 y 1 + 2y 2 3 y 1,y 2 0 glpk antaa status-koodin 214 (No dual feasible solution (LP presolver).)
(Exercise 5.5.) (1/7) 16 5.5. A student is deciding what to purchase from a bakery for a tasty afternoon snack after a long and tedious lecture of Operations Research. There are two choices of food: Brownies, which cost 50 cents each, and mini-cheesecakes, which cost 80 cents. The bakery is service-oriented and is happy to let the student purchase a fraction of an item if she wishes. The bakery requires 30 g chocolate to make each brownie (no chocolate is needed in the cheesecakes). 20 g of sugar are needed for each brownie and 40 g of sugar for each cheesecake. Finally, 20 g of cream cheese are needed for each brownie and 50 g for each cheesecake. Being health-conscious, the student has decided that she needs at least 60 g of chocolate in her snack, along with 100 g of sugar and 80 g of cream cheese. She wishes to optimize her purchase by finding the least expensive combination of brownies and cheesecakes that meet these requirements. (a) Model the problem as an LP, (b) find the dual of the LP, (c) interpret the dual LP economically, and finally (d) solve the dual LP (by any method you like).
(Exercise 5.5.(a)) (2/7) 17 (a) Model the problem as an LP,
(Exercise 5.5.(a)) (2/7) 17 (a) Model the problem as an LP, Päätösmuuttujat ovat x 1 = ostettavien suklaakeksien määrä (x 1 R) x 2 = ostettavien juustokakujen määrä (x 2 R)
(Exercise 5.5.(a)) (2/7) 17 (a) Model the problem as an LP, Päätösmuuttujat ovat x 1 = ostettavien suklaakeksien määrä (x 1 R) x 2 = ostettavien juustokakujen määrä (x 2 R) Tavoitefunktio ostoksen hinta, jota minimoidaan min z = 50x 1 + 80x 2 (c per ostos)
Ex 5.5. (a) (3/7) 18 Lyhyet tuoteselosteet ja eri aineosien tarpeet ovat ainesosa keksi kakku tarve suklaa 30g 0g 60g sokeri 20g 40g 100g kerma 20g 50g 80g
Ex 5.5. (a) (3/7) 18 Lyhyet tuoteselosteet ja eri aineosien tarpeet ovat ainesosa keksi kakku tarve suklaa 30g 0g 60g sokeri 20g 40g 100g kerma 20g 50g 80g LP-malli min z = 50x 1 + 80x 2 s.t. 30x 1 60 20x 1 + 40x 2 100 20x 1 + 50X 2 80 x 1,x 2 0
Ex 5.5.(b) (4/7) 19 5.5.(b) find the dual of the LP Primaali: min z = 50x 1 + 80x 2 s.t. 30x 1 60 20x 1 + 40x 2 100 20x 1 + 50x 2 80 x 1,x 2 0
Ex 5.5.(b) (4/7) 19 5.5.(b) find the dual of the LP Primaali: min z = 50x 1 + 80x 2 s.t. 30x 1 60 20x 1 + 40x 2 100 20x 1 + 50x 2 80 x 1,x 2 0 Duaali: max w = 60y 1 + 100y 2 + 80y 3 s.t. 30y 1 + 20y 2 + 20y 3 50 40y 2 + 50y 3 80 y 1,y 2,y 3 0
Ex 5.5.(c) (5/7) 20 5.5.(c) interpret the dual LP economically
Ex 5.5.(c) (5/7) 20 5.5.(c) interpret the dual LP economically Primaali: keksi kakku min z = 50x 1 + 80x 2 s.t. 30x 1 60 suklaa 20x 1 + 40x 2 100 sokeri 20x 1 + 50x 2 80 kerma x 1,x 2 0
Ex 5.5.(c) (5/7) 20 5.5.(c) interpret the dual LP economically Primaali: keksi kakku min z = 50x 1 + 80x 2 s.t. 30x 1 60 suklaa 20x 1 + 40x 2 100 sokeri 20x 1 + 50x 2 80 kerma x 1,x 2 0 Duaali: suklaa sokeri kerma max w = 60y 1 + 100y 2 + 80y 3 s.t. 30y 1 + 20y 2 + 20y 3 50 keksi 40y 2 + 50y 3 80 kakku y 1,y 2,y 3 0
Ex 5.5.(c) (6/7) 21 Ratkaiseva oivallus y 1 = suklaan yksikköhinta (c/gramma) y 2 = sokerin yksikköhinta (c/gramma) y 3 = kerman yksikköhinta (c/gramma)
Ex 5.5.(c) (6/7) 21 Ratkaiseva oivallus y 1 = suklaan yksikköhinta (c/gramma) y 2 = sokerin yksikköhinta (c/gramma) y 3 = kerman yksikköhinta (c/gramma) suklaa sokeri kerma max w = 60y 1 + 100y 2 + 80y 3 s.t. 30y 1 + 20y 2 + 20y 3 50 keksi 40y 2 + 50y 3 80 kakku y 1,y 2,y 3 0
Ex 5.5.(c) (6/7) 21 Ratkaiseva oivallus y 1 = suklaan yksikköhinta (c/gramma) y 2 = sokerin yksikköhinta (c/gramma) y 3 = kerman yksikköhinta (c/gramma) suklaa sokeri kerma max w = 60y 1 + 100y 2 + 80y 3 s.t. 30y 1 + 20y 2 + 20y 3 50 keksi 40y 2 + 50y 3 80 kakku y 1,y 2,y 3 0 Raaka-aineen tuottaja maksimoi opiskelijan dieetistä saamat tulot ehdolla, että keksien ja kakkujen tekeminen ei muutu tappiolliseksi. Raaka-aineen tuottajat haluavat maksimoida tuottojaan, tappamatta teollista tuotantokoneistoa.
Ex 5.5.(d) (7/7) 22 (d) solve the dual LP (by any method you like) c = [50 80] ; A = [30 0; 20 40; 20 50]; b = [60 100 80] ; [x1,z1,stat1,extra1] = glpk(c,a,b,[0,0],[],"lll","cc",+1) [x2,z2,stat2,extra2] = glpk(b,a,c,[0,0,0],[],"uu","ccc",-1) # outputs ---------------------------------------------------- # x1 = extra1 = x2 = extra2 = # 2.0000 { 0.33333 { # 1.5000 lambda = 2.00000 lambda = # z1 = 220 0.33333 0.00000 2.0000 # stat1 = 180 2.00000 z2 = 220 1.5000 # 0.00000 stat2 = 180 redcost = # redcosts = 0.00000 # 0 0.00000 # 0-35.00000 # } }
(Exercise 6.1.)(1/16) 23 6.1. Calculate the DEA efficiencies for all the branches in the examples (a) 6.1.2, (b) 6.1.3, (c) 6.1.4, (d) 6.1.5. (a) Calculate the DEA efficiencies for all the branches in the example 6.1.2 (pages 108 109) Konttorit: R = Reykjavík, A = Akureyri, K = Kópavogur, H = Hafnarfjörður Outputs and inputs Kont. yksit. yritys staff trans. trans. R 125 50 18 A 44 20 16 K 80 55 17 H 23 12 11
Taulukko1 Ex 6.1(a) (2/16) 24 3,5 3 2,5 2 y1 y2 x1 y1/x1 y2/x1 R 125 50 18 6,9 2,8 A 44 20 16 2,8 1,3 K 80 55 17 4,7 3,2 H 23 12 11 2,1 1,1 0 3,235 4,706 3,235 6,944 2,778 6,944 0 1,5 1 0,5 0 0 1 2 3 4 5 6 7 8
Ex 6.1(a) (3/16) 25 Kont. Outputs and inputs R 125 50 18 A 44 20 16 K 80 55 17 H 23 12 11 Matriisit X = ( 18 16 17 11 ) ( ) 125 44 80 23 Y = 50 20 55 12
Ex 6.1(a) (4/16) 26 Kont. Outputs and inputs R 125 50 18 A 44 20 16 K 80 55 17 H 23 12 11 Reikjavikin tehokkuus: max θ = 125u 1 + 50u 2 s.t. 18v = 1 125u 1 + 50u 2 18v 0 44u 1 + 20u 2 16v 0 80u 1 + 55u 2 17v 0 23u 1 + 12u 2 11v 0 u 1,u 2,v 0
Ex 6.1(a) (5/16) 27 Akureyri n tehokkuus max θ = 44u 1 + 20u 2 s.t. 16v = 1 125u 1 + 50u 2 18v 0 44u 1 + 20u 2 16v 0 80u 1 + 55u 2 17v 0 23u 1 + 12u 2 11v 0 u 1,u 2,v 0 Kópavogur in tehokkuus max θ = 80u 1 + 55u 2 s.t. 17v = 1 125u 1 + 50u 2 18v 0 44u 1 + 20u 2 16v 0 80u 1 + 55u 2 17v 0 23u 1 + 12u 2 11v 0 u 1,u 2,v 0
Ex 6.1(a) (6/16) 28 Hafnarfjörður in tehokkuus max θ = 23u 1 + 12u 2 s.t. 11v = 1 125u 1 + 50u 2 18v 0 44u 1 + 20u 2 16v 0 80u 1 + 55u 2 17v 0 23u 1 + 12u 2 11v 0 u 1,u 2,v 0
Ex 6.1(a) (7/16) 29 X = [18 16 17 11]; Y = [125 44 80 23; 50 20 55 12]; c = [0 0 0] ; ## A = [ 0 0 0; b = [1 0 0 0 0] ; ## 125 50-18; t = [0 0 0 0]; ## 44 20-16; A(2:5,1:2) = Y ; ## 80 55-17; A(2:5,3) = -X ; ## 23 12-11] A(1,:) = [0 0 0]; for d=1:4 c = [Y(:,d); 0]; A(1,:) = [0 0 X(d)]; [u,t(d)] = glpk(c,a,b,[0 0 0],[],"SUUUU","CCC",-1); endfor t ########################################## # theta = # 1.00000 0.43174 1.00000 0.36174
Ex 6.1)function-file (8/16) 30 function theta = dea(x,y) [ni,nu] = size(x); [no,nuy] = size(y); if (nu!= nuy) error("päätöksentekoyksiköitä eri määrät"); endif c = zeros(no+ni,1); # asetetaan myöhemmin A = zeros(1+nu,no+ni); A(2:(nu+1),1:no) = Y ; # ekat sarakkeet = Y A(2:(nu+1),(no+1):(no+ni)) = -X ; # loput sarakkeet = -X b = zeros(nu+1,1); # b(1) = 1; # b = [1;0;0;...] theta = zeros(nu,1); #
Ex 6.1 function-file (9/16) 31 constr="s"; for j=1:nu constr=[constr, "U"]; endfor # vars=""; for j=1:(no+ni) vars=[vars, "C"]; endfor for u = 1:nu c(1:no,1) = Y(:,u); A(1,(no+1):(no+ni)) = X(:,u) ; [x, z] = glpk(c,a,b,zeros(1,no+ni),[],constr,vars,-1); theta(u)=z; endfor endfunction
Ex 6.1 (a) (10/16) 32 ######################################################## # h5t5 (6.1) (a) 6.1.2 ######################################################## nimet = ["Reykjavik"; "Akureyri"; "Kopavogur"; "Hafnarfjordur"]; X = [18 16 17 11]; Y = [125 44 80 23; 50 20 55 12]; theta = dea(x,y); for u = 1:4 printf("%15s : %7.5f \n",nimet(u,:), theta(u)); endfor ## output ********************************** # Reykjavik : 1.00000 # Akureyri : 0.43174 # Kopavogur : 1.00000 # Hafnarfjordur : 0.36174
Ex 6.1 (b) (11/16) 33 ######################################################### # nimet = ["Reykjavik"; "Akureyri"; "Kopavogur"; "Hafnarfjordur"; # "Sellfoss"; "Hveragerdi";"Akranes";"Borgarnes"; # "Keflavik"]; # X = [1 1 1 1 1 1 1 1 1]; # Y = [6.94 2.78; 2.75 1.25; 4.71 3.24; 2.09 1.09; 1.23 2.92; # 4.43 2.23; 3.32 2.81; 3.70 2.68; 3.34 2.96] ; # theta = dea(x,y); # for u = 1:9 # printf("%15s : %7.5f \n",nimet(u,:), theta(u)); # endfor ### output ********************************** ## Reykjavik : 1.00000 ## Akranes : 0.86728 ## Akureyri : 0.43149 ## Borgarnes : 0.82716 ## Kopavogur : 1.00000 ## Keflavik : 0.91358 ## Hafnarfjordur : 0.36118 ## Sellfoss : 0.90123 ## Hveragerdi : 0.74647
Ex 6.1 (d) (12/16) 34
Ex 6.1 (c) (13/16) 35 ######################################################### # nimet = ["Reykjavik"; "Akureyri"; "Kopavogur"; "Hafnarfjordur"; # "Sellfoss"; "Hveragerdi";"Akranes";"Borgarnes"; # "Keflavik"; "Surtsey"]; # X = [1 1 1 1 1 1 1 1 1 1]; # Y = [6.94 2.78; 2.75 1.25; 4.71 3.24; 2.09 1.09; 1.23 2.92; # 4.43 2.23; 3.32 2.81; 3.70 2.68; 3.34 2.96; 1.00 6.00] ; # theta = dea(x,y); # for u = 1:10 # printf("%15s : %7.5f \n",nimet(u,:), theta(u)); # endfor ### output ********************************** ## Reykjavik : 1.00000 ## Akranes : 0.70463 ## Akureyri : 0.41894 ## Borgarnes : 0.71624 ## Kopavogur : 0.88553 ## Keflavik : 0.72921 ## Hafnarfjordur : 0.33979 ## Surtsey : 1.00000 ## Sellfoss : 0.54826 ## Hveragerdi : 0.70795
Ex 6.1 (d) (14/16) 36
Ex 6.1 (d) (15/16) 37 ######################################################### # nimet = ["Reykjavik"; "Akureyri"; "Kopavogur"; "Hafnarfjordur"; # "Sellfoss"; "Hveragerdi";"Akranes";"Borgarnes"; # "Keflavik"; "Surtsey"; "Flatey"]; # X = [1 1 1 1 1 1 1 1 1 1 1]; # Y = [6.94 2.78; 2.75 1.25; 4.71 3.24; 2.09 1.09; 1.23 2.92; # 4.43 2.23; 3.32 2.81; 3.70 2.68; 3.34 2.96; 1.00 6.00; 5 5] # theta = dea(x,y); # for u = 1:11 # printf("%15s : %7.5f \n",nimet(u,:), theta(u)); # endfor ### output ********************************** ## Reykjavik : 1.00000 ## Akranes : 0.61643 ## Akureyri : 0.41010 ## Borgarnes : 0.64487 ## Kopavogur : 0.80489 ## Keflavik : 0.63256 ## Hafnarfjordur : 0.32473 ## Surtsey : 1.00000 ## Sellfoss : 0.51640 ## Flatey : 1.00000 ## Hveragerdi : 0.68081
Ex 6.1 (d) (16/16) 38