Advertisement
Guest User

Test Model

a guest
Nov 24th, 2018
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.62 KB | None | 0 0
  1. GreenLogProb=optimproblem('ObjectiveSense','minimize');
  2.  
  3.  
  4. q=optimvar('q',15,11, 'LowerBound',0);
  5. v=optimvar('v', 11,4,'LowerBound',0);
  6. w=optimvar('w', 11,4,'LowerBound',0);
  7. z=optimvar('z', 11,3,'LowerBound',0);
  8. u=optimvar('u', 8,15,'LowerBound',0); %Remove
  9. y=optimvar('y',11, 'Type','integer','LowerBound',0,'UpperBound',1);
  10. x=optimvar('x',8, 'Type','integer','LowerBound',0,'UpperBound',1); %remove
  11.  
  12.  
  13. n= 1:3 %incineradors
  14. j= 1:15 %clientes
  15. k=1:11 %centros de recolección
  16. l=1:4 %metal
  17. m=1:4 %plastico
  18. i=1:8 %plantas
  19.  
  20. %Costo de transporte del cliente j al centro de recoleccion k [Rials]
  21. a = [54 66 36 24 84 78 75 126 114 69 78
  22. 48 52.8 54 60 46.8 66 60 108 21 60 30
  23. 66 66 90 96 36 66 66 102 21 66 42
  24. 69 51 99 105 46.8 42 45 0 90 52.8 78
  25. 75 48 84 93 49.2 42 45 18 87 52.8 84
  26. 18 12 30 36 21 12 12 36 48 9 27
  27. 72 51 84 90 24 30 33 36 39 36 72
  28. 6 4.8 21 27 18 12 10.8 48 33 6 10.8
  29. 15 9 33 39 12 0 3 36 45 6 21
  30. 21 12 36 42 9 13.2 12 45 34.8 21 18
  31. 9 3 24 30 12 7.2 6 42 40.8 3 16.8
  32. 18 18 45 48 18 66 60 78 1.2 51 15
  33. 3 7.2 15 21 18 17.4 15.6 54 27 9 10.8
  34. 150 132 180 186 126 120 123 102 150 126 156
  35. 210 192 240 246 198 168 171 66 240 174 222]
  36.  
  37. %Costo de transporte del c.r. k al centro de reciclaje de metales [Rials]
  38. b(k,l) =[2.5 8 3 2.5
  39. 2.5 8.8 3 1.5
  40. 6.5 9 7.5 5.2
  41. 7 10 8 6.2
  42. 2.5 7.8 3 2.2
  43. 10 11 11 0.2
  44. 9.5 10 10 0.5
  45. 12 18 13 6.2
  46. 1.8 3.5 0.2 7.5
  47. 8 10 8.5 1
  48. 2 5 2.5 3.5]
  49.  
  50. %Costo de transporte del c.r k al centro de reciclaje de plástico m [Rials]
  51. h(k,m) =[1 6 2 18
  52. 2.4 8 2.4 22
  53. 5 8 5 12
  54. 7 8 7 8
  55. 6 13 3 28
  56. 5.8 11 5 26
  57. 5.2 10 5 25
  58. 18 14 20 42
  59. 9 13 7 38
  60. 3 3 9 23
  61. 3.6 8 1 26]
  62.  
  63. o(k,n) = [3.9 1.5 4.5
  64. 0 3.6 1.5
  65. 10.8 7.5 12
  66. 13.5 10.5 15
  67. 6 9 6
  68. 5.4 8.7 3.6
  69. 5.4 7.8 3
  70. 23.4 27 21
  71. 18.6 13.5 20.4
  72. 1.5 4.5 1.5
  73. 5.4 5.4 8.4]%costo de transporte del centro de recoleccion k al centro de incineración n
  74. copen(k)=[17400 17900 17400 17200 18300 18100 17800 18000 17500 17900 17700]
  75.  
  76.  
  77. prosm(m,1)= [5 3 3.5 4.5]
  78. prosl(l,1)= [1 1 0.8 1.1]
  79. prosn(n,1)=[0.5 0.8 0.5]
  80. capn(n,1)=[4300 3550 4400]
  81. capl(l,1)=[2850 4450 8450 3000]
  82. capm(m,1)=[3450 2850 3550 6450]
  83.  
  84. ejk(j,k)=[1.44 1.76 0.96 0.64 2.24 2.08 2 3.36 3.04 1.84 2.08
  85. 1.28 1.408 1.44 1.6 1.248 1.76 1.6 2.88 0.56 1.6 0.8
  86. 1.76 1.76 2.4 2.56 0.96 1.76 1.76 2.72 0.56 1.76 1.12
  87. 1.84 1.36 2.64 2.8 1.248 1.12 1.2 0.12 2.4 1.408 2.08
  88. 2 1.28 2.24 2.48 1.312 1.12 1.2 0.48 2.32 1.408 2.24
  89. 0.48 0.32 0.8 0.96 0.56 0.32 0.32 0.96 1.28 0.24 0.72
  90. 1.92 1.36 2.24 2.4 0.64 0.8 0.88 0.96 1.04 0.96 1.92
  91. 0.16 0.128 0.56 0.72 0.48 0.32 0.288 1.28 0.88 0.16 0.288
  92. 0.4 0.24 0.88 1.04 0.32 0.02 0.08 0.96 1.2 0.16 0.56
  93. 0.56 0.32 0.96 1.12 0.24 0.352 0.32 1.2 0.928 0.56 0.48
  94. 0.24 0.08 0.64 0.8 0.32 0.192 0.16 1.12 1.088 0.08 0.448
  95. 0.48 0.48 1.2 1.28 0.48 1.76 1.6 2.08 0.032 1.36 0.4
  96. 0.08 0.192 0.4 0.56 0.48 0.464 0.416 1.44 0.72 0.24 0.288
  97. 4 3.52 4.8 4.96 3.36 3.2 3.28 2.72 4 3.36 4.16
  98. 5.6 5.12 6.4 6.56 5.28 4.48 4.56 1.76 6.4 4.64 5.92]%Data of environmental impact of shipping a unit of used product from customer zone j to collection center k and processing it at collection center k (i.e., ), ( = 0.012 millipoints) - (millipoints)
  99.  
  100. ekl(k,l)= [0.0051 0.0271 0.0071 0.0051
  101. 0.0051 0.0303 0.0071 0.0011
  102. 0.0211 0.0311 0.0251 0.0159
  103. 0.0231 0.0351 0.0271 0.0199
  104. 0.0051 0.0263 0.0071 0.0039
  105. 0.0351 0.0391 0.0391 -0.0041
  106. 0.0331 0.0351 0.0351 -0.0029
  107. 0.0431 0.0671 0.0471 0.0199
  108. 0.0023 0.0091 -0.0041 0.0251
  109. 0.0271 0.0351 0.0291 -0.0009
  110. 0.0031 0.0151 0.0051 0.0091]
  111.  
  112. ekm(k,m)=[-1.62 -1.52 -1.6 -1.28
  113. -1.592 -1.48 -1.592 -1.2
  114. -1.54 -1.48 -1.54 -1.4
  115. -1.5 -1.48 -1.5 -1.48
  116. -1.52 -1.38 -1.58 -1.08
  117. -1.524 -1.42 -1.54 -1.12
  118. -1.536 -1.44 -1.54 -1.14
  119. -1.28 -1.36 -1.24 -0.8
  120. -1.46 -1.38 -1.5 -0.88
  121. -1.58 -1.58 -1.46 -1.18
  122. -1.568 -1.48 -1.62 -1.12]
  123. ekn(k,n)=[0.1518 0.0238 0.1838
  124. -0.0562 0.1358 0.0238
  125. 0.5198 0.3438 0.5838
  126. 0.6638 0.5038 0.7438
  127. 0.2638 0.4238 0.2638
  128. 0.2318 0.4078 0.1358
  129. 0.2318 0.3598 0.1038
  130. 1.1918 1.3838 1.0638
  131. 0.9358 0.6638 1.0318
  132. 0.0238 0.1838 0.0238
  133. 0.2318 0.2318 0.3918]
  134.  
  135. c(i,j) =[90 75 110 115 125 30 120 10 25 35 15 35 5 250 350
  136. 110 88 110 85 80 20 85 8 15 20 5 30 12 220 320
  137. 60 90 150 165 140 50 140 35 55 60 40 75 25 300 400
  138. 100 60 80 125 135 40 120 18 35 30 25 28 12 260 360
  139. 140 78 60 78 82 35 40 30 20 15 20 30 30 210 330
  140. 130 110 110 70 70 20 50 20 0 20 10 100 28 200 280
  141. 115 100 110 85 85 12 60 10 10 35 0 90 18 210 290
  142. 135 75 50 65 110 55 50 25 30 25 28 38 28 200 300
  143. ] %BORRAR
  144.  
  145. demand(j)=[254.5 330.6 124 108.8 110 263.4 63.5 93 118.5 42.6 211 285 240 344 215]
  146. rreturn(j)=[0.75 0.75 0.75 0.65 0.65 0.75 0.65 0.8 0.75 0.75 0.75 0.8 0.8 0 0]
  147. caprec(k)=[2450 2450 2550 2550 2250 2350 2250 2050 2250 2150 2300]
  148.  
  149. eij(i,j)=[12.244 11.584 13.124 13.344 13.784 9.604 13.564 8.724 9.384 9.824 8.944 9.824 8.504 19.284 23.684
  150. 13.124 12.156 13.124 12.024 11.804 9.164 12.024 8.636 8.944 9.164 8.504 9.604 8.812 17.964 22.364
  151. 10.924 12.244 14.884 15.544 14.444 10.484 14.444 9.824 10.704 10.924 10.044 11.584 9.384 21.484 25.884
  152. 12.684 10.924 11.804 13.784 14.224 10.044 13.564 9.076 9.824 9.604 9.384 9.516 8.812 19.724 24.124
  153. 14.444 11.716 10.924 11.716 11.892 9.824 10.044 9.604 9.164 8.944 9.164 9.604 9.604 17.524 22.804
  154. 14.004 13.124 13.124 11.364 11.364 9.164 10.484 9.164 8.284 9.164 8.724 12.684 9.516 17.084 20.604
  155. 13.344 12.684 13.124 12.024 12.024 8.812 10.924 8.724 8.724 9.824 8.284 12.244 9.076 17.524 21.044
  156. 14.224 11.584 10.484 11.144 13.124 10.704 10.484 9.384 9.604 9.384 9.516 9.956 9.516 17.084 21.484
  157. ]
  158.  
  159. copenpro(i)=[145000 147000 148000 140000 147000 147000 148000 0]
  160. cappro(i)=[2000 2000 2100 1800 2000 2000 2000 1800]
  161. prosi(i) =[158 162 165 165 165 165 170 160]
  162.  
  163. RestDem1= sum(u)>=demand
  164. RestDem2= sum(q,2)'>=(demand.*rreturn)
  165. RestFlujo1=sum(q,1)==(sum(w,2)+sum(z,2))'
  166. RestFlujo2=sum(w,2)'==(sum(v,2))'
  167. RestCap1=sum(u,2)'<=(x.*cappro')'
  168. RestCap2=sum(q,1)<=(y.*caprec')'
  169. RestCap3=sum(v,1)<=capl'
  170. RestCap4=sum(w,1)<=capm'
  171. RestCap5=sum(z,1)<=capn'
  172.  
  173. f1=sum(copenpro*x,1)...
  174. +sum(copen*y,1)+sum(sum((c'+prosi).*u'))+sum(sum(a.*q))...
  175. +sum(sum((b'+prosl).*v'))+sum(sum((h'+prosm).*w'))+sum(sum((o'+prosn).*z'))
  176.  
  177. f2=sum(sum(eij.*u))+sum(sum(ejk.*q))+sum(sum(ekn.*z))...
  178. +sum(sum(ekl.*v))+sum(sum(ekm.*w))
  179.  
  180. GreenLogProb.Constraints.R1=RestCap1;
  181. GreenLogProb.Constraints.R2=RestCap2;
  182. GreenLogProb.Constraints.R3=RestCap3;
  183. GreenLogProb.Constraints.R4=RestCap4;
  184. GreenLogProb.Constraints.R5=RestCap5;
  185. GreenLogProb.Constraints.R6=RestDem1;
  186. GreenLogProb.Constraints.R7=RestDem2;
  187. GreenLogProb.Constraints.R8=RestFlujo1;
  188. GreenLogProb.Constraints.R9=RestFlujo2;
  189.  
  190.  
  191.  
  192. GreenLogProb.Objective=(f1);
  193.  
  194. [sol,fval,exitflag,output]=solve(GreenLogProb)
  195.  
  196. Sol1=fval
  197. GreenLogProb.Objective=(f2);
  198.  
  199. [sol,fval,exitflag,output]=solve(GreenLogProb)
  200.  
  201. Sol2=fval
  202.  
  203. Sol1
  204. Sol2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement