Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. set products := { "prod1" , "prod2" , "prod3" , "prod4" , "prod5" , "prod6" , "prod7" };
  2. set months := {1, 2, 3, 4, 5, 6};
  3. set months_zero := {0, 1, 2, 3, 4, 5, 6};
  4. set tools := { "szlifierka", "wiertarka_pion", "wiertarka_poziom", "swider", "strugarka" };
  5. param profit[products] := <"prod1"> 10, <"prod2"> 6, <"prod3"> 8, <"prod4"> 4, <"prod5"> 11, <"prod6"> 9, <"prod7"> 3;
  6.  
  7. param time_needed[tools * products] :=
  8. |"prod1", "prod2", "prod3", "prod4", "prod5", "prod6", "prod7"|
  9. |"szlifierka" | 0.5 , 0.7 , 0 , 0 , 0.3 , 0.2 , 0.5 |
  10. |"wiertarka_pion" | 0.1 , 0.2 , 0 , 0.3 , 0 , 0.6 , 0 |
  11. |"wiertarka_poziom" | 0.2 , 0 , 0.8 , 0 , 0 , 0 , 0.6 |
  12. |"swider" | 0.05 , 0.03 , 0 , 0.07 , 0.1 , 0 , 0.08 |
  13. |"strugarka" | 0 , 0 , 0.01 , 0 , 0.05 , 0 , 0.05 |;
  14.  
  15. param machine_available_hour[tools * months] :=
  16. | 1 , 2 , 3 , 4 , 5 , 6 |
  17. |"szlifierka" | 1152 , 1536 , 1536 , 1536 , 1152 , 1536 |
  18. |"wiertarka_pion" | 768 , 768 , 768 , 384 , 384 , 768 |
  19. |"wiertarka_poziom" | 1152 , 384 , 1152 , 1152 , 1152 , 768 |
  20. |"swider" | 384 , 384 , 0 , 384 , 384 , 384 |
  21. |"strugarka" | 384 , 384 , 384 , 384 , 384 , 0 |;
  22.  
  23.  
  24. param sales[months * products] :=
  25. | "prod1" , "prod2" , "prod3" , "prod4" , "prod5" , "prod6" , "prod7" |
  26. | 1 | 500 , 1000 , 300 , 300 , 800 , 200 , 100 |
  27. | 2 | 600 , 500 , 200 , 0 , 400 , 300 , 150 |
  28. | 3 | 300 , 600 , 0 , 0 , 500 , 400 , 100 |
  29. | 4 | 200 , 300 , 400 , 500 , 200 , 0 , 100 |
  30. | 5 | 0 , 100 , 500 , 100 , 1000 , 300 , 0 |
  31. | 6 | 500 , 500 , 100 , 300 , 1100 , 500 , 60 |;
  32.  
  33.  
  34. #sprzedaz
  35. var sold[products * months] >= 0;
  36. #produkcja
  37. var production[products * months] integer >= 0;
  38. #magazyn
  39. var magazine[products * months_zero] >= 0;
  40.  
  41.  
  42. maximize earnings:
  43. sum<a, b> in products * months: (sold[a, b] * profit[a] - magazine[a, b] * 0.5);
  44.  
  45.  
  46. subto products_in_magazine:
  47. forall<a, b> in products * months: magazine[a, b] <= 100;
  48.  
  49. subto products_in_magazine_0:
  50. forall<a> in products: magazine[a, 0] == 0;
  51.  
  52. subto products_in_magazine_6:
  53. forall<a> in products: magazine[a, 6] == 50;
  54.  
  55. subto products_in_magazine_months:
  56. forall<a, b> in products * months: magazine[a, b] == production[a, b] - sold[a, b] + magazine[a, b-1];
  57.  
  58. subto average_machine:
  59. forall <a, b> in tools * months:
  60. sum<c> in products: time_needed[a, c] * production[c, b] <= machine_available_hour[a, b];
  61.  
  62. subto sold_all:
  63. forall<a, b> in products * months: sold[a, b] <= sales[b, a];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement