SHARE
TWEET

Untitled

a guest Jan 21st, 2020 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clc
  2. close all
  3. clear
  4.  
  5. %zad1
  6. A=[4,6,15;2,2,0;5,3,4;7,3,12]
  7. b=[250,60,100,220]
  8. f=[2,1.5,3]
  9. lb=[0;0;0]
  10.  
  11. [x,fval]=linprog(f,-A,-b,[],[],lb,[])
  12. x=ceil(x)
  13. z=f*x
  14. y=A*x
  15. display(["koszt: ",z])
  16. display(["kanapki: ",x(1)])
  17. display(["pierogi: ",x(2)])
  18. display(["slodycze: ",x(3)])
  19. display(["bialko: ",y(1)])
  20. display(["tluszcze: ",y(2)])
  21. display(["witaminy: ",y(3)])
  22. display(["weglowodany: ",y(4)])
  23.  
  24.  
  25. %zad2
  26. A=[5,25;0.5,0;100,250;10,10]
  27. b=[500;15;7500;400]
  28. f=[100,200]
  29. lb=[0;0]
  30. [x,fval]=linprog(-f,A,b,[],[],lb,[])
  31. x=ceil(x)
  32. z=f*x
  33. y=A*x
  34. display(["krzeslo: ",x(1)])
  35. display(["stol: ",x(2)])
  36. display(["drewno: ",y(1)])
  37. display(["skora: ",y(2)])
  38. display(["klej: ",y(3)])
  39. display(["naklad: ",y(4)])
  40. display(["zysk: ",z])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top