• No results found

Representing Parameterised Expressions

Problem classes and problem instances have very similar structures with the difference that problem classes contain parameters whose values are not specified during tailoring. Parameters scale different properties of a constraint class: (1)constant-scalingparameters scale constants in constraints, (2)domain-scalingparameters scale the domain of decision variables, (3)variable-scalingparameters scale the number of variables, and (4)constraint-

scaling parameters scale the number of constraints. These different kinds of parameters

need to be integrated into the expression tree representation from the instance level.

Integrating Constant-Scaling and Domain-Scaling Parameters

Constant-scaling and domain-scaling parameters, as illustrated in Example 5.2.1, often ap- pear in constraint problem classes. They affect the computation of each tree node’s lower and upper bound (see Sec. 3.3.1 for more details), which has to be extended.

Example 5.2.1. illustratingconstant-anddomain-scalingparameters.

given n : i n t ( 1 . . ) given m : i n t ( 0 . . ) f i n d x : i n t ( 1 . .n) $ n a s domains c a l i n g p a r a m e t e r $ f i n d y : i n t ( 0 . .m) $ m a s domains c a l i n g p a r a m e t e r $ such t h a t $ m and n a s c o n s t a n ts c a l i n g p a r a m e t e r s $ x m = y + n

Constant-scaling parameters appear in leaves of expression trees, where the leaf has no specified, constant domain. Therefore, we extend the node/leaf-attributes lb and ub that represent lower and upper bound of every node/leaf to contain parameters: if parameterk appears as a leaf in an expression tree, then the leaf’slbandubis defined ask..k.

Domain-scaling parameters appear in domain definitions of decision variables. Similarly to constant-scaling parameters, we state that if a domain associated to identifierxis bounded

by the parametersk1, k2, andxappears as leaf in an expression treeE, thenx’s lower and

upper bound is defined ask1..k2under the assumption thatk1 ≤k2.

Figure 5.2:Constant-Scaling and Domain-Scaling Parameters: illustrating the tree node lower and upper bounds (light-blue labels at each node and leaf) of Example 5.2.1.

In summary, constant- and domain-scaling parameters are easily integrable into the ex- pression tree structure. Furthermore, the extensions do not prevent us from computing finite lower and upper bounds of each expression subtree (using thelb andub attributes), since every parameterk will be assigned an integer or Boolean value. Fig. 5.2 illustrates constant- and domain-scaling on an example, as well as the computation of the expression nodes’ lower and upper bound attributes (represented as light-blue labels), based on the problem class in Example 5.2.1.

Integrating Variable-Scaling Parameters

Variable-scaling parameters arise in the index domain of variable arrays, i.e. they scale the number of elements an array contains, as Example 5.2.2 illustrates. Variable-scaling parameters are easily integrated by extending the symbol table to contain arrays that have a parameterised number of elements.

Example 5.2.2. illustratingvariable-andconstraint-scalingparameters.

given n : i n t ( 1 . . )

$ n s c a l i n g l e n g t h o f a r r a y s x and y $

f i n d x,y: matrix indexed by [i n t ( 1 . .n) ] of bool

such t h a t $ n s c a l i n g number o f c o n s t r a i n t s $

f o r a l l i:i n t ( 1 . .n) . x[i] \/ y[i]

Integrating Constraint-Scaling Parameters

Constraint-scaling parameters scale the number of constraints, typically by appearing in quantifying domains of quantifications, such as parameter n in the quantification in Ex- ample 5.2.2. In a probleminstance, n would be specified and the quantification unrolled,

generatingndisjunctions. However, at class level, such quantifications cannot be unrolled, thus we need to define a notion of parameterised quantified expressions as part of the in- termediate expression representation that is used in the tailoring middle-end (Sec. 3.3). Therefore, we extend the corresponding expression tree representation from instance level (Sec. 3.2) to support parameterised quantified expressions, particularly,and!.

Each quantification nodeN has one argument: the quantified expression. The quantifying variable(s) and the corresponding quantified domain(s) is(are) stored as attributes of N. These attributes are also propagated to all subnodes/leaves that are quantified. Thus each node/leaf in an expression tree ‘knows’ if (and over what domain) it is quantified. As an example, Fig. 5.3 illustrates the quantifier attributes (quantifying variables and associated domain) as grey labels in the expression tree of the constraint in Example 5.2.3 below.

Example 5.2.3. Sample Quantification

f o r a l l i:i n t ( 1 . .n) .

e x i s t s j:i n t ( 1 . .m) .

x[i] = y[j]

Note, that if the problem class is directly tailored to solver input, then these quantifiers are only allowed if the target solver providesn-ary propagators for conjunction (∀), disjunction

() and addition (!).

Figure 5.3: illustrating theQuantifier Attributes in the expression tree representation of the constraint from Example 5.2.3, where the grey labels represent the quantifier attributes for the corresponding node/leaf.