linineq.log 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. Codemist Standard Lisp 3.54 for DEC Alpha: May 23 1994
  2. Dump file created: Mon May 23 10:39:11 1994
  3. REDUCE 3.5, 15-Oct-93 ...
  4. Memory allocation: 6023424 bytes
  5. +++ About to read file tstlib.red
  6. % Examples taken from G.B. Dantzig.
  7. lll := {x1 >= 0,
  8. x1+2x2 <= 6,
  9. x1 + x2 >= 2,
  10. x1 - x2 >= 3,
  11. x2 >= 0,
  12. -2 x1 -x2 <= z };
  13. lll := {x1>=0,
  14. x1 + 2*x2<=6,
  15. x1 + x2>=2,
  16. x1 - x2>=3,
  17. x2>=0,
  18. - 2*x1 - x2<=z}
  19. sol := linineq(lll,{x1,x2,z=min});
  20. sol := {x1=6,x2=0,z=-12}
  21. sol := linineq(lll,{x1,x2,z=min},record=t);
  22. - x2 - z
  23. sol := {{x1=6,max(-----------,x2 + 3, - x2 + 2,0), - 2*x2 + 6},
  24. 2
  25. z + 12
  26. {x2=0,0,min(--------,1)},
  27. 3
  28. {z=-12,-12,inf}}
  29. linineq({z = x1 + 2 x2 + 3 x3 + 4 x4,
  30. 4 = x1 + x2 + x3 + x4,
  31. -2 = x1 - 2 x2 + 3 x3 - 4 x4,
  32. x1>=0, x2>=0, x3>=0,x4>=0}, {z=min});
  33. {x4=0,x3=0,x2=2,x1=2,z=6}
  34. linineq({z = x1 + 2 x2 + 3 x3 + 4 x4,
  35. 4 = x1 + x2 + x3 + x4,
  36. -2 = x1 - 2 x2 + 3 x3 - 4 x4,
  37. x1>=0, x2>=0, x3>=0,x4>=0}, {z=max});
  38. {x4=2,x3=2,x2=0,x1=0,z=14}
  39. linineq({ x1 + x2 >= 1,
  40. x1 + x2 <= 2,
  41. x1 - x2 <= 1,
  42. x1 - x2 >=-1,
  43. -x2 =z } , {z=min});
  44. 3 1 - 3
  45. {x2=---,x1=---,z=------}
  46. 2 2 2
  47. linineq({ 5x1 - 4x2 + 13x3 - 2x4 + x5 = 20,
  48. x1 - x2 + 5x3 - x4 + x5 = 8,
  49. x1 + 6x2 - 7x3 + x4 + 5x5 = z,
  50. x1>=0,x2>=0,x3>=0,x4>=0,x5>=0}, {z=min});
  51. 12 4 - 60
  52. {x5=0,x4=0,x3=----,x2=---,x1=0,z=-------}
  53. 7 7 7
  54. % Examples for integer and mixed integer linear programming
  55. % (Beightler, Phillips, Wilde, pp. 142 ff)
  56. linineq({z= 3x1 + 2x2,
  57. 5x1 + 4x2 <= 23.7,
  58. x1 >= 0,
  59. x2 >= 0},
  60. {z=max},
  61. int={x1,x2});
  62. {x2=2,x1=3,z=13}
  63. linineq({z= x1 + x2,
  64. -2x1 + 5x2 <= 8,
  65. 6x1 + x2 <= 30,
  66. x1 >= 0,
  67. x2 >= 0},
  68. {z=max},
  69. int={x1,x2});
  70. {x2=3,x1=4,z=7}
  71. linineq({z=-7x1 + 106x2,
  72. -x1 + 15x2 <= 90,
  73. x1 + 2x2 <= 35,
  74. -3x1 + 4x2 <= 12,
  75. x1 >= 0,
  76. x2 >= 0},
  77. {z=max},
  78. int={x1,x2});
  79. {x2=7,x1=15,z=637}
  80. linineq({z=9x1 + 6x2 + 5x3,
  81. 2x1 + 3x2 + 7x3 <= 35/2,
  82. 4x1 + 9x3 <= 15,
  83. x1 >= 0,
  84. x2 >= 0,
  85. x3 >= 0},
  86. {z=max},
  87. int={x1});
  88. 23
  89. {x3=0,x2=----,x1=3,z=50}
  90. 6
  91. % a case where the extremum requirement cannot be resolved
  92. sol := linineq(lll,{x1,x2,z=max});
  93. sol := {}
  94. % print the selection from the intervals:
  95. on prlinineq;
  96. sol := linineq(lll,{x1,x2,z=min});
  97. variables:(x1 x2 z)
  98. - 12 <= z <= inf; minimum: z=-12
  99. 0 <= x2 <= 0; zero length interval: x2=0
  100. 6 <= x1 <= 6; zero length interval: x1=6
  101. sol := {x1=6,x2=0,z=-12}
  102. sol := linineq(lll,{x1,x2,z=max});
  103. variables:(x1 x2 z)
  104. - 12 <= z <= inf; max/min cannot be resolved
  105. sol := {}
  106. % print the full elimination process
  107. on trlinineq;
  108. sol := linineq(lll,{x1,x2,z=min});
  109. variables:(x1 x2 z)
  110. --------------------------------
  111. next variable:x1; initial system:
  112. {z>= - 2*x1 - x2,
  113. x2>=0,
  114. x1 - x2>=3,
  115. x1 + x2>=2,
  116. 6>=x1 + 2*x2,
  117. x1>=0}
  118. --------------------------------
  119. normalized and reduced:
  120. {x1>=0,
  121. - x1 - 2*x2>=-6,
  122. x1 + x2>=2,
  123. x1 - x2>=3,
  124. x2>=0,
  125. 2*x1 + x2 + z>=0}
  126. --------------------------------
  127. class 1:
  128. - x2 - z
  129. {x1>=-----------,x1>=x2 + 3,x1>= - x2 + 2,x1>=0}
  130. 2
  131. --------------------------------
  132. class 2:
  133. { - 2*x2 + 6>=x1}
  134. --------------------------------
  135. class 3:
  136. {x2>=0}
  137. --------------------------------
  138. class 4:
  139. {}
  140. --------------------------------
  141. next variable:x2; initial system:
  142. {x2>=0,
  143. - x2 - z
  144. - 2*x2 + 6>=-----------,
  145. 2
  146. - 2*x2 + 6>=x2 + 3,
  147. - 2*x2 + 6>= - x2 + 2,
  148. - 2*x2 + 6>=0}
  149. --------------------------------
  150. normalized and reduced:
  151. { - x2>=-1, - 3*x2 + z>=-12,x2>=0}
  152. --------------------------------
  153. class 1:
  154. {x2>=0}
  155. --------------------------------
  156. class 2:
  157. z + 12
  158. {-------->=x2,1>=x2}
  159. 3
  160. --------------------------------
  161. class 3:
  162. {}
  163. --------------------------------
  164. class 4:
  165. {}
  166. --------------------------------
  167. next variable:z; initial system:
  168. z + 12
  169. {-------->=0,1>=0}
  170. 3
  171. --------------------------------
  172. normalized and reduced:
  173. {0>=-1,z>=-12}
  174. --------------------------------
  175. class 1:
  176. {z>=-12}
  177. --------------------------------
  178. class 2:
  179. {}
  180. --------------------------------
  181. class 3:
  182. {}
  183. --------------------------------
  184. class 4:
  185. {0>=-1}
  186. - 12 <= z <= inf; minimum: z=-12
  187. 0 <= x2 <= 0; zero length interval: x2=0
  188. 6 <= x1 <= 6; zero length interval: x1=6
  189. sol := {x1=6,x2=0,z=-12}
  190. end;
  191. (linineq 1250 0)
  192. End of Lisp run after 1.28+0.63 seconds