📄 gmpl.texi
字号:
Conditional set expression is a primary set expression that has thefollowing syntactic form:@quotation@verb{|if|} @i{b} @verb{|then|} @i{X} @verb{|else|} @i{Y}@end quotation@noindentwhere @i{b} is an logical expression, @i{X} and @i{Y} are setexpressions, which must define sets of the same dimension.The resultant value of the conditional expression depends on the valueof the logical expression that follows the keyword @verb{|if|}. If ittakes on the value @i{true}, the resultant set is the value of theexpression that follows the keyword @verb{|then|}. Otherwise, if thelogical expression takes on the value @i{false}, the resultant set isthe value of the expression that follows the keyword @verb{|else|}.@subheading Parenthesized expressionsAny set expression may be enclosed in parentheses that syntacticallymakes it primary set expression.Parentheses may be used in set expressions, as in algebra, to specifythe desired order in which operations are to be performed. Whereparentheses are used, the expression within the parentheses is evaluatedbefore the resultant value is used.The resultant value of the parenthesized expression is the same as thevalue of the expression enclosed within parentheses.@subheading Set operatorsIn MathProg there are the following set operators, which may be used inset expressions:@quotation@multitable @columnfractions .20 .80@item @i{X} @verb{|union|} @i{Y} @tab union@iftex@math{X@cup Y}@end iftex@item @i{X} @verb{|diff|} @i{Y} @tab difference@iftex@math{X@backslash Y}@end iftex@item @i{X} @verb{|symdiff|} @i{Y} @tab symmetric difference@iftex@math{X@oplus Y}@end iftex@item @i{X} @verb{|inter|} @i{Y} @tab intersection@iftex@math{X@cap Y}@end iftex@item @i{X} @verb{|cross|} @i{Y} @tab cross (Cartesian) product@iftex@math{X@times Y}@end iftex@end multitable@end quotation@noindentwhere @i{X} and @i{Y} are set expressions, which must define sets of theidentical dimension (except for the Cartesian product).If the expression includes more than one set operator, all operators areperformed from left to right according to the hierarchy of operations(see below).The resultant value of the expression, which contains set operators, isthe result of applying the operators to their operands.The dimension of the resultant set, i.e. the dimension of @i{n}-tuples,of which the resultant set consists of, is the same as the dimension ofthe operands, except the Cartesian product, where the dimension of theresultant set is the sum of dimensions of the operands.@subheading Hierarchy of operationsThe following list shows the hierarchy of operations in set expressions:@quotation@multitable @columnfractions .70 .30@item @i{Operation} @tab @i{Hierarchy}@item Evaluation of numeric operations @tab 1st-7th@item Evaluation of symbolic operations @tab 8th-9th@item Evaluation of iterated or ``arithmetic'' set (@verb{|setof|},@verb{|..|}) @tab 10th@item Cartesian product (@verb{|cross|}) @tab 11th@item Intersection (@verb{|inter|}) @tab 12th@item Union and difference (@verb{|union|}, @verb{|diff|},@verb{|symdiff|}) @tab 13th@item Conditional evaluation (@verb{|if|} @dots{} @verb{|then|} @dots{}@verb{|else|}) @tab 14th@end multitable@end quotationThis hierarchy is used to determine which of two consecutive operationsis performed first. If the first operator is higher than or equal to thesecond, the first operation is performed. If it is not, the secondoperator is compared to the third, etc. When the end of the expressionis reached, all of the remaining operations are performed in the reverseorder.@node Logical expressions@section Logical expressions@dfn{Logical expression} is a rule for computing a single logical value,which can be either @i{true} or @i{false}.The primary logical expression may be a numeric expression, relationalexpression, iterated logical expression, or another logical expressionenclosed in parentheses.@strong{Examples}@quotation@multitable @columnfractions .60 .40@item @verb{|i+1|} @tab (numeric expression)@item @verb{|a[i,j] < 1.5|} @tab (relational expression)@item @verb{|s[i+1,j-1] <> 'Mar' & year|} @tab (relational expression)@item @verb{|(i+1,'Jan') not in I cross J|} @tab (relational expression)@item @verb{|S union T within A[i] inter B[j]|} @tab (relationalexpression)@item @verb{|forall{i in I, j in J} a[i,j] < .5 * b|} @tab (iteratedexpression)@item @verb{|(a[i,j] < 1.5 or b[i] >= a[i,j])|} @tab (parenthesizedexpression)@end multitable@end quotationMore general logical expressions containing two or more primary logicalexpressions may be constructed by using certain logical operators.@strong{Examples}@examplenot (a[i,j] < 1.5 or b[i] >= a[i,j]) and (i,j) in S(i,j) in S or (i,j) not in T diff U@end example@subheading Numeric expressionsThe resultant value of the primary logical expression, which is anumeric expression, is @i{true}, if the resultant value of the numericexpression is non-zero. Otherwise the resultant value of the logicalexpression is @i{false}.@subheading Relational expressionsIn MathProg there are the following relational operators, which may beused in logical expressions:@quotation@multitable @columnfractions .50 .50@item @i{x} @verb{|<|} @i{y} @tab test on @i{x} < @i{y}@item @i{x} @verb{|<=|} @i{y} @tab test on@iftex@math{x@leq y}@end iftex@ifnottex@i{x} <= @i{y}@end ifnottex@item @i{x} @verb{|=|} @i{y}, @i{x} @verb{|==|} @i{y} @tab test on@i{x} = @i{y}@item @i{x} @verb{|>=|} @i{y} @tab test on@iftex@math{x@geq y}@end iftex@ifnottex@i{x} >= @i{y}@end ifnottex@item @i{x} @verb{|<>|} @i{y}, @i{x} @verb{|!=|} @i{y} @tab test on@iftex@math{x@neq y}@end iftex@ifnottex@i{x} != @i{y}@end ifnottex@item @i{x} @verb{|in|} @i{Y} @tab test on@iftex@math{x@in Y}@end iftex@ifnottex@i{x} in @i{Y}@end ifnottex@iftex@item @math{(x_1,@dots,x_n)} @verb{|in|} @math{Y} @tab test on@math{(x_1,@dots,x_n)@in Y}@end iftex@ifnottex@item (@i{x}1,@dots{},@i{xn}) @verb{|in|} @i{Y} @tab test on(@i{x}1,@dots{},@i{xn}) in @i{Y}@end ifnottex@item @i{x} @verb{|not in|} @i{Y}, @i{x} @verb{|!in|} @i{Y} @tab test on@iftex@math{x@not@in Y}@end iftex@ifnottex@i{x} not in @i{Y}@end ifnottex@iftex@item @math{(x_1,@dots,x_n)} @verb{|not in|} @math{Y},@math{(x_1,@dots,x_n)} @verb{|!in|} @math{Y} @tab test on@math{(x_1,@dots,x_n)@not@in Y}@end iftex@ifnottex@item (@i{x}1,@dots{},@i{xn}) @verb{|not in|} @i{Y}, @tab@item (@i{x}1,@dots{},@i{xn}) @verb{|!in|} @i{Y} @tab test on(@i{x}1,@dots{},@i{xn}) not in @i{Y}@end ifnottex@item @i{X} @verb{|within|} @i{Y} @tab test on@iftex@math{X@subseteq Y}@end iftex@ifnottex@i{X} within @i{Y}@end ifnottex@item @i{X} @verb{|not within|} @i{Y}, @i{X} @verb{|!within|} @i{Y}@tab test on@iftex@math{X@not@subseteq Y}@end iftex@ifnottex@i{X} not within @i{Y}@end ifnottex@end multitable@end quotation@noindentwhere @i{x},@iftex@math{x_1}, @dots, @math{x_n},@end iftex@ifnottex@i{x}1, @dots{}, @i{xn},@end ifnottex@i{y} are numeric or symbolic expressions, @i{X} and @i{Y} are setexpression.@i{Note:}@quotation@enumerate@item In the operations @verb{|in|}, @verb{|not in|}, and @verb{|!in|}the number of components in the first operands must be the same as thedimension of the second operand.@item In the operations @verb{|within|}, @verb{|not within|}, and@verb{|!within|} both operands must have identical dimension.@end enumerate@end quotationAll the relational operators listed above have their conventionalmathematical meaning. The resultant value is @i{true}, if thecorresponding relation is satisfied for its operands, otherwise@i{false}. (Note that symbolic values are ordered lexicographically,and any numeric value precedes any symbolic value.)@subheading Iterated expressionsIterated logical expression is a primary logical expression, which hasthe following syntactic form:@quotation@var{iterated-operator} @var{indexing-expression} @var{integrand}@end quotation@noindentwhere @var{iterated-operator} is the symbolic name of the iteratedoperator to be performed (see below), @var{indexing expression} is anindexing expression which introduces dummy indices and controlsiterating, @var{integrand} is a logical expression that participates inthe operation.In MathProg there are two iterated operators, which may be used inlogical expressions:@iftex@quotation@multitable @columnfractions .10 .25 .65@item @verb{|forall|} @tab @math{@forall}-quantification @tab@math{@forall(i_1,@dots,i_n)_{@in@Delta}[x(i_1,@dots,i_n)]}@item @verb{|exists|} @tab @math{@exists}-quantification @tab@math{@exists(i_1,@dots,i_n)_{@in@Delta}[x(i_1,@dots,i_n)]}@end multitable@end quotation@end iftex@ifnottex@quotation@multitable @columnfractions .10 .25 .65@item @verb{|forall|} @tab A-quantification @tabfor all (@i{i}1,@dots{},@i{in}) in D: @i{x}(@i{i}1,@dots{},@i{in})@item @verb{|exists|} @tab E-quantification @tabexists @ (@i{i}1,@dots{},@i{in}) in D: @i{x}(@i{i}1,@dots{},@i{in})@end multitable@end quotation@end ifnottex@noindentwhere@iftex@math{i_1}, @dots, @math{i_n}@end iftex@ifnottex@i{i}1, @dots{}, @i{in}@end ifnottexare dummy indices introduced in theindexing expression,@iftex@math{@Delta}@end iftex@ifnottexD@end ifnottexis the domain, a set of@i{n}-tuples specified by the indexing expression which definesparticular values assigned to the dummy indices on performing theiterated operation,@iftex@math{x(i_1,@dots,i_n)}@end iftex@ifnottex@i{x}(@i{i}1,@dots{},@i{in})@end ifnottexis the integrand, a logical expression whose resultant value depends onthe dummy indices.For@iftex@math{@forall}-quantification@end iftex@ifnottexA-quantification@end ifnottexthe resultant value of the iterated logical expression is @i{true}, ifthe value of the integrand is @i{true} for all @i{n}-tuples contained inthe domain, otherwise @i{false}.For@iftex@math{@exists}-quantification@end iftex@ifnottexE-quantification@end ifnottexthe resultant value of the iterated logical expression is @i{false}, ifthe value of the integrand is @i{false} for all @i{n}-tuples containedin the domain, otherwise @i{true}.@subheading Parenthesized expressionsAny logical expression may be enclosed in parentheses that syntacticallymakes it primary logical expression.Parentheses may be used in logical expressions, as in algebra, tospecify the desired order in which operations are to be performed. Whereparentheses are used, the expression within the parentheses is evaluatedbefore the resultant value is used.The resultant value of the parenthesized expression is the same as thevalue of the expression enclosed within parentheses.@subheading Logical operatorsIn MathProg there are the following logical operators, which may be usedin logical expressions:@quotation@multitable @columnfractions .30 .70@item @verb{|not|} @i{x}, @verb{|!|} @i{x} @tab negation@item @i{x} @verb{|and|} @i{y}, @i{x} @verb{|&&|} @i{y} @tabconjunction (logical ``and'')@item @i{x} @verb{|or|} @i{y}, @i{x} @verb{$||$} @i{y} @tabdisjunction (logical ``or'')@end multitable@end quotation@noindentwhere @i{x} and @i{y} are logical expressions.If the expression includes more than one logical operator, alloperators are performed from left to right according to the hierarchyof operations (see below).The resultant value of the expression, which contains logicaloperators, is the result of applying the operators to their operands.@subheading Hierarchy of operationsThe following list shows the hierarchy of operations in logicalexpressions:@quotation@multitable @columnfractions .70 .30@item @i{Operation} @tab @i{Hierarchy}@item Evaluation of numeric operations @tab 1st-7th@item Evaluation of symbolic operations @tab 8th-9th@item Evaluation of set operations @tab 10th-14th@item Relational operations (@verb{|<|}, @verb{|<=|}, etc.) @tab 15th@item Negation (@verb{|not|}, @verb{|!|}) @tab 16th@item Conjunction (@verb{|and|}, @verb{|&&|}) @tab 17th@item@iftex@math{@forall}- and @math{@exists}-quantification@end iftex@ifnottexA- and E-quantification@end ifnottex(@verb{|forall|}, @verb{|exists|}) @tab 18th@item Disjunction (@verb{|or|}, @verb{$||$}) @tab 19th@end multitable@end quotationThis hierarchy has the same meaning as explained in Section ``Numericexpressions''.@node Linear expressions@section Linear expressions@dfn{Linear expression} is a rule for computing so called @dfn{linearform} or simply @dfn{formula}, which is a linear (or affine) function ofelemental variables.The primary linear expression may be an unsubscripted variable,subscripted variable, iterated linear expression, conditional linearexpression
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -