linineq.tex 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. \documentstyle[12pt]{article}
  2. \begin{document}
  3. \begin{center} {\Large LINEAR INEQUALITIES} \end{center}
  4. \begin{center} Solving sets of linear inequalities and equations \\
  5. and linear/integer optimization for small problems \end{center}
  6. \begin{center} Version 2.0 May 1991\end{center}
  7. \begin{center} Herbert Melenk \\ Konrad-Zuse-Zentrum fuer
  8. Informationstechnik \\
  9. Heilbronner Str. 10 \\ D1000 Berlin 31 \\ Federal Republic of Germany \\
  10. melenk@sc.zib-berlin.de \end{center}
  11. \section{Introduction}
  12. This package solves sets of linear inequalities with real valued numerical
  13. coefficients by applying the method of Fourier and Motzkin, as described
  14. by G.B. Dantzig in his famous work {\em Linear Programming and Extensions}.
  15. As input a system of linear inequalities (algebraic expressions composed
  16. with the relational operators $<=$ and $>=$) and equations are accepted,
  17. together with an optional specification, in which sequence the variables
  18. are to be eliminated and - if there is the freedom - which variable should
  19. take an extremal value in its final interval.
  20. \section{The Algorithm}
  21. The set of input formulas is treated in the following steps:
  22. \begin{itemize}
  23. \item The variables of the system are determined (together with a general
  24. analysis); variables, which are not mentioned explicitly during the
  25. call, are placed in front of the variable list; the following steps
  26. then are controlled by the variable list.
  27. \item Each equation (if any) is used to substitute one variable in the whole
  28. system; if here an inconsistency occurs, the procedure is stopped with
  29. an error message.
  30. \item The remaining variables then are eliminated from the system of
  31. inequalities one after the other by the technique of Fourier/Motzkin:
  32. a system for the variables ${x_1,\ldots ,x_n}$ is reordered in the form
  33. \[\begin{array}{cc}
  34. L_1(x_2,\ldots ,x_n) \ge x_1 & \\
  35. \ldots & \\
  36. L_k(x_2,\ldots ,x_n) \ge x_1 & \\
  37. & x_1 \ge R_1(x_2,\ldots ,x_n) \\
  38. & \ldots \\
  39. & x_1 \ge R_m(x_2,\ldots ,x_n)
  40. \end{array}\]
  41. and a new system in ${x_2,\ldots ,x_n}$
  42. \[\begin{array}{c}
  43. L_1 \ge R_1, \ldots , L_1 \ge R_m, \\
  44. \ldots \\
  45. L_k \ge R_1, \ldots , L_k \ge R_m \\
  46. \end{array}
  47. \]
  48. is established and processed in a recursive manner.
  49. \item When the last variable is encountered, the Li and Ri are numbers
  50. and they establish an interval; if that interval is not empty, an
  51. appropriate value for xn can be selected;
  52. \item During returning from the recursion, the values found already are
  53. substituted into the local Li and Ri, making them numerical values
  54. too and allowing a selection in a non empty interval;
  55. \item Finally the remaining variables are computed from substitutions
  56. into the equations.
  57. \end{itemize}
  58. This procedure is generally valid; its limitation lies in the fact, that
  59. the number of inequalities grows with each elimination step, if a variable
  60. occurs with both signs several times. In order to limit this effect as
  61. much as possible, numerical limits are collected as early as possible (by
  62. taking the min resp. max value) and the inequalities are converted into a
  63. canonical form (which actually is {\em homogeneous integer polynomial} $\ge$
  64. {\em number}), such that multiplicities can be determined and eliminated.
  65. The internal operation is based completely on REDUCE standard quotients and
  66. standard forms.
  67. If some or all variables are restricted to integer values, the
  68. branch-and-bound method is used as a macro algorithm:
  69. \begin{itemize}
  70. \item First a solution of the system is determined without integer
  71. restriction.
  72. \item If the solution contains non integer values $x_0$ for an integer
  73. variable $x$, new subproblems are generated with the additional
  74. restrictions $x<=[x_0]$ resp. $x>=[x_0]+1$, where $[]$ denotes the next
  75. integer below (floor value). With more than one integer variable this
  76. leads to a tree of subproblems.
  77. \item Among all feasable solutions the best one is selected.
  78. \end{itemize}
  79. \section{Algebraic Interface}
  80. When the package is loaded, the operators $>=$ and $<=$ are declared as
  81. operators, such that they can be used in algebraic expressions. The
  82. operator for the solution of a linear system is:
  83. \begin{center}
  84. {\tt LININEQ($<$sys$>$ [,$<$vars$>$] [,RECORD=T] [,INT=$<$ivars$>$])}
  85. \end{center}
  86. \noindent
  87. where $<$sys$>$ is the list of equations/inequalities either as explicit
  88. list or as a value which evaluates to such a list, $<$vars$>$ (optional)
  89. is a list of variables and/or expressions of the type $<$var$>$ $=$ min or
  90. $<$var$>$ = max which means, that the corresponding variable is to be
  91. taken at the corresponding edge of its limitating interval. Note,
  92. that the last (or only) variable is the first one which gets a value
  93. assigned; so this should be the target function in a linear
  94. optimization context. If the keyword parameter RECORD is equated
  95. with T, the intermediate inequalities are included in the result.
  96. An equation with the lhs INT denotes a list of variables, which
  97. are restricted to integer values. Note, that this does not automatically
  98. include a restrition to poitive numbers: such limitations must
  99. be given explicitly in the system.
  100. The result is either an empty list, if the system is inconsistent,
  101. or a list of equations assigning a numeric value (in the current
  102. domain) to each variable. If RECORD=T was selected, each element
  103. of the result itself is a list with the equation for the numerical
  104. value for the variable, followed by the lower and upper bounds
  105. of the corresponding interval. In most cases these bounds are
  106. formal expressions in the other (following) variables, often in
  107. the form of calls to ``max''or ``min'' If a variable is unbound to one
  108. side, an {\tt INF} or {\tt -INF} appears in the corresponding place for
  109. ``infinity''.
  110. If the switch {\tt PRLININEQ} is set, the intervals for the selection
  111. of variable values are printed during the evaluation.
  112. If the switch {\tt TRLININEQ} is set, a complete trace of the
  113. elimination is printed; that may help in cases, where the result of
  114. the process is not understood immediately; however, this printing may
  115. result in a large volume.
  116. By default {\tt PRLININEQ} and {\tt TRLININEQ} are off.
  117. If the switch {\tt TRLININEQINT} is set, a restricted protocol for
  118. integer problems is printed, which only shows the action of the
  119. branch-and-bound method.
  120. \noindent An example:
  121. \begin{verbatim}
  122. linineq({ 5x1 - 4x2 + 13x3 - 2x4 + x5 = 20,
  123. x1 - x2 + 5x3 - x4 + x5 = 8,
  124. x1 + 6x2 - 7x3 + x4 + 5x5 = z,
  125. x1>=0,x2>=0,x3>=0,x4>=0,x5>=0}, {z=min});
  126. \end{verbatim}
  127. \noindent Result:
  128. \begin{verbatim}
  129. 12 4 60
  130. {X5=0,X4=0,X3=----,X2=---,X1=0,Z= - ----}
  131. 7 7 7
  132. \end{verbatim}
  133. \noindent The same with the tower of intervals:
  134. \begin{verbatim}
  135. linineq({ 5x1 - 4x2 + 13x3 - 2x4 + x5 = 20,
  136. x1 - x2 + 5x3 - x4 + x5 = 8,
  137. x1 + 6x2 - 7x3 + x4 + 5x5 = z,
  138. x1>=0,x2>=0,x3>=0,x4>=0,x5>=0}, {z=min}, record=t);
  139. \end{verbatim}
  140. \noindent Result:
  141. \begin{verbatim}
  142. {{X5=0,
  143. - X4 + 7*X3 - 6*X2 - X1 + Z
  144. ------------------------------,
  145. 5
  146. - X4 + 7*X3 - 6*X2 - X1 + Z
  147. ------------------------------},
  148. 5
  149. {X4=0,
  150. 32*X3 - 11*X2 + 4*X1 + Z - 40
  151. -------------------------------,
  152. 6
  153. 32*X3 - 11*X2 + 4*X1 + Z - 40
  154. -------------------------------},
  155. 6
  156. 12
  157. {X3=----,
  158. 7
  159. 7*X2 - 20*X1 + Z + 32
  160. -----------------------,
  161. 16
  162. 7*X2 - 20*X1 + Z + 32
  163. -----------------------},
  164. 16
  165. 4
  166. {X2=---,
  167. 7
  168. 20*X1 - Z - 32
  169. MAX(12*X1 - Z - 8,----------------,0),
  170. 7
  171. - 12*X1 + 3*Z + 32
  172. ---------------------},
  173. 11
  174. 7*Z + 60 2*Z + 36 3*Z + 32
  175. {X1=0,0,MIN(----------,----------,----------)},
  176. 72 19 12
  177. - 60 - 60
  178. {Z=-------,-------,INF}}
  179. 7 7
  180. \end{verbatim}
  181. Remark: The operators $>$ and $<$ currently are not handled by the
  182. system, because in many cases there is no algebraic solution for extremal
  183. problems with these operators. For example ${x>0}$ has no algebraic solution.
  184. \section{Symbolic Interface}
  185. The function {\tt linineq0} offers an interface to the algorithm for symbolic
  186. mode operation:
  187. \begin{center} {\tt linineq0(prob,vars,dir,rec)} \end{center}
  188. where
  189. \begin{description}
  190. \item[prob] list (untagged) of linear algebraic expressions
  191. $(e_1 e_2 \ldots e_n)$ which do NOT contain any relational
  192. operator; the problem to be solved then is
  193. $e_1 \ge 0, \ldots , e_n \ge 0$
  194. \item[vars] list of variables (kernels); the variable list must be
  195. complete; otherwise an error will occur.
  196. \item[dir] {\tt nil} or a list of the form
  197. {\tt ( ( var$_1$ . mm$_1$ ) (var$_2$ . mm$_2$ ) ... )}
  198. where the $var_i$ are variables and the mmi are either
  199. {\tt MAX} or {\tt MIN}.
  200. \item[rec] if not {\tt nil}, the formal bounds for the intermediate
  201. intervals are collected. They are available in the
  202. fluid variable {\tt LININEQRECORD!*}: the value of this
  203. variable is a list, where each element corresponds
  204. to one element of {\bf vars} in the same sequence. Each
  205. element is a list with the lower bound and the
  206. upperbound as algebraic (prefix) expression.
  207. \end{description}
  208. The result is {\tt NIL} (if the system is inconsistent) or a list of the form
  209. {\tt ((var$_1$ . val$_1$) (var$_2$ . val$_2$) ... (var$_n$ . val$_n$))}
  210. where the val$_i$ are algebraic (prefix) expressions, that are integers
  211. or quotients of integers if no domain mode is selected.
  212. \end{document}