A polynomial time algorithm to detect PQI interval orders

Let S be a P QI preference structure on a ﬁnite set A , where the relations P , Q , I stand for “strict preference”, “weak preference” and “indiﬀerence” respectively. Two speciﬁc preference structures: P QI semi orders and P QI interval orders, have been considered and characterised recently in such a way that is possible to associate to each element of A an interval such that P holds when one interval is completely to the right of the other, I holds when one interval is included to the other and Q holds when one interval is to the right of the other, but they do have a non empty intersection ( Q medelling the hesitation). While the detection of a P QI semiorder is straightforward, the case of the P QI interval order is more diﬃcult as the theorem of existence consists in a second-order formula. The paper presents an algorithm for detecting a P QI interval order and demonstrates that it is backtracking free. This result leads to a matrix version of the algorithm which can be proved to be polynomial.


Introduction
In preference modelling and decision support we often have to compare intervals instead of discrete values (see Fishburn, 1985, Pirlot and. This is due to the unavoidable lack of precision and certainty in the evaluation of alternatives. The conventional model adopted in order to compare two intervals considers that "x is preferred to y" (P (x, y)) iff the interval associated to x is completely to the "right" (in the sense of the line representing the reals) of the interval associated to y. In all other cases "x is indifferent to y". Such a model (where indifference is not transitive) may conceal the fact that "x being to the right of y" (the intersection being not empty) is a situation intuitively different from the case where one interval (let's say the one of x) is included in the other (let's say y). The second case can be considered a "sure indifference" as much as can be considered as "sure preference" the case P (x, y). Under such a perspective the first case is a situation of hesitation between preference and indifference which merits to be considered separately (see Tsoukiàs and Vincke, 1997). We may denote such a situation as "weak preference" and represented it as Q(x, y).
The problem is to give the necessary and sufficient conditions for which a preference structure characterised by the presence of the relations P , Q and I may admit a representation by intervals as the one previously discussed. Such a problem was considered open for a long time (see Vincke, 1988) and has been solved by Tsoukiàs and Vincke, 1999, where an existential theorem is given. The operational problem is how to detect if a given P QI preference structure satisfies the conditions of the theorem. The problem is not an easy one because the theorem consists in a second order formula which could be undecidable. Actually, while trying to verify the conditions of the theorem there is space for some arbitrary decisions resulting in a tree defined by the branches created by each such arbitrary choice. Intuitively, if after such a choice an inconsistency occurs a backtracking should be done in order to try a new branch. This may result in a problem at least in NP.
The paper is dedicated to present an algorithm for detecting the satisfaction of the theorem by a given P QI preference structure which is polynomial. The paper is organised as follows. Section 1 presents the basic definitions and the problem to solve. Section 2 gives two theorems, the first giving the necessary and sufficient conditions for a P QI preference structure to have an interval representation and the second giving a different characterisation, which is less intuitive, but which will be used in order to build the detection algorithm. Section 3 gives the algorithm in a procedural way by which it is possible to demonstrate that it is "backtracking free". Section 4 presents a "matrix implementation" of the algorithm enabling to demonstrate that it is polynomial. Some conclusions are given at the end of the paper. Appendix A contains the demonstrations of the propositions used in the proof of Theorem 3.1 as well as the algorithm 3.1.

Problem setting
In the following we will use the following notation for any binary relation (S, T, · · ·) on a finite set A: We first give the conventional definition and theorem concerning interval orders. Definition 1.1 (see Roubens and Vincke, 1985) Given P an asymmetric binary relation and I a reflexive and symmetric relation, P ∪ I being complete, the preference structure P, I is an interval order iff there exist two real valued functions l and r, such that ∀ x, y ∈ A: -i. r(x) > l(x); -ii. P (x, y)⇔l(x) > r(y); -iii. I(x, y)⇔r(y) > l(x) and r(x) > l(y); In conventional interval orders when comparing two intervals two situations are considered: -one interval is completely to the right of the other (strict preference); -there is a non empty intersection of the intervals (indifference). Theorem 1.1 A P, I preference structure on a finite set A is an interval order iff P.I.P ⊂ P .
We now give the definitions of P QI preference structure and P QI interval order. Definition 1.2 (see Roubens and Vincke, 1985) A P QI preference structure on a finite set A is a triple of binary relations P, Q, I , such that: -i. I is reflexive and symmetric; -ii. P and Q are asymmetric; -iii. I ∪ P ∪ Q is complete; -iv. P, Q, I are mutually exclusive.
A P QI interval order extends conventional interval orders in the sense that, while comparing two intervals three possibilities are considered: -one interval is completely to the right of the other (strict preference); -one interval is to the right of the other, but they have a non empty intersection (weak preference); -one interval is included in the other (indifference).
Our problem is double: define the necessary and sufficient conditions for which a P QI preference structure is a P QI interval order and define an algorithm which operationally verifies if the conditions of the theorem are satisfied by a given P QI preference structure.

PQI interval orders
The basic theorem which gives the necessary and sufficient conditions for a P QI preference structure to be a P QI interval order is the following. Theorem 2.1 A P QI preference structure on a finite set A is a P QI interval order iff it exists a partial order I l such that: Proof See Tsoukiàs and Vincke, 1999.
It is easy to see that the theorem is a formula in a second order logic (a formula where predicates can be variables). Generally the satisfaction of second order formula can be undecidable. Moreover the theorem does not give a constructive procedure for verifying its satisfaction. In the following we give a second theorem, equivalent to theorem 2.1, which enables to define an algorithm detecting if a P QI preference structure is a P QI interval order.
Theorem 2.2 A P QI preference structure on a finite set A is a P QI interval order iff it exists a partial order I l such that: Proof See Tsoukiàs and Vincke, 1999.
We remind to the readers that a partial order is a reflexive and transitive binary relation.

The algorithm
Let S be a P QI preference structure on a finite set A. The algorithm will first verify condition ii and then construct I l by applying directly conditions iii to vii of theorem 2.2. By definition, I r = I −1 l , i.e., the construction of I l implies that of I r . If the algorithm is able to build a relation I l satisfying conditions of the theorem 2.2, then the P QI preference structure under investigation is a P QI interval order. If on the other hand it fails, then the P QI preference structure under investigation is not a P QI interval order. Failure of the algorithm can occur either because condition ii is not satisfied or because during the construction of I l a contradiction occurs. A contradiction is defined as either a violation of the mutual exclusion of P, Q, I (I l (x, y) is established for (x, y) ∈ P ∪ Q ∪ P −1 ∪ Q −1 ) or a violation of the asymmetry of I l ( both I l (x, y) and I l (y, x) are established). The demonstration of formal correctness of the algorithm is in Appendix A.
Step 1: if not (P.Q ∪ Q.P ∪ P.P ⊂ P and Q.Q ⊂ P ∪ Q) then failure; Step 7: If there is one I(x, y) not yet established as I l or I r , choose one of them and set it as I l (x, y). Then return to 5. Otherwise stop.
Steps 1 to 4, are deterministic, in the sense that each I l established is mandatory. If a contradiction occurs, the algorithm fails. Steps 5 and 6 however, use already established I l in order to establish further I l . The problem arises from Step 7 where I l is arbitrarily chosen. When the algorithm goes back to Step 5 to continue with establishing I l , if a contradiction occurs, intuitively, it should backtrack to the last I l (x, y) established, reverse it to I l (y, x) and try again. In other terms the algorithm appears to have to explore a "tree structure" defined by the branches created by each arbitrary choice. In such a case the risk is to have to make an exhaustive research of the whole "tree".
In the following we will demonstrate that the algorithm previously presented is "backtracking free". In other words, any contradiction implies the non-existence of a P QI interval order on A and the algorithm can stop immediately without backtracking. Actually any failure in steps 1 to 6 will induce the algorithm to end with a negative answer. This is the reason for which the algorithm is presented without backtracking.
Theorem 3.1 The algorithm 3.1 is backtracking free.
Proof We elaborate the demonstration observing how the setting of I l (x, y) (steps 5, 6) is propagated and analyzing contradictory situations. The demonstration consists in decomposing the problem in smaller cases and showing for each of them that when a contradiction occurs there is no backtracking necessity and the algorithm fails (the P QI preference structure is not a P QI interval order).
Before reaching step 7 the first time, the process is deterministic, we can therefore construct the graph G 0 = (A, V 0 ) where A is the usual set of objects on which the P QI preference structure applies and V 0 = P ∪ Q ∪ I ∪ I l where I consists of (x, y) which are not yet set. The undirected graph associated to G 0 is complete and all its arcs can be directed except the ones in I. In the following we denote as a "triangle" a set of three elements in A (x, y, z) such that xΦyΨzΘx, where Φ, Ψ, Θ are any among P, P −1 , Q, Q −1 , I l , I −1 l , I. Denote as X-arc any arc representing relation X, X being one of P, Q, I, I l . Denote as I-path a path where each of its arcs is an I-arc. Consider then the partial graph G * = (A, V 1 ) where V 1 = {(x, y)|x = y, ∃ I-path from x to y}. Proposition 3.2 G * consists of connected components which: i. undirected associated graphs are complete; ii. do not contain any P -arc; iii. are closed to the propagation of the setting of I l .
We have proved that G * consists of connected components in which the propagation of the setting of I l (x, y) is limited. Each component contains only Q-or I-or I l -arcs, while P -arcs exist only among such components. Therefore, we can limit ourselves in analyzing only one connected component, denoted by G 1 = (A 1 , V 1 ).
Let (x * , y * ) be the I-arc arbitrarily chosen in step 7 to become an I l -arc. Denote as I k l the set of I-arcs set in I l in the current step and as I K l the cumulative set of I-arcs set in I l until the current step included. We have that I K l = I k l ∪ I K−1 l . Conventionally, in step 5, (x * , y * ) is added to I k l ,i.e., as it is set in the step 5. Denote as a q-path a path whose arcs are Q or Q −1 ones. In the set A, let us consider now the following equivalence relation: Θ(x, y) ⇔ ∃ a q-path from x to y and use X, Y, Z to denote equivalence classes. Therefore we can see graph G 1 as composed by equivalence classes of nodes each of which contains only Q-, I-and I l -arcs. Further on among such equivalence classes only I-and I larcs do exist.

Proposition 3.4 In step 5 i -the propagation of
ii -when X = Y ,the propagation of I l covers the whole set X × Y . iii -If (x * , y * ) ∈ X × X then I k l ⊂ X × X iv -If (x * , y * ) ∈ X × Y, X = Y then I k l = X × Y . v -Whatever (x, y) is chosen to be set in I l in Step 5 the result is the same. vi -If I l (y * , x * ) is chosen instead of I l (x * , y * ) then all the settings in this step will be reversed.

Proposition 3.4 states that, during the k-th iteration of the algorithm,
Step 5 sets to I l some I-arcs included in an equivalence class (of relation Θ) and all I-arcs among the equivalence classes. Consider now Step 6. In each application of step 6, setting I l (x, z) from I l (x, y) and I l (y, z), implies that at least one arc, let's say (x, y), has to be set during, either this step, or the two last steps 5,7. In a formal notation we have: These results show that if we choose an arc (x * , y * ) to set in I l , if it is inside one equivalent class it does not propagate I l outside this class, while if it connects two different classes, it does not propagate I l into any class. Furthermore, as the algorithm has passed through steps 5, 6 before the establishment of G 1 at least once, all the arcs between two classes X, Y are of the same type (either I-arcs or I l -arcs). Therefore, the problem can be further decomposed into two sub-problems: a) -Outside all the equivalent classes, we consider the same problem with G 1 replaced by G 2 = (A 2 , V 2 ) where A 2 is the quotient set A Θ and V 2 consists of two types of arcs: I(X, Y ) if ∃(x, y) ∈ X × Y such that I(x, y) holds, and I l (X, Y ) if ∃(x, y) ∈ X × Y such that I l (x, y) holds. b) -Inside each equivalent class, we consider the same problem with G 1 replaced by The sub-problem a) is trivial, as the graph G 2 contains only I or I l arcs, furthermore, the part of G 2 covered by I l -arcs is already I l transitively closed since the algorithm has already gone through Step 6. The problem is reduced to the construction of a linear order. Therefore, we have to deal only with the sub-problem (b).
We have to demonstrate now that the algorithm is backtracking free on G 3 where the arcs are Q, I l , I and there is a q-path connecting any two different nodes. We consider now the possible situations where a contradiction may occur.
if (x, y) and (y, z) are set in this step, then so is (x, z).
N.B. We may emphasise that, while in Step 5, I k l (x, y)∧I K−1 l (y, z) does not necessarily imply I k l (x, z).
Proposition 3.7 In step 5, an I l -circuit occurs only with a contradiction.
Proposition 3.8 If the first contradiction occurs at step 6, then there must be an I l circuit at the end of step 5 (an I K−1 l circuit).
Proposition 3.9 If the first contradiction occurs at step 5, then the problem has no solution.
From Proposition 3.8 if a contradiction occurs in Step 6 there is an I l circuit at Step 5. From Propositions 3.6 and 3.7 if such a circuit exists in Step 5 it has to exist also a contradiction in Step 5. And from Proposition 3.9 if a contradiction occurs at Step 5, the problem has no solution and it is not necessary to make any backtracking. And this concludes our demonstration.

Matrix version of the algorithm
From the previous discussion it is easy to see that the critical part of the P QI graph to analyze is the G 3 graph, so we may study complexity with respect to this subgraph. In the following we give a way to implement the algorithm and discuss its complexity. Let A = {a 1 , a 2 , ...a n } and let P , Q, I, L be n × n matrixes representing relations P , Q, I, I l respectively, where: X ij = 1 ⇔ a i Xa j , otherwise X ij = 0, X being one among P , Q, I, I l . Proof The algorithm presented in the previous section can be represented in the following way (including some small variations discussed immediately after): Step 1: P ij + P jk ≤ 1 + P ik , P ij + Q jk ≤ 1 + P ik , Q ij + Q jk ≤ 1 + P ik + Q ik ∀ i, j, k = 1..n; Step 2: I ij = P ik = Q jk = 1 ⇒ L ij = 1 ∀ i, j, k = 1..n; Step 3: I ij = P ki = Q kj = 1 ⇒ L ij = 1 ∀ i, j, k = 1..n; Step 4: P ij = I ik = I kj = 1 ⇒ L ik = L kj = 1 ∀ i, j, k = 1..n; Step 5: Q ij + Q ji = I ik = I kj = 1 ⇒ L ik = L kj ∀ i, j, k = 1..n; Step 6: L ij = L jk = 1 ⇒ L ik = 1 ∀ i, j, k = 1..n; Step 7: For I(x, y) not yet established as I l or I r , choose arbitrarily I l (x, y). If the I l established belongs to an equivalence class established in Step 5, put all the elements of the class equal to 1. Return to 6 (instead of 5).
A critical step in this algorithm is step 5 since it introduces implicitly a recursive establishment of I l . In order to avoid an infinite recursion and the associate contradictions it is necessary to "fix" I l as soon as it is generated by step 5 so that only I(x, y) which are not yet established may still be considered in the recursive application of step 5. This is possible partitioning the set of non zero elements of the matrix I into classes which will have the same value of L ij because of step 5. Then as soon as one element of one of these classes turns to 1, the whole class will turn to 1. Under such an adjustment the following positive consequences hold: -if there is no solution then a contradiction in establishing an I l will appear before step 6; -after step 7 you just have to return to step 6.
We can now discuss complexity. Steps 1 to 4 are obviously in O(n 3 ) as step 6 (transitive closure) is.
Step 5 is in O(n 5 ) as can be seen by the following implementation (remark that in the worst case n = |G 3 |): Furthermore it is easy to see that the decomposition of the P QI graph in G 1 and its connected components, the decomposition in G 2 and G 3 and the construction of the linear order in G 2 are all in polynomial time. Therefore the whole algorithm is in polynomial time.

Conclusions
The paper presented an operational solution to how a P QI preference structure on a finite set A can be checked to be or not a P QI interval order. In other words verify if it is possible to associate to each element of A an interval such that if the interval associated to x is completely to the right of the interval associated to y, then x is strictly preferred to y, if one interval is included to the other, then x is indifferent to y and if the interval associated to x is to the right of the interval associated to y, their intersection being not empty, then x is weakly preferred to y.
In the paper the necessary and sufficient conditions for such a case are introduced and an algorithm for the satisfaction of such conditions is presented. We first demonstrate that the algorithm, although appears that has to explore a tree generated by branches of arbitrary choices, is backtracking free and then we demonstrate that runs in polynomial time. We consider such a result very promising, since it enables an efficient check of the existence of P QI interval orders which are very common in many different cases, including preference medelling and temporal logic. In fact, P QI interval orders are very useful in representing discrete states of preference hesitation. Being able to detect if a P QI preference structure is a P QI interval order allows to know if its numerical representation is meaningful. Further on, since we conjecture that this result can be generalised in the case of preference structures with multiple thresholds, the existence of an efficient algorithm allows to hope for an easy extension of this theory in the case of multiple interval orders, a long time open problem in preference modelling.
If Q(y 2 , t), we have Q(y 2 , t)∧I k