(* The Transitive Closure of a Preference Relation *) rdMatrix[p_, x_] := Module[{i, j, n}, n = Length[x]; Table[If[p[[i]].x[[i]] >= p[[i]].x[[j]], 1, 0], {i, 1, n}, {j, 1, n}]] tClosure[m_] := Sign[MatrixPower[m, Length[m]]] p = {{1, 2, 8}, {4, 1, 8}, {3, 1, 2}}; x = {{2, 1, 3}, {3, 4, 2}, {2, 6, 2}}; m = rdMatrix[p, x] tClosure[m] (* Checking GARP *) ObsRP[i_, m_] := Complement[ Table[If[m[[i, i]] > 0, j, i], {j, 1, Length[m]}], {0}] consEfficiency[p_, x_] := Module[{m, n}, m = tClosure[rdMatrix[p, x]]; n = Length[x]; Table[Min[x[[ObsRP[i, m]]].p[[i]]/p[[i]].x[[i]]], {i, 1, n}]] p = {{1., 2.}, {2., 1.}}; x = {{1., 2.}, {2., 1.}}; consEfficiency[p, x]