• Keine Ergebnisse gefunden

plane, while realizing these directions on a discrete coordinate would require a grid that grows with the number of lines to be positioned.

Definition 11. We callSn=hO, Giasystem of finite disjunctive linear inequalites overRn with oracle valuesO, whereOis a finite set andGis a mappingG:O → hRmG×n,RmGi. We says =hx, oi ∈ hRn,Oiis a solution ofSniffG(o) = hAo, boiand Ao·x≤bo, using the component-wise interpretation of≤used in LP, i.e.,(x1, . . . , xn)≤(y1, . . . , yn)iffxi ≤yi for alli= 1, . . . , n.

Definition 12 (Qbasic). We call hRn,Oi the domain and S = {S1n, . . .} the set of symbols, whereby any symbolSinis a system of finite disjunctive linear inequalities sharing the same oracleOas defined above. A choice ofDandS is called the signature of our language. Given a signature, we define aQbasicformulaφas follows:

φ =def Sin| > | ⊥ | ¬φ|φ∧ψ.

Givenx∈Dand ao∈ O, we inductively define the notion of a formulaφbeing satisfied in hx, oias follows:

x, o |=Sn iffhx, oi is a solution ofSn (7.4)

x, o |=> always (7.5)

x, o |=⊥ never (7.6)

x, o |=¬φ iff hx, oi isnota solution ofSn (7.7) x, o |=φ∧ψ iffx, o|=φandx, o|=ψ (7.8) The other Boolean connectives are defined as usual.

Corollary 3. Deciding satisfiability of aQbasic formula is NP-complete

7.5 Encoding QCSP in Q

basic

This section provides an overview of how QCSP instances for several calculi can be encoded in Qbasic. We show how qualitative relations can be represented as systems of finite disjunctive linear inequalites. Due to space constraints, definitions of the individual calculi are omitted.

Refer to (Ligozat, 2011; Dylla et al., 2013) for definitions and further references.

7.5.1 Temporal Calculi

As pointed out in Jonsson and B¨ackstr¨om (1998), temporal relations can be described by linear inequalities. Strictness in the sense x < y can be resolved by introducing a fixedε >0and rewriting tox+ε≤ysince the qualitative temporal relations considered do not rely on absolute values.

7.5.2 Direction Calculi

Given a vector~v ∈R2, we call~vits left normal obtained by90 counter-clockwise rotation.

Given two (variable) pointsp, q ∈R2and a fixed orientation expressed as a vector~v ∈R2, we define the following constraints by translation toQbasic:

pleft~v q =def ~qT ·~v−~pT ·v≤0 (qleft ofp) pright~v q=def ~pT ·~v−~qT ·v≤0 (qright ofp) pfront~v q=def ~pT ·~v−~qT ·v≤0 (qin front ofp) pback~v q =def ~qT ·~v−~pT ·v≤0 (qbehindp)

(7.9)

The relationsleft~v,right~v,front~v,back~v are notpairwise disjoint(they overlap in one quadrant) but they arejointly exhaustive.

Theorem 3. Let φbe a propositional formula with atoms of the kind(xRy), whereRis a relation as defined above.

Letvar(φ)denote the number of (distinct) variables inφand letrel(φ)denote the number of (distinct) relations in φ, then φ can be translated into a Qbasic formula with signature D=R2 var(φ),|(S)|= rel(φ), andO =∅.

Proof. LetI :V → {1, . . . , n}be a bijective mapping between the variables and corresponding dimension inR2 var(φ). We define

Hi =def

0| {z }. . .0

2·(I(i)−1)

1 0 0. . . 0. . .0 0 1 0. . .

, Hi,j =def Hi

Hj

.

In the given formulaφ, replace all atoms(xi R~v xj)bySk= {},

Hi,jT AR~vHi,j,0

, where AR~vis the corresponding matrix to represent inequality as given by Eq. 7.9. This yields aQbasic formula with the signature,D=R2 var(φ),O ={}, andS as the set comprising allSk defined above.

Consider two arbitrarily fixed vectors~sand~tsuch that the counter-clockwise angle between

~sand~tdoes not exceed180. A (variable) pointqwith respect to a (variable) pointpis said to be inside the sector spanned by~sand~t, iff:

(pleft~s q)∧(pright~t q) (7.10) All cardinal direction calculi considered in the literature are either based on half-plane or sector membership, whereby half-plane normals and sectors are globally aligned to one of finitely many directions. This makes mapping QCSP instances toQbasicwith any of these calculi straightforward using either Eq. 7.10 orfront~nwhere~n denotes the respective half-plane normal. No oracle needs to be introduced. Since all these calculi are scale-invariant like temporal calculi, the same approach of introducingεcan be applied to represent trulyleft~v, right~v, etc. Applicability to the most important cardinal direction calculi is shown in Tab. 7.1.

7.5 Encoding QCSP inQbasic

Theorem 4. StarVars (J. H. Lee, Renz, and Wolter, 2013) can be represented byQbasic. Proof. StarVars, like Star (Renz and Mitra, 2004), employs sector-shaped spatial relations. The sectors in StarVars are rotated by an undetermined angle 22iNπ, i = 0, . . .2N −1for a fixed N. Choosing these angles as oracles, the construction of the Qbasic formula follows directly from (J. H. Lee, Renz, and Wolter, 2013) which also employs an LP algorithm to decide consistency.

Theorem 5. OPRAcan be mapped toQbasicif the domain of directions is restricted to a finite set.

Proof. Interpreted over finite domain of directions,OPRArelations can be represented as two conjuncts of StarVars relations (J. H. Lee, Renz, and Wolter, 2013).

7.5.3 Region Connection Calculus

In this work we only consider planar regions in form of simple, i.e, not self-intersecting polygons. We start with convex polygons since the mappings can then be generalized to non-convex polygons by considering a convex partitioning and disjunctively adjoining the linear programs.

First note that the relation saying that a point is located inside a simple convex polygon positioned at an unknown origin can be represented by a LP. This is due to the point-in-polygon test being based on half-plane membership tests which are linear inequalities and stay linear if the whole polygon is translated by unknownx, y. For convex polygons, point-outside-polygon can also be modeled by disjunctively adjoining the negated clauses of the point-in-polygon test.

Corollary 4. If two simple convex polygons do not share a common point, then there exists a line parallel to one edge which separates the space between both polygons.

This fact grants a mapping for the RCC relationdiscretesaying that regions do not share a common interior part. For simple convex polygons, we disjunctively choose one edge as the dividing line.

Let two simple convex polygonsP andQbe defined by verticesvP1, . . . , vPk andv1Q, . . . , vmQ in counter-clockwise orientation. We writeePi to refer to edgeviP, v(i+1) modP k anddPi to refer to directionvP(i+1) modk−viP and obtain:

(P drconvQ) =def_

~ ePi

^

vQj

(viP rightd~P i vjQ)

∨_

~ eQi

^

vjP

(viQrightd~Q

i vjP)

(7.11)

Analogously,dcconvcan be defined, except that touching points need to be excluded by using

¬(vPi leftvjQ)instead of(viP rightvQj ).

GivenP as above we can express that pointxlies on the edgeePi , i.e., betweenvPi andvi+1P , including both vertices.

(ePi contx) =def (vPi left(~vP

i+1−~vPi )x)∧(vPi right(~vP

i+1−~viP)x)

∧(viP front(~vP

i+1−~viP)x)∧(vi+1P back(~vP

i+1−~vPi) x), (7.12) External connection can be mapped toQbasicas follows:

(P tconvQ) =def _

ePi

h ^

vQj

(viP right(~vP

i+1−~viP)vQj )

∧_

vQj

(ePi contvjQ) i

(P ecconvQ) =def (P tconvQ)∨(QtconvP) (7.13) Theorem 6. RCC-5 and RCC-8 (Randell, Cui, and Cohn, 1992) can be mapped toQbasicfor the domain of simple (i.e., not self-intersecting) polygons in 2D space that involve at mostN vertices each.

Proof. We need to show how the relations of RCC-8 can be stated inQbasic, RCC-5 relations can then be obtained by disjunctive combinations, e.g., (PDRRCC-5Q) = (P DCRCC-8Q)∨ (PECRCC-8Q) . The vertex limit N is required to obtain finite formulae. For RCC-8, the

following mapping can be employed:

(P dcQ) =def ^

PC∈CP

^

QC∈CQ

(PC dcconvQC) (7.14)

(P ecQ) =def _

PC∈CP

_

QC∈CQ

(PC ecconvQC)

∧ ^

PC∈CP

^

QC∈CQ

(PC drconvQC) (7.15) Given three fresh variablesτ1, τ2, τ3denoting points:

(P poQ) =def1insideP)∧(τ1 insideQ)

∧ (τ2insideP)∧ ¬(τ2 insideQ)

∧ ¬(τ3insideP)∧(τ3 insideQ)

(7.16) For containment it is not sufficient that all vertices of one polygonP are inside another polygon Q, see Fig. 7.2. LetIQdenote edges introduced by the convex partitioning. If an edgeEofP