------------------------ # Blatt 7, Aufgabe 1 # ------------------------ # die Spaltenvektoren der Matrix A: a1 = c(1,1,0) a2 = c(2,1,3) a3 = c(1,0,0) a4 = c(0,1,0) a5 = c(0,0,1) b = c(170,150,180) # wir haben 10 Faelle, die wir der Reihe nach # durchgehen muessen: # B = {1,2,3} AB = cbind(a1,a2,a3) # "column bind" xB = solve(AB,b) xB # xB = (90,60,-40) # x = (xB,xN) = (90,60,-40,0,0) # keine Ecke # B = {1,2,4} AB = cbind(a1,a2,a4) xB = solve(AB,b) xB # xB = (50,60,40) # x = (xB,xN) = (50,60,0,40,0) # ist Ecke, E1 = c(50,60,0,40,0) # B = {1,2,5} AB = cbind(a1,a2,a5) xB = solve(AB,b) xB # xB = (130,20,120) # x = (xB,xN) = (130,20,0,0,120) # ist Ecke, E2 = c(130,20,0,0,120) # B = {1,3,4} AB = cbind(a1,a3,a4) xB = solve(AB,b) xB # -> liefert Fehlermeldung, da a1,a3 und a4 linear abhaengig, # keine Loesung fuer xB. # B = {1,3,5} AB = cbind(a1,a3,a5) xB = solve(AB,b) xB # xB = (150,20,180) # x = (xB,xN) = (150,0,20,0,180) # ist Ecke, E3 = c(150,0,20,0,180) # B = {1,4,5} AB = cbind(a1,a4,a5) xB = solve(AB,b) xB # xB = (170,-20,180) # x = (xB,xN) = (170,0,0,-20,180) # keine Ecke # B = {2,3,4} AB = cbind(a2,a3,a4) xB = solve(AB,b) xB # xB = (60,50,90) # x = (xB,xN) = (0,60,50,90,0) # ist Ecke, E4 = c(0,60,50,90,0) # B = {2,3,5} AB = cbind(a2,a3,a5) xB = solve(AB,b) xB # xB = (150,-130,-270) # x = (xB,xN) = (0,150,-130,0,-270) # keine Ecke # B = {2,4,5} AB = cbind(a2,a4,a5) xB = solve(AB,b) xB # xB = (85,65,-75) # x = (xB,xN) = (0,85,0,65,-75) # keine Ecke # B = {3,4,5} AB = cbind(a3,a4,a5) xB = solve(AB,b) xB # xB = (170,150,180) # x = (xB,xN) = (0,0,170,150,180) # ist Ecke, E5 = c(0,0,170,150,180) # Also: wir haben 5 Ecken gefunden; # wir berechnen F(E1),...,F(E5): # wir legen die Funktion f(x1,...,x5) = 300*x1+500*x2 # an (der Buchstabe F ist schon fuer "FALSE" verbraucht): f = function( E ) { result = 300*E[1] + 500*E[2] return(result) } f(E1) # 45000 f(E2) # 49000 -> Maximum f(E3) # 45000 f(E4) # 30000 f(E5) # 0 # Also: Maximum bei E2 = (130,20,0,0,120), # also x1 = x = 130, x2 = y = 20