⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gmpl.texi

📁 著名的大规模线性规划求解器源码GLPK.C语言版本,可以修剪.内有详细帮助文档.
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
@examplesum@{i in A, (j,k) in B, l in C@} p[i,j,k,l]@end example@noindentwhere @i{p}[@i{i}, @i{j}, @i{k}, @i{l}] may be a 4-dimensional numericparameter or some numeric expression whose resultant value depends on@i{i}, @i{j}, @i{k}, and @i{l}. In this case the action is summation,so the resultant value of the primary numeric expression@iftexis:@quotation@math{@displaystyle@sum_{i@in A,(j,k)@in B,l@in C}(p_{ijkl}).}@end quotation@end iftex@ifnottexis the sum of @i{p}[@i{i}, @i{j}, @i{k}, @i{l}], where summation isperformed over all @i{i}@tie{}in@tie{}@i{A},(@i{j},@i{k})@tie{}in@tie{}@i{B}, and @i{l}@tie{}in@tie{}@i{C}.@end ifnottexNow let the example indexing expression be used as a primary setexpression. In this case the action is gathering all 4-tuples(quadruples) of the form (@i{i}, @i{j}, @i{k}, @i{l}) in one set, so theresultant value of such operation is simply the Cartesian product of thebasic sets:@iftex@quotation@math{A@times B@times C=@{(i,j,k,l):i@in A,(j,k)@in B,l@in C@}.}@end quotation@end iftex@ifnottex@quotation@i{A} x @i{B} x @i{C} = @{(@i{i},@i{j},@i{k},@i{l}) :@i{i}@tie{}in@tie{}@i{A}, (@i{j},@i{k})@tie{}in@tie{}@i{B},@i{l}@tie{}in@tie{}@i{C}@}@end quotation@end ifnottex@noindentNote that in this case the same indexing expression might be writtenin the reduced form:@example@{A, B, C@}@end example@noindentbecause the dummy indices @i{i}, @i{j}, @i{k}, and @i{l} are notreferenced and therefore their symbolic names are not needed.Finally, let the example indexing expression be used as the subscriptdomain in the declaration of a 4-dimensional model object, say, anumeric parameter:@examplepar p@{i in A, (j,k) in B, l in C@} ... ;@end example@noindentIn this case the action is generating the parameter members, where eachmember has the form @i{p}[@i{i},@tie{}@i{j},@tie{}@i{k},@tie{}@i{l}].As was said above, some indices in the second form of indexing entriesmay be numeric or symbolic expressions, not only dummy indices. In thiscase resultant values of such expressions play role of some logicalconditions to select only that @i{n}-tuples from the Cartesian productof basic sets, which satisfy these conditions.Consider, for example, the following indexing expression:@example@{i in A, (i-1,k) in B, l in C@}@end example@noindentwhere @i{i}, @i{k}, @i{l} are dummy indices, and @i{i}@minus{}1 isa numeric expression. The algorithmic decsription of this indexingexpression is the following:@iftex@quotation@b{for all} @math{i@in A} @b{do}@ @ @ @b{for all} @math{(j,k)@in B} @b{and} @math{j=i-1} @b{do}@ @ @ @ @ @ @b{for all} @math{l@in C} @b{do}@ @ @ @ @ @ @ @ @ @i{action};@end quotation@end iftex@ifnottex@examplefor all i in A do   for all (j,k) in B and j = i-1 do      for all l in C do         action;@end example@end ifnottex@noindentThus, if this indexing expression were used as a primary set expression,the resultant set would be the following:@quotation@{(4,@i{May},@i{a}), (4,@i{May},@i{b}), (4,@i{May},@i{c}),(4,@i{Jun},@i{a}), (4,@i{Jun},@i{b}), (4,@i{Jun},@i{c})@}.@end quotation@noindentShould note that in this case the resultant set consists of 3-tuples,not of 4-tuples, because in the indexing expression there is no dummyindex that corresponds to the first component of 2-tuples from the set@i{B}.The general rule is: the number of components of @i{n}-tuples definedby an indexing expression is the same as the number of dummy indices inthat indexing expression, where the correspondence between dummy indicesand components on @math{n}-tuples in the resultant set is positional,i.e. the first dummy index corresponds to the first component, thesecond dummy index corresponds to the second component, etc.In many cases it is needed to select a subset from the Cartesianproduct of some sets. This may be attained by using an optional logicalpredicate, which is specified in indexing expression after the last orthe only indexing entry.Consider, for another example, the following indexing expression:@example@{i in A, (j,k) in B, l in C: i <= 5 and k <> 'Mar'@}@end example@noindentwhere the logical expression following the colon is a predicate. Thealgorithmic description of this indexing expression is the following:@iftex@quotation@b{for all} @math{i@in A} @b{do}@ @ @ @b{for all} @math{(j,k)@in B} @b{do}@ @ @ @ @ @ @b{for all} @math{l@in C} @b{do}@ @ @ @ @ @ @ @ @ @b{if} @math{i@leq 5} @b{and} @math{k@neq} `@i{Mar}'@b{then}@ @ @ @ @ @ @ @ @ @ @ @ @i{action};@end quotation@end iftex@ifnottex@examplefor all i in A do   for all (j,k) in B do      for all l in C do         if i <= 5 and k != 'Mar' then            action;@end example@end ifnottex@noindentThus, if this indexing expression were used as a primary set expression,the resultant set would be the following:@quotation@{(4,1,@i{Jan},@i{a}), (4,1,@i{Feb},@i{a}), (4,2,@i{Apr},@i{a}),@dots{}, (4,3,@i{Jun},@i{c})@}.@end quotationIf no predicate is specified in the indexing expression, the one, whichtakes on the value @i{true}, is assumed.@node Set expressions@section Set expressions@dfn{Set expression} is a rule for computing an elemental set, i.e.a collection of @i{n}-tuples, where components of @i{n}-tuples arenumeric and symbolic quantities.The primary set expression may be a literal set, unsubscripted set,subscripted set, ``arithmetic'' set, indexing expression, iterated setexpression, conditional set expression, or another set expressionenclosed in parentheses.@strong{Examples}@quotation@multitable @columnfractions .60 .40@item @verb{|{(123,'aa'), (i,'bb'), (j-1,'cc')}|} @tab (literal set)@item @verb{|I|} @tab (unsubscripted set)@item @verb{|S[i-1,j+1]|} @tab (subscripted set)@item @verb{|1..t-1 by 2|} @tab (``arithmetic'' set)@item @verb{|{t in 1..T, (t+1,j) in S: (t,j) in F}|} @tab (indexingexpression)@item @verb{|setof{i in I, j in J}(i+1,j-1)|} @tab (iterated expression)@item @verb{|if i < j then S[i] else F diff S[j]|} @tab (conditionalexpression)@item @verb{|(1..10 union 21..30)|} @tab (parenthesized expression)@end multitable@end quotationMore general set expressions containing two or more primary setexpressions may be constructed by using certain set operators.@strong{Examples}@example(A union B) inter (I cross J)1..10 cross (if i < j then @{'a', 'b', 'c'@} else @{'d', 'e', 'f'@})@end example@subheading Literal setsLiteral set is a primary set expression, which has the following twosyntactic forms:@iftex@quotation@math{@{e_1,e_2,@dots,e_m@}}@math{@{(e_{11},@dots,e_{1n}),(e_{21},@dots,e_{2n}),@dots,(e_{m1},@dots,e_{mn})@}}@end quotation@noindentwhere @math{e_1}, @dots, @math{e_m}, @math{e_{11}}, @dots, @math{e_{mn}}are numeric or symbolic expressions.@end iftex@ifnottex@quotation@{@i{e}1, @i{e}2, @dots{}, @i{em}@}@{(@i{e}11, @dots{}, @i{e}1@i{n}), (@i{e}21, @dots{}, @i{e}2@i{n}),@dots{}, (@i{em}1, @dots{}, @i{emn})@}@end quotation@noindentwhere @i{e}1, @dots{}, @i{em}, @i{e}11, @dots{}, @i{emn} are numeric orsymbolic expressions.@end ifnottexIf the first form is used, the resultant set consists of 1-tuples(singles) enumerated within the curly braces. It is allowed to specifyan empty set, which has no 1-tuples.If the second form is used, the resultant set consists of @i{n}-tuplesenumerated within the curly braces, where a particular @i{n}-tupleconsists of corresponding components enumerated within the parentheses.All @i{n}-tuples must have the same number of components.@subheading Unsubscripted setsIf the primary set expression is an unsubscripted set (which must be0-dimensional), the resultant set is an elemental set associated withthe corresponding set object.@subheading Subscripted setsThe primary set expression, which refers to a subscripted set, has thefollowing syntactic form:@iftex@quotation@math{name[i_1,i_2,@dots,i_n],}@end quotation@noindentwhere @math{name} is the symbolic name of the set object, @math{i_1},@math{i_2}, @dots, @math{i_n} are subscripts.@end iftex@ifnottex@quotation@i{name}[@i{i}1, @i{i}2, @dots{}, @i{in}],@end quotation@noindentwhere @i{name} is the symbolic name of the set object, @i{i}1, @i{i}2,@dots{}, @i{in} are subscripts.@end ifnottexEach subscript must be a numeric or symbolic expression. The number ofsubscripts in the subscript list must be the same as the dimension ofthe set object with which the subscript list is associated.Actual values of subscript expressions are used to identify a particularmember of the set object that determines the resultant set.@subheading ``Arithmetic'' setThe primary set expression, which is an ``arithmetic'' set, has thefollowing two syntactic forms:@iftex@quotation@math{t_0} @verb{|..|} @math{t_f} @verb{|by|} @math{@delta t}@math{t_0} @verb{|..|} @math{t_f}@end quotation@noindentwhere @math{t_0}, @math{t_1}, and @math{@delta t} are numericexpressions (the value of @math{@delta t} must not be zero). The secondform is equivalent to the first form, where @math{@delta t=1}.If @math{@delta t>0}, the resultant set is determined as follows:@quotation@math{@{t:@exists k@in{@cal Z}(t=t_0+k@delta t,@ t_0@leq t@leq t_f)@}}@end quotation@noindentOtherwise, if @math{@delta t<0}, the resultant set is determined asfollows:@quotation@math{@{t:@exists k@in{@cal Z}(t=t_0+k@delta t,@ t_f@leq t@leq t_0)@}}@end quotation@end iftex@ifnottex@quotation@i{t}0 @verb{|..|} @i{tf} @verb{|by|} @i{dt}@i{t}0 @verb{|..|} @i{tf}@end quotation@noindentwhere @i{t}0, @i{t}1, and @i{dt} are numeric expressions (the value of@i{dt} must not be zero). The second form is equivalent to the firstform, where @i{dt}@tie{}=@tie{}1.If @i{dt}@tie{}>@tie{}0, the resultant set is determined as follows:@quotation@{@i{t}: exists @i{k} in Z (@i{t} = @i{t}0 + @i{k} @i{dt}, @i{t}0 <=@i{t} <= @i{tf})@}@end quotation@noindentOtherwise, if @i{dt}@tie{}<@tie{}0, the resultant set is determined asfollows:@quotation@{@i{t}: exists @i{k} in Z (@i{t} = @i{t}0 + @i{k} @i{dt}, @i{tf} <=@i{t} <= @i{t}0)@}@end quotation@end ifnottex@subheading Indexing expressionsIf the primary set expression is an indexing expression, the resultantset is determined as described in Section ``Indexing expressions anddummy indices'' (see above).@subheading Iterated expressionsIterated set expression is a primary set expression, which has thefollowing syntactic form:@quotation@verb{|setof|} @var{indexing-expression} @var{integrand}@end quotation@noindentwhere @var{indexing-expression} is an indexing expression whichintroduces dummy indices and controls iterating, @var{integrand} iseither a single numeric or symbolic expression or a list of numeric andsymbolic expressions separated by commae and enclosed in parentheses.If the integrand is a single numeric or symbolic expression, theresultant set consists of 1-tuples and is determined as follows:@iftex@quotation@math{@{x:(i_1,@dots,i_n)@in@Delta@},}@end quotation@noindentwhere @math{x} is a value of the integrand, @math{i_1}, @dots,@math{i_n} are dummy indices introduced in the indexing expression,@math{@Delta}@end iftex@ifnottex@quotation@{@i{x}: (@i{i}1, @dots{}, @i{in}) in D@},@end quotation@noindentwhere @i{x} is a value of the integrand, @i{i1}, @dots{}, @i{in} aredummy indices introduced in the indexing expression, D@end ifnottexis the domain, a set of @i{n}-tuples specified by the indexingexpression which defines particular values assigned to the dummy indiceson performing the iterated operation.If the integrand is a list containing @i{m} numeric and symbolicexpressions, the resultant set consists of @i{m}-tuples and isdetermined as follows:@iftex@quotation@math{@{(x_1,@dots,x_m):(i_1,@dots,i_n)@in@Delta@},}@end quotation@noindentwhere @math{x_1}, @dots, @math{x_m} are values of the expressions in theintegrand list, @math{i_1}, @dots, @math{i_n} and @math{@Delta}@end iftex@ifnottex@quotation@{(@i{x}1, @dots{}, @i{xm}): (@i{i}1, @dots{}, @i{in}) in D@},@end quotation@noindentwhere @i{x}1, @dots{}, @i{xm} are values of the expressions in theintegrand list, @i{i}1, @dots{}, @i{in} and D@end ifnottexhave the same meaning as above.@subheading Conditional expressions

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -