• Keine Ergebnisse gefunden

Objective Function

Im Dokument Sketching Slides (Seite 112-119)

5.2 Layout Constraints

5.2.1 Objective Function

The constraints formulated so far more or less followed naturally from the shapes’ content or from the arrangement of shapes on the page. The solution to the layout problem however and the desired properties of a layout solution are encoded in the objective function. Some authors have tried to define properties of “nice” layouts [54] or have even tried to develop algorithms based on such measures [85]. Marriott et al. mentioned in their recent work on document layout [92] that users accepted automatically generated layouts if they could not be improved locally.

What “nice-ness” means in regard to the layout of a single shape should be expressed by the shape’s width and height constraints. The layout algo-rithm should favor regular and predictable layout solutions to increase the user’s acceptance of the generated results. This means essentially, that the available space on a page should be distributed evenly between the gaps in horizontal and vertical direction. Conversely, if the layout is over-constrained and no feasible solution to a strict set of constraints exists, the layout algo-rithm should spread the error evenly between the constraints. The goal is that the automatically generated solutions degrade gracefully with tightening constraints, always yielding a solution that is as good as possible while simul-taneously providing a visual cue that the constraint set is over-constrained.

5.2. LAYOUT CONSTRAINTS 101 Maximizing Constraint Satisfaction

The layout problem resembles a constrained resource allocation problem in that a limited resource, i.e., page space, is assigned to different gaps sub-ject to a set of distance constraints. Some gaps have minimum sizes, others have maximum sizes or both. To solve such resource allocation and plan-ning problems, the so-called goal programming approach has been developed.

Where linear programming problems maximize a single objective, goal pro-gramming problems minimize the deviation from a set of specified objectives [82, 37, 106, 114, 23].

Definition 20. A weighted goal programming problem WGP is the problem of finding

minz =

n

X

i=1

(uini+vipi) subject to fi(x) +nipi =bi i= 1. . . n

Ax=b

where eachfi : Rn→Ris a goal function,bi ∈Ris the desired goal value for fi(x), and the ni, pi ∈Rare the negative and positive deviation offi(x) from this goal value. Given weights ui, vi ∈ R the problem is thus to minimize the weighted deviation over all i. As in linear programming, Ax = b is an optional set of hard constraints.

Constraints with negative or positive error terms are usually called soft constraints and they have been used, e.g., in the Auckland Layout Manager developed by Lutteroth et al. [86]. The Cassowary constraint solver [7] solves hierarchical sets of linear constraints by minimizing the weighted sum of positive and negative constraint errors incurred on non-required constraints.

Given an instance of the layout problemL= (P,C, o), each constraint set in C can be transformed into a set of soft constraints by adding a so-called scale variable. The scale variable is a negative error term that represents the amount by which the constraint equation deviates from its target value. It is a negative error term because the constraint equations never exceed their target value. Then, the objective function L.o can be defined in terms of these scale variables.

The idea of a scaled constraint can most easily be applied to the setCMin of minimum distance constraints. Each constraint in ekCMin takes the form

ek :

n

X

i=1

ci·gi.vd ¬gi.f, gi ∈ Gx∪ Gy, ci, d∈R, d≥0

The constraint setCMin0 is defined by adding a scalevariable sk ∈Rto every constraint equation ekCMin. The resulting constraints have the form

e0k :

n

X

i=1

ci·gi.vd·sk.

Definition 21. Ascaled constraint set SC = (S, H, u) is a triple consist-ing an of an upper boundu∈R, a set of scaled constraint equations

S =

( n X

i=1

ci·gi.vd·sk| ¬gi.f, gi ∈ Gx∪ Gy, ci, d, sk∈R, sku

)

,

where each scale variableskis only part of a single constraint equationekS, and a possibly empty set of hard constraintsH.

Given a scaled constraint set

SCMin= (CMin0 ,∅, u:= 1)

there always exists an n-tuple of scale variables such that all scaled constraint equations inCMin0 are satisfied since in every constraint d≥0 and thesk can be made arbitrarily small until every inequality is satisfied. If ∀k : sk = 1, all minimum distance constraints in CMin are satisfied.

Formulating Scaled Constraint Sets

The constraint setsCMax, CEqual, CGap andCClosehave to be transformed into their scaled equivalents:

1. The set of Maximum Distance constraints C =

( n X

i=1

ci·gi.vd| ¬gi.f, gi ∈ Gx∪ Gy, ci, d∈R, d≥0

)

,

is transformed into C0 =

( n X

i=1

−ci·gi.v ≥ −d·sk| ¬gi.f, gi ∈ Gx∪ Gy, ci, d∈R, d≥0

)

,

and the scaled constraint set is defined asSCMax = (C0,∅,−1).

2. Equal Distance

With gridlines gi, gj ∈ Gx ∪ Gy and factors ci, cj ∈ R, equal distance constraints have the form

n

X

i=1

ci·gi.v =· · ·=

m

X

j=1

cj·gj.v.

5.2. LAYOUT CONSTRAINTS 103 By introducing a common variable zk ∈R, the single equation can be split into several constraints

n

X

i=1

ci·gi.v =zk∧ · · · ∧

m

X

j=1

cj ·gj.v =zk. Each individual constraint can be further transformed into

n

X

i=1

ci·gi.vzk ≤0∧

n

X

i=1

ci·gi.vzksk.

All left equations form the set of hard constraintsH, the right equations the set of scaled constraints S, andSCEqual = (S, H,0).

3. Gap Constraints For every gap constraints

grgl>0 the scaled constraint

grglsk

is added to setS0, and the unscaled hard constraintgrgl >0 is added toH0. For gap constraints grgl ≥0 only the scaled form is added to S0. SCGap = (S0, H0,∞).

4. Close To Slide Constraints

The last remaining constraints are those inserted in Alg. 20 to keep gridlines close to the page. The constraint is already in scaled form:

ghighd/2sk or −glow+d/2sk

Maximizing variable sk with sk ≤ 0 will move gridlines ghigh and glow as close to the page center as possible. The constraint is only inserted for gridlines to the left, right, top or the bottom of the page. The upper bound for gridline ghigh is thus the left or top gridline on the page boundary and the above constraint functions as a lower bound to the position of ghigh. For glow the right or bottom page boundary form the lower bound and the above constraint limits the upper bound.

Therefore,SCClose = (CClose,∅,0).

The Scaled Layout Problem

In all scaled constraint sets except SCGap, the scale variable is a negative error term that must be maximized up to the given upper bound. In gap constraints, the scale variable is the size of the gap itself which has no upper bound. Assuming not all constraints can be satisfied, how should the con-straint error be distributed between the scale variables, or how should the available page space be distributed among the gap constraints? For example, if not all minimum distance constraints can be satisfied, should the number of unsatisfied constraint equations be minimized, the largest deviation of some scale variable sk from its upper bound, or some other measure?

The scaled constraint sets can be ordered according to their priority from highest to lowest: SC = (SCMin, SCMax, SCEqual, SCGap, SCClose). Minimum distance constraints guarantee the minimum shape sizes necessary to fit a shape’s content. Gap constraints only distribute the remaining space once every shape has been assigned a minimum extent. The least important con-straints belong to constraint set CClose. Thus, it seems preferable to max-imize the scale variables belonging to minimum size constraints first. For each scaled constraint set SCi, ~si ∈ R|SCi.S| is the vector of scale variables occurring in the soft constraintsSCi.S. Let

x:= (~sMin, ~sMax, ~sEqual, ~sGap, ~sClose)

be the vector composed of the scale variable vectors for each scaled constraint set. The problem of finding an optimal assignment of scale variables can be treated independently for each constraint set, i.e., for each hierarchy level.

As previously described, the distribution of constraint errors and the distri-bution of gap sizes should be even and regular. The problem of equitable resource allocation has been studied extensively in the Operations Research literature. Space is a resource that is distributed among gaps and infeasibility is a resource that can be distributed over the scale variables.

For the set of minimum distance constraints, there could be two feasible solutions: A single minimum distance constraint may have a very small scale value, meaning that the deviation between the desired and the obtainable minimum distance is very large, or alternatively, many minimum distance constraints may have scale variables only a little less than one. The latter solution distributes the dissatisfaction more evenly among the constraints and is preferable to the first solution.

Several definitions of optimality are usually referred to in the context of goal-programming problems [43, 33], each having certain desirable properties.

Definition 22. A feasible solution x = (x0, . . . , xn) ∈ C is called Pareto optimal, if there is no other feasible solution x0C whose components

5.2. LAYOUT CONSTRAINTS 105 are each not less than the components of x and there exists at least one component of x0 strictly larger than that of x, i.e.,

6 ∃x0C :∀i:x0ixi∧ ∃j :x0j > xj i, j ∈[0, n]

No feasible solution to the layout problem should be considered optimal if it does not meet the definition of Pareto-optimality. However, the set of Pareto-optimal solutions can still be very large.

Definition 23. A solutionxC to a maximization problem is called min-ordering optimal if the smallest component is maximal:

∀x0C : min

i (x0i)≤min

j (xj) i, j ∈[0, n].

The value of a min-ordering optimal solution is uniquely defined but not every min-ordering solution is also Pareto-optimal. The min-ordering crite-rion does not restrict the values of vector components other than the one with the smallest value.

Definition 24. A vector xC is calledlexicographically maximal if

∀x0C :∃i:∀j ∈[1, i−1] :x0j =xjx0ixi i∈[0, n].

Lexicographic optimality thus compares all components of a feasible so-lution and the optimal soso-lution value is again uniquely defined. However, the definition of optimality requires an a-priori order on the members of a feasible solution vectorx. In resource allocation problems, the components of xcan frequently be ordered by priority, i.e., the activities requiring resources are not equally important. This does not apply to the layout problem. All scale variables are equally important.

The layout problem needs a definition of optimality that is stricter than all three previous optimality definitions and that requires no a priori infor-mation. Such a definition of optimality has first been described in a paper concerning the optimal strategy choice in a two player zero sum game without prior information [11] and it has since been used in many different applica-tions contexts, e.g., bandwidth allocation and network planning [103, 101].

Definition 25. A vector a := (a1, . . . , an) is called lexicographically larger than b:= (b1, . . . , bn),a, b∈Rn, denoted a >lexb, if

∃i∈[1, n] :∀j ∈[1, i−1] :aj =bjai > bi

Definition 26. Given a vectora∈Rn, vectorhai:= (ah1i, . . . , ahni) is formed froma by rearranging the components of a in ascending order, i.e.,

∀i∈[1, n−1] :ahiiahi+1i

Definition 27. A vector a := (a1, . . . , an) is called lexicographically min-ordering larger than b:= (b1, . . . , bn), a, b∈Rn, denoted a >lex-mob, if

hai>lex hbi

Accordingly, for a set X ⊆ Rn, element xX is lex-mo maximal, denoted maxlex-mo x, if and only if 6 ∃y∈X :y >lex-mo x.

It follows that a lex-mo optimal solution is also a min-ordering optimal solution and a lex-mo optimal solution is always Pareto optimal [33].

The lexicographic min-ordering optimality criterion has a very intuitive meaning. The smallest scale variable is maximized, i.e., the least satisfiable constraint is as close to satisfaction as possible. Correspondingly, the smallest gap, i.e., the most constrained gap, is made as large as possible too, and the remaining gap space is further optimized. The second smallest scale variable is maximized, i.e., the second most constrained gap width is maximized as well and so on. The final lex-mo optimal solution value is again uniquely defined, i.e., all lex-mo optimal solutions x are equivalent in the sense that their permuted vectorshxi are the same.

Definition 28. Vector x:= (x1, . . . , xn), with vector components xi ∈Rmi, is called component-wise lex-mo maximal, or c-maxlex-mo x, if each xi is lex-mo maximal:

c-maxlex-mo x:= (maxlex-mo x0, . . . ,maxlex-mo xn).

Definition 29. The Scaled Layout Problem is a pair SLP = (P,SC) whereP is a page as of Def. 11 and

SC = (SCMin, SCMax, SCEqual, SCGap, SCClose)

is the list of scaled constraint sets defined above, in order of their priority.

The problem’s solution space is defined as

∆(SLP) = R|SCMin.S|+|SCMax.S|+|SCEqual.S|+|SCGap.S|+|SCClose.S|.

Anyx∈∆(SLP) can be written partitioned into its component scale variable vectors defined above as x= (~sMin, ~sMax, ~sEqual, ~sGap, ~sClose). The solution to a scaled layout problem is the vector

c-maxlex-mo x x∈∆(SLP) subject to [

SCi∈SLP.SC

SCi.S

and [

SCi∈SLP.SC

SCi.H

5.2. LAYOUT CONSTRAINTS 107

Im Dokument Sketching Slides (Seite 112-119)