Contents lists available atScienceDirect
Artificial
Intelligence
www.elsevier.com/locate/artint
Acyclic
orders,
partition
schemes
and
CSPs:
Unified
hardness
proofs
and
improved
algorithms
✩
Peter Jonsson,
Victor Lagerkvist
∗
,
George Osipov
DepartmentofComputerandInformationScience,LinköpingsUniversitet,CampusValla,Swedena
r
t
i
c
l
e
i
n
f
o
a
b
s
t
r
a
c
t
Articlehistory: Received29June2020
Receivedinrevisedform25January2021 Accepted12April2021
Availableonline15April2021 Keywords:
Constraintsatisfactionproblems Infinitedomains
Partitionschemes Lowerbounds
Many computational problems arising in, for instance, artificial intelligence can be realized as infinite-domain constraint satisfaction problems (CSPs) based on partitionschemes: a set of pairwise disjoint binary relations (containing the equality relation) whose union spans the underlying domain and which is closed under converse. We first consider partition schemes that contain an acyclic order and where the constraint language contains all unions of the basic relations; such CSPs are frequently occurring in e.g. temporal and spatial reasoning. We identify properties of such orders which, when combined, are sufficient to establish NP-hardness of the CSP and strong lower bounds under the exponential-time hypothesis, even for degree-bounded problems. This result explains, in a uniform way, many existing hardness results from the literature, and shows that it is impossible to obtain subexponential time algorithms unless the exponential-time hypothesis fails. However, some of these problems (including several important temporal problems), despite likely not being solvable in subexponential time, admit non-trivial improved exponential-time algorithm, and we present a novel improved algorithm for RCC-8 and related formalisms.
©2021 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/).
1. Introduction
In thisarticlewestudy the complexity ofinfinite-domainconstraintsatisfactionproblems over partitionschemes. Inthis framework onecanformulate manynaturally occurringreasoningproblemsinartificialintelligencesuch asAllen’sinterval algebra and theregionconnectioncalculus.Weidentifysharedpropertiesamongtheseproblems,basedontheexistence of acyclicorders,andusethesepropertiestoprovideageneralNP-hardnessresultandprovestronglower boundsunderthe exponential-timehypothesis.Importantly,tothebestofourknowledge,thisisthefirstlowerboundunderthe exponential-time hypothesisforproblemsofthisform.Motivatedby theselowerboundswealsoturntothe problemofconstructing improvedalgorithmsforCSPsoverpartitionschemes,withaparticularfocusontheregionconnectioncalculus.
1.1. Background
The constraintsatisfactionproblem over a constraintlanguage
(CSP
()
) is thedecision problemofverifying whether a set of constraints based on the relations inadmits a satisfying assignment. For finite domains the complexity of
✩ Partsofthisarticleappearedintheproceedingsofthe43rdInternationalSymposiumonMathematicalFoundationsofComputerScience(MFCS-2018).
*
Correspondingauthor.E-mailaddresses:peter.jonsson@liu.se(P. Jonsson),victor.lagerkvist@liu.se(V. Lagerkvist),george.osipov@liu.se(G. Osipov). https://doi.org/10.1016/j.artint.2021.103505
0004-3702/©2021TheAuthors.PublishedbyElsevierB.V.ThisisanopenaccessarticleundertheCCBYlicense (http://creativecommons.org/licenses/by/4.0/).
CSP
()
iswell understood dueto therecent dichotomy theoremseparating tractable fromNP-complete problems [9,42], but for infinite domains the situation differs markedly. This class of problems includes both undecidable problems and NP-intermediateproblems,andit isthereforecommontoimpose additionalassumptions ontheallowed constraints.The predominant method has been to fix a constraint language, usually satisfying certain model-theoretic properties, and analysethecomplexity ofCSPsoverfirst-orderreductsof
.Traditionally,thishasalsobeenthecaseforCSPsarisingfrom artificialintelligence,e.g.temporalandspatialreasoningproblems,albeitusuallywithweakerclosureconditions.
Motivatedbyproblemsofthisform,westudythecomplexityofinfinite-domainCSPsoverpartitionschemes.Apartition scheme [29] isasetofpairwisedisjointbinary relations
B
overadomain D suchthatR∈BR=
D2,theequalityrelation is a member ofB
, andthe converse of R is inB
for every R∈
B
. Due to their capability of modellingmany different kinds ofqualitativereasoning problems,partition schemesare thede facto standardforCSPsin theartificialintelligence community [13].Givenapartitionscheme,thepredominantwayofformingnewrelationsistoallowunionsoftherelations inB
, and we letB
∨= denote this set. Equivalently, each relation inB
∨= can be defined as a disjunction of the form B1(x,
y)∨
B2(x,
y)∨ · · · ∨
Bk(x,
y)forsome{
B1,
. . . ,
Bk}
⊆
B
,andthesetB
∨= thuscontains allrelationsdefinableinthis way.Famous AIexamples offormalismsbasedonpartition schemesincludeAllen’sintervalalgebra,the regionconnection cal-culus (RCC-8), and therectanglealgebra.For moreexamples, see e.g. the survey by Dylla et al. [14]. CSP
(B
∨=)
problems havebeenproventobeNP-hardformanychoicesofB
.Theproofshaveutilisedvariousreductionsfromvariousproblems, butthere has not beena clearexplanation why themajority ofthem are NP-hard.Thus, doesthere exist one reduction applicable to every partition scheme?Or does oneneed separate proofsfor(e.g.) RCC-8 andAllen’sinterval algebra, and thenperformanexhaustivecaseanalysisonallpossiblesetofbaserelationsB
?Thus,while quiteabitisknownaboutspecificpartition schemes,itissafetosaythatwe lackamoregeneral under-standing ofwhy theseproblemsare NP-hard.Whenturningto questionsofmorefine-grainedcomplexitythesituationis evenmoredire.Forexample,canCSPsoverpartitionschemesbe solvedroughlyasfastasBooleansatisfiabilityproblems, i.e.,inO
(
2n)
time?Oratleastasfastasafinite-domainCSP,i.e.,O(c
n)
forsomec≥
1?Classifyingpartitionschemes accord-ingtothishighly“fine-grained”levelofcomplexityisaveryhardopenproblemwhichweshouldnothopetoimmediately resolve,andasafirstsanitycheckitiscommontofirstruleout theexistenceofsubexponential algorithms,i.e.,algorithms witha runningtime of2o(n).Naturally,thiscannot be done unconditionally,anda popularassumption inthiscontextistheexponential-timehypothesis (ETH)whichstatesthatthe3-SATproblemcannotbesolvedinsubexponentialtime.Despite thefactthat CSPsoverpartition schemesareamongthemostfrequentlystudiedCSPsinartificialintelligence,itisfairto saythat such ETH-basedlower boundshavelargely beenneglectedby both theartificialintelligencecommunityandthe CSPcommunity,andtothebestofourknowledgethereare no concretelowerboundsundertheETH fortheseproblems. There area fewreasonsforthis. First,significanteffortshavebeenmadeto solvehardreasoning problemswithefficient heuristics [35],which are typically difficultto analyse rigorouslyevenif they work well forcertain real-world instances. Second, existinglower boundsare typicallybasedonsize-preservingreductionsfromSAT-like problemswhereoneneeds theabilitytoexpressdisjunctiveclauses,whichisdifficulttoexpresswithpartitionschemes.Tothebestofourknowledge, theonlyconcretelowerboundsforaCSPoverapartitionschemeistheboundbyJonssonandLagerkvist [25] whichrelates the complexity ofAllen’sinterval algebrato thecomplexity ofthe ChromaticNumberproblem(butnot underthe more
commonassumptionETH).
1.2. Ourresults
Ourfirst step(inSection 3) istonote that themajorityofpractically relevantpartition schemescontain acyclicorders satisfyingcertainproperties,whichwe inthisarticlerefertoasunboundedtotalorders,in-forks,out-forks,andno-forks.For brevity, we typically refer to these conditions as C1
,
C2,
C3 and C4. We provide several examples fromthe literature ofpartition schemescontaining acyclicorders ofthisform, e.g.,Allen’sintervalalgebra,theunit intervalalgebra, andRCC-8. While thereis nogeneralrecipe forprovingthat a partition schemecontains an acyclicorderof theabove form, all the examplesthatwehavetriedshowthatitinpracticeisratherstraightforward.
InSection4weturntotheproblemofprovinglowerboundsforCSPsoverpartitionschemescontaininganacyclicorder satisfyingC1–C4.Throughasophisticatedreductionweprovethatnoproblemofthisformcanbesolvedinsubexponential
time(undertheETH),eveninthestructurallyrestrictedcasewhereavariablemayoccurinatmost3constraints.Thecase whenavariablemayoccurinatmost2constraintsishandledinSection4.3whereweestablishthatallCSPsofthisform aretractableifthetemplateinquestionis
ω
-categorical.In particular, our results implythat CSPs over partition schemes containing acyclic orders of thisform are NP-hard. Hence, wesucceedbothinfindingauniformhardnessproof,andwithproving lowerboundsundertheETH.Importantly, ourlower boundsarethefirst ETH-basedlowerboundsforCSPsofthisform. Itmightalsobeinteresting toobservethat wedonotneedanystrongmodel-theoreticproperties,e.g.
ω
-categoricity,whichisotherwisecommonforinfinite-domain CSPs. The reduction establishingNP-hardness isalso interesting to compareto theprocedure by RenzandLi [36] which takesa partition schemeasinputandtriestoprove NP-hardness.Oneimportantdistinction isthat ourresultprovidesa concretesource ofNP-hardnesswhilethealgorithminRenzandLigivesnosuch insight.Moreover,thisprocedureisnot complete,andisduetocomputationalconstraintsnotapplicabletoe.g.therectanglealgebra,whileitisastraightforwardtasktoprovethatthisalgebrafallswithinthescopeofourresult.Hence,ourstudyoffersamoretheoreticalexplanationof whysomanynaturallyoccurringCSPsoverpartitionschemesarecomputationallyhard.
Onewayofinterpretingtheseresultsisthat CSP
(
B
∨=)
,whenB
isapartition schemecontainingan acyclicorder sat-isfyingtheaforementioned properties,isfarfrombeingpolynomial-timesolvable:thereisaconstant c>
1 suchthat the problemcannot besolved in O(c
n)
time.An immediateconsequenceoflowerboundsofthisformisthatwe can imme-diatelyruleoutcertainkindsofalgorithmsforCSP(
B
∨=)
,e.g.algorithmsbasedongraph-decompositionandk-consistency, whichtypicallyruninsubexponentialorpolynomialtime.Itisofcoursetemptingtostrengthenourlowerboundeven fur-thersincethecurrentbestknownalgorithmforCSP(B
∨=)
foranarbitrarypartitionschemeB
runsin2O(n2)time,ifCSP
(B)
ispolynomial-timesolvable [25,39].Improvementsto2O(n log n)arepossibleforcertaintemporalCSPs andforAllen’sintervalalgebra [25],sothereisreasonforbeingoptimistic.WeattackthisquestioninSection5wherewebeginbypresentingan 2O(n)timealgorithmforthedegree-boundedcase,andthenpresentanovel2O(n log n)timealgorithm forRCC-8.Thisisthe firstexampleofanon-trivialspatialpartitionschemewhoseCSPcanbesolvedin2o(n2)
time.Classifyingpartitionschemes admittingimprovedalgorithmsofthisformisaninterestingopenquestion,whichwediscussingreaterdetailinSection6, amongotherunresolvedquestions.
2. Preliminaries
In this section we introduce the necessary prerequisites concerning constraint satisfaction problem and partition schemes.WebeginbydefiningtheCSPproblemwhenitisparameterizedbyasetofrelations.
Definition1.Let
beasetoffinitaryrelationsoversomesetD ofvalues.Theconstraintsatisfactionproblem over
(CSP
()
) isdefinedasfollows:Instance: Aset V ofvariablesandasetC ofconstraints oftheformR(v1
,
. . . ,
vk)
,wherek isthearityof R,v1,
. . . ,
vk∈
V andR∈
.Question: Isthereafunction f
:
V→
D suchthat(
f(v
1),
. . . ,
f(v
k))
∈
R forevery R(v1,
. . . ,
vk)
∈
C ?The set
iscalleda constraintlanguage,and thefunction f is sometimescalleda satisfyingassignment, ora solution. Importantly,thedomainD isallowedtobeinfinite,andCSPsoverconstraintlanguagesoverinfinitedomainsaretypically calledinfinite-domainCSPs, tocontrastthem withfinite-domain CSPs.Givenan instance I of CSP
()
we write||
I||
forthe numberofbitsrequiredtorepresentI.Wewilloccasionallyencounterbounded-degree CSPinstances.Let(V
,
C)
denotean instance ofCSP()
. Ifa variable x occurs in B (distinct)constraints in C ,then we say that thedegree of x is B. Welet CSP()
-B denote theCSP()
problemwhereeachvariableintheinputisrestrictedtohavedegreeatmost B.Notethatif(V
,
C)isaCSP()
-B instance,then|
C|
≤
B· |
V|
,implyingthat thenumberofconstraintsislinearlyboundedwithrespect tothenumberofvariables.Wearenowreadytointroducepartitionschemes [29].Let
B = {
B1,
. . . ,
Bm}
beaconstraintlanguageconsistingofbinary relations over a domain D. We saythatB
is jointlyexhaustive ifB =
D2 andthatB
ispairwisedisjoint if Bi∩
Bj= ∅
wheneveri=
j.WesaythatB
isapartitionscheme if(1)B
isjointly exhaustiveandpairwisedisjoint,(2)eqD= {(
x,x)|
x∈
D}
∈
B
,and(3)forevery Bi∈
B
,theconverserelation Bi (i.e. Bi= {(
y,x)|
(x,
y)∈
Bi}
)isinB
.WedefineB
∨=tobethe setofall unionsofrelationsfromB
.Notethat eachsuch relationisstillbinary,i.e.,ofarity2.Equivalently,each relation inB
∨= canbeviewedasadisjunctionB1(x,
y)∨
B2(x,
y)∨ · · · ∨
Bk(x,
y)forsome{
B1,
. . . ,
Bk}
⊆
B
.Wesometimesabuse notationandwrite(B
1,
. . . ,
Bk)
todenotetherelation B1∪ · · · ∪
Bk.ThesetB
∨=andtheproblemCSP()
where⊆
B
∨= aretypicalobjectsthatarestudiedintheartificialintelligenceliterature.Forexample,ithasbeencommontousearelation algebraA
asa startingpoint andthen defineanetworksatisfactionproblem overA
,whichinournotation isnothingelse thantheCSPoverasetofbinaryrelations.NotethatifCSP(
B)
ispolynomial-timesolvable,thenCSP(
B
∨=)
isamemberof NP.Example1.Allen’sintervalalgebra [2] isawell-known formalismfortemporalreasoningwhereone considersrelations be-tween intervalsoftheform I
= [
I−,
I+]
,where I−,
I+∈ R
is thestart andendpoint, respectively.In Allen’salgebraone canforinstancedescribethatoneintervalbeginsbeforeanotherinterval,andoneexpresssuchrelationsintermsofa par-titionschemeconsistingof13basicrelations(seeTable1),andthenformmorecomplicatedrelationsbytakingtheunion ofthe basicrelations.IfweletA
denotethe setof13basicrelationsin Allen’salgebra, thenCSP(
A
∨=)
isan alternative formulationofthenetworkconsistencyproblemoverAllen’salgebra.NotethatCSP(A
∨=)
isaninfinite-domainCSPsince theunderlyingdomainofrealintervalsisintrinsicallyinfinite.An extension of the interval algebra is the so-called rectanglealgebra [19,32]. Here, one considers relations between rectanglesintheplanebyextendingthebasicrelationsintheintervalalgebratotheprojectionsofarectangleontothe x-andy-axis,respectively.Inotherwords,givenr,s
∈
A
andtworectanglesrepresentedbytheintervalsIx,
Iy, Jx,
Jywemay definetherelationr⊕
s intherectanglealgebraholdingifIx(r)
Jx andIy(s)
Jy.Example2.RCC-8 [34] isaformalism forqualitativespatial reasoningwherethe basicobjects(referredto asregions)are non-empty regularclosedsubsetsofatopologicalspace. Theregions donothavetobeinternally connected,thatis,they
Table 1
ThethirteenbasicrelationsinAllen’sintervalalgebra.The endpointrelations I−<I+ and J−<J+ thatarevalidfor allrelationshavebeenomitted.
Basic relation Example Endpoints x precedes y p xxx I+<J− y preceded by x p−1 yyy x meets y m xxxx I+=J− y met-by x m−1 yyyy x overlaps y o xxxx I−<J−<I+, y overl.-by x o−1 yyyy I+<J+ x during y d xxx I−>J−, y includes x d−1 yyyyyyy I+<J+ x starts y s xxx I−=J−, y started by x s−1 yyyyyyy I+<J+ x finishes y f xxx I+=J+, y finished by x f−1 yyyyyyy I−>J− x equals y ≡ xxxx I−=J−, yyyy I+=J+ X Y EQ(X,Y). X Y PO(X,Y). X Y NTPP(X,Y). Y X NTTP−1(X,Y). X Y EC(X,Y). X Y DC(X,Y). X Y TPP(X,Y). Y X TPP−1(X,Y).
Fig. 1. Illustration of the basic relations of RCC-8 with two-dimensional disks.
may consist ofdifferent disconnected pieces. RCC-8 contains eight basic relations: EQ (equal), PO (partial overlap), DC (disconnected), EC (externallyconnected), NTPP (non-tangentialproperpart),itsconverseNTPP−1, TPP (tangentialproper part) andits converse TPP−1. SeeFig. 1for examples.RCC-5 is a variantof RCC-8 whereone is not able todistinguish regions fromtheir topologicalclosure, i.e.the distinction betweenboundary points andinterior points is ignored. Thus, the disconnectednessrelations DC and EC are replacedby DR
=
DC∪
EC, thetangential andnon-tangentialproper part relations TPP and NTPP arereplacedbyPP=
TPP∪
NTPP,and PP−1isdefinedanalogously.Last,wedefinetwosatisfiabilityproblemsusefulinthecontextoflowerbounds,whichwewillreturntoinSection4.1. If V isasetofvariablesand f a functionfromV to
{
0,
1}
,thenwedefine thefunctionhf ashf(x)
=
f(x)
andhf(
¬
x)=
1−
f(x)
foranyx∈
V .Fork≥
1 wedefinethek-satisfiability (k-SAT)problemasfollows.Instance: Asetofvariables V andasetclausesoftheform
(
1∨ . . . ∨
k)
,wherei
= ¬
x ori
=
x forsomex∈
V . Question: Doesthereexistafunction f:
V→ {
0,
1}
suchthathf(
1)
+ . . . +
hf(
k)
≥
1 foreachclause(
1∨ . . . ∨
k)
?Thevariantofk-SATwhereweinadditionrequirethatthefunction f doesnotassignthesamevaluetoeachliteralin anyclauseis knownasthe not-all-equal-k-satisfiability problem (NAE-k-SAT).NAE-3-SAT remainsNP-hardeven ifit is restrictedtoclausescontainingonlypositiveliterals,andweinvite thereadertoverifythatthisrestrictedproblemcanbe formulatedasaBooleanCSPoverthetemplateN
= {
0,
1}
3\ {(
0,
0,
0),
(
1,
1,
1)
}
.3. Acyclicorders
CSPsbasedonpartitionschemesare oftenusedforqualitativereasoning.Weacknowledgethatitisnotobvioushowto define “qualitative reasoning” rigorously, butthe concept seems tohave an informal meaning that isgenerally accepted. RenzandNebel [39,p.161] write
a b c d1
a b c
d2
Fig. 2. Illustration of in-fork (left) and out-fork (right). Solid arrows denote the≺relation and dotted arrows therelation.
Qualitative reasoningisan approachfor dealingwithcommonsense knowledgewithout usingnumericalcomputation. Instead,one triestorepresentknowledgeusingalimitedvocabulary suchasqualitative relationshipsbetweenentities orqualitativecategoriesofnumericalvalues,...
Abstractionisthedefiningfeatureofqualitativereasoning:qualitative reasoningisaboutdisregardingunnecessaryand uninterestingdetails.Withthisinmind,itisclearthatanimportantkindofqualitativerelationships betweenobjectsare “part-of”relations.Onemayarguethatsuchrelationsareordersthatsatisfycertainadditionalproperties.Atypicalexample of such a relationis the NTPP relation in RCC-8—thiscan be viewed asan archetypical example ofa “part-of” relation. Inspiredbythis, wepresent(inSection3.1)acollectionoffourpropertiesthatcapturesome commonaspectsof“part-of” relations.Manyotherrelations(thatarenotnecessarily“part-of”relations)satisfytheseproperties,too:oneexampleisthe precedesrelation p inAllen’salgebra.Infact,relationsofthiskindappearveryfrequentlyinCSPsforqualitativereasoning and we presenta number ofexamples in Section 3.2. Naturally, whileour conditions on acyclicorders are sufficient to establishhardness,thereexistsCSPsoverothertypesofpartitionschemeswhichareofindependentinterest.Forexample, ifweleave therealmofqualitativereasoning,thenthegraphintervalsandwichproblem [17] canbe phrasedasaCSPover thetworelationsp
∪
p−1andR∈A\{p,p−1}R,neitherofwhichisacyclic.Anotherrelevantexampleisthepartitionscheme{
eqD,
neqD}
over a countably infinite D. While the tractable problemCSP(
{
eqD,
neqD})
might not be terriblyinteresting, theoptimisationvariantofthisproblemwhereoneisinterestedinmaximisingthenumberofsatisfiedconstraints, MAX-CSP(
{
eqD,
neqD})
,canbeviewedasanalternativeformulationofcorrelationclustering [5].3.1. Conditionsonacyclicorders
Let
≺ ⊆
D2 denoteabinaryrelationandletdenoteits converse≺
.Wesaythat≺
isanacyclicorder iftheredoesnot existanyfinitesubset
{
d1,
. . . ,
dk}
⊆
D suchthatd1≺
d2≺ · · · ≺
dk−1≺
dk≺
d1.Acyclicorders areirreflexive(i.e.theydonotcontainanyelementd suchthatd
≺
d)bydefinition.Wesaythat≺
isastrictpartialorder ifitisirreflexiveandfor arbitraryd,d,
d∈
D:d≺
d andd≺
d implyd≺
d (transitivity). Notethatthesetwo propertiesalsoensurethat≺
is antisymmetric,i.e.ifd≺
d,thend≺
d doesnothold.Itiseasytoverifythatstrictpartialordersareacyclicordersbutthat thereexistacyclicordersthatare notstrictpartialorders.Wesaythat≺
isastricttotalorder if≺
isastrict partialorder anditisa connex relation,i.e.forarbitrarydistinct d,d∈
D, eitherd≺
d ord≺
d holds.We willnowdefine additional propertiesofacyclicordersparticularlyrelevantinthecontextofCSP(
B
∨=)
.Here,weinvitethereadertoviewtherelation whichholdsbetweentwo elementsifthey arenotcomparable withrespectto≺
,althoughall thatisneededisthat satisfiesthefollowingproperties.Definition2.Let
≺ ⊆
D2 beanacyclicorderand⊆
D2 arelation.Wedefinethefollowingproperties.C1. (unboundedtotalorders)foreveryk
∈ N
,thereexistsasubset L⊆
D suchthat|
L|
≥
k and≺
isastricttotalorderon L,C2. (in-fork)ifa,b,c
∈
D,a≺
b≺
c,anda≺
c,thenthereexistsd1∈
D suchthatd1a,d1b,andd1(
≺,
)
c,C3. (out-fork)ifa,b,c
∈
D anda≺
b≺
c,anda≺
c,thenthereexistsd2∈
D suchthatd2(
≺,
)
a,d2b,andd2c,and C4. (no-fork)ifa,b,c∈
D anda≺
b≺
c,anda≺
c,thentheredoesnotexistanyd3∈
D suchthatd3a,d3(
≺,
)
b,andd3
c.Relations satisfyingtheseproperties are abundant in theartificial intelligenceliterature, but they haveto the best of ourknowledge notbeenexplicitlyformalized before.The conditionsin-forkandout-fork are illustratedinFig. 2.Givena relation R itistypicallyeasytocheckifitisanacyclicorderthatcontainsaninfinitetotalorder,butcheckingC2–C4 may
needadditionalwork.
Manypartition schemes contain strictpartial orders,andtheseare slightlyeasierto work withthanacyclicrelations, sinceitisalwayspossibletodefinetherelation
inacanonicalway.Givenanorder≺ ⊆
D2,weletdenoteits incompa-rabilityrelation D2\
{≺,
,
eqD}
.IfB
isapartitionschemeandB
∨=containsanorder≺
,thenisincludedinB
∨=,too. Weobtainthefollowingcharacterization.Theorem3.Let
B
beapartitionschemewithdomainD suchthatB
∨=containsastrictpartialorder≺
.If≺
andtheincomparability relationsatisfyC1–C3thentheysatisfyC4.a
b
c
d1 d2
Fig. 3. The choice of d1and d2in the unit interval example.
Proof. Assumeto thecontrarythatthere exista,b,c,d3
∈
D suchthat d3a, d3(
≺,
)
b,andd3c.Therelation≺
isastrict partialorder soitis transitive.Ifd3
≺
b,thend3≺
c.Butthend3c cannot holdsincethe relations≺
andaredisjoint.Similarly,ifd3
b,thena≺
d3andd3a cannothold. 3.2. ExamplesConsider Allen’s algebra and the relation p, i.e. the relation statingthat one interval appears strictly before another interval. Inthiscase,
can bechosen tobe therelationthat holdsifandonlyiftwo distinctintervalshaveatleastone point incommon. The relation pisclearly acyclic (in fact,it isa strict partialorder) andit contains manyinfinitestrict total orders such as T= {[
0,
1],
[
2,
3],
[
4,
5],
. . .
}
.Pick threeintervals Ij= [
I−j,
I+j]
∈
T , 1≤
j≤
3, such that I1(
p)I
2(
p)I
3.The transitivityof p implies that I1
(
p)I
3,too.Forin-fork,we choose I4= [
I−1,
I2+]
sothat I4I1, I4I2,and I4≺
I3.Forout-fork,onemaychoose I5
= [
I−2,
I+3]
.Concerningtheno-forkproperty,simplynotethataninterval I6 whichprecedesI2(orisprecededbyI2)cannotshareapointwithboth I1 andI3.
We continue with a more complex example that is based on acyclic orders instead of strict partial orders. The Unit IntervalAlgebra (UIA) is Allen’sinterval algebra restrictedto intervals of length one. The UIA has importantapplications in,forinstance, bioinformatics [33]. Consider theoverlaps relationo. Thisrelationis irreflexivebutitis nottransitive in general:theunitintervals
[
0,
1]
,[
0.
9,
1.
9]
,and[
1.
8,
2.
8]
areexamplesofthis.Hence,itisnotapartialorder.Weshowthat oisanacyclicorderthatsatisfiesC1–C4.Thefactthatoisanacyclicorderiseasytoverify.Choosetherelation≺
toequaloandlet
holdifandonlyiftwointervalsdonothaveacommonpoint,i.e.,= (
p,
p−1)
.C1. Weclaim thattheorder
(L,
o)
whereL= {[
x,x+
1]
|
0<
x<
1and x∈ Q}
isan infinitestrict totalorder—thisimpliesproperty C1.Irreflexivityisobviousso wecontinue withtheconnexity property.We seethat if
[
a−,
a+],
[
b−,
b+]
aredistinctmembersofL,theneither
−
1<
a−−
b−<
0 or0<
a−−
b−<
1.Inthefirstcase,itfollowsthata−<
b−and 1+
a−>
b−whichimpliesthata+=
1+
a−>
b−>
a− anda(o)b.
Theothercaseisanalogous.Toverifythat(L,
o)
is transitive,we arbitrarily pickthreedistinct unit intervalsa,b,c= [
a−,
a+],
[
b−,
b+],
[
c−,
c+]
inL such that a(o)b(
o)c.
Weneedtoverifythata−<
c−andc−<
a+<
c+.Thefactthata(o)b(
o)c implies
thata−<
b−<
c−and,consequently, thata+<
c+sincea+=
a−+
1 andc+=
c−+
1.Finally,notethatc−−
a−<
1 soc−− (
a+−
1)
<
1 andc−<
a+. C2/C
3. We begin by arbitrarily choosing three distinct unit intervals a,b,c= [
a−,
a+],
[
b−,
b+],
[
c−,
c+]
in D such thata(o
)b(
o)c and
a(o)c.
Letd1= [
c+−b+
2
,
c+−b+2
+
1]
.Weseethata(p)d
1,b(p)d
1,andc(o)d
1sod1a,d1b,andd1(
≺,
)
c.Letd2
= [
b−−a−
2
−
1,
b−−a−2
]
.Weseethatd2(
o)a,
d2(
p)b,
andd2(
p)c.
Thisimpliesthatd2(
≺,
)
a,d2b,andd2c.Thechoiceofd1 andd2 isillustratedinFig.3.
C4. Pickthreeunitintervalsa,b,c
= [
a−,
a+],
[
b−,
b+],
[
c−,
c+]
inD suchthata(o)b(
o)c and
a(o)c.
Assumetothecontrarythat thereisad3
∈
D suchthatd3a,d3(
≺,
)
b,andd3c.Ifd3(
p)a,
thend3 cannot satisfyd3(
≺,
)
b sod3(
p−1)a.
Similarlyd3
(
p)c.
Thiscontradictsthefactthata≺
c.Letusconsideranotherexamplewherethedomaincontainsthecloseddisksin
R
2,therelation≺
isthestrictsubsetrelation, andwhere
holds betweentwo regions if andonly if neither region included inthe other. For each k≥
1 it is then clear that there exists a set of k regions where≺
induces a strict total order, e.g., k disks c1,
c2,
. . . ,
ck where c1≺
c2. . .
≺
ck. Pickthreedisks d1,
d2,
d3∈
D such that d1≺
d2≺
d3.Howto choose suitable disks forverifying in-forkFig. 4. The dashed circles show possible choices of disks for in-fork (left) and out-fork (right).
d2 alsocontainsd1 (oriscontainedbyd3).Thisexamplecaneasilybeadapted torelations suchas PP inRCC-5, NTPP in
RCC-8,andtherelationd
⊕
dintherectanglealgebra.The examplespresented aboveare just asmallselection ofpartition schemesthat satisfy propertiesC1–C4 andmany
additionalexamplescanbefound,forinstance,inthesurveybyDyllaetal. [14].Last,letusremarkthatthereareexamples ofstrictpartialordersthatdonothavein- and/orout-forks.Well-knownexamplesaretheless-thanrelation
<
inthe (1-dimensional)pointalgebraandinthebranchingtime algebra.Interestingly,CSP(
B
∨=)
ispolynomial-timesolvableinthese twocasesandwewillcomebacktothisobservationattheendofSection 4.1.4. LowerboundsforCSP
(
B
∨=)
WewillnowstudythecomputationalcomplexityofCSP
(B
∨=)
whenB
∨= containsanacyclicorder≺
andarelation thatsatisfyC1–C4.Toavoidlengthyformulationsofthiskindweintroducethefollowingsetoftemplates.Definition4.Welet
H
be thesetofpartition schemesB
such that (1)CSP(
B)
issolvableinpolynomial time,and(2)B
containsanacyclicorder≺
andarelationthatsatisfy C1–C4.Notethat it issufficientthat the partitionscheme contains asingle acyclicorder withtheseproperties:theother re-lations are not relevant as long as CSP
(B)
is tractable. Examples where the connection between acyclic orders andthe complexity oftheresultingCSPsisquitepronouncedcanbefoundin,forinstance,Grignietal. [18],RenzandNebel [37], Moratzetal. [31],andKrokhinetal. [27].Thus,isCSP(
B
∨=)
alwaysNP-hardwhenB ∈ H
,orcanthereexisttractablecases? IfCSP(
B
∨=)
isindeedNP-hard,howfastcanit besolved?Mightthereexist someparticularly“easy”partition schemeB
whereCSP(B
∨=)
issolvablein O(c
n)
foravery smallconstantc? Or evenin O(c
n)
time forevery constant c>
1,i.e., in subexponential time1? Naturally,wecannothope tounconditionallyprovethataCSP(B
∨=)
problemisnotsubexponential,andit is insteadcommon to provelower bounds subjectedto the assumptionthat a specific problemis not solvablein subexponentialtime.Forthispurposethe3-SATproblem,i.e.,satisfiabilityofclausesoflengthatmost3,hasturnedoutto beaveryusefulstartingpoint.
Definition5.Theconjecturethat 3-SATisnotsolvableinsubexponentialtimeisknownastheexponential-timehypothesis (ETH) [23].
The general idea behind a non-subexponentiality lower bound subjected to the ETH is then similar to a typical NP-hardness proof:oneneedstoprovideasuitablereductionfrom3-SATtotheprobleminquestion.Thecomplicatingfactor, ofcourse,isthatoneneedsreductionspreservingsubexponentialcomplexity,whichcansometimesbemuchmoredifficult to constructthan ordinarypolynomial-time many-onereductions. Moreinformation abouttheETH andits consequences canbefoundinthesurveybyLokshtanovetal. [30].
Example3.Considertheclassicalgadgetreductionfrom4-SATto3-SATwhichreplacesaclauseoftheform
(x
1∨
x2∨
x3∨
x4)
with
(x
1∨
x2∨
y)∧ (
x3∨
x4∨ ¬
y),where y isafreshvariable.Ifoneisnotcarefulthenonemightbeledtobelievethatthisreduction preservessubexponentialcomplexity since we foreachclause inthe original instanceonlyintroduces one freshvariable.Butwhatiftheinstancecontainsasuperlinear amountofclauseswithrespecttothenumberofvariables, e.g.,aquadraticnumber?Assumingthat3-SATissolvableinO
(c
n)
timeforsomec>
0,wheren isthenumberofvariables, thisreductionwouldthenonlysaythat4-SATissolvablein O(c
n2)
time,andinparticularwouldnotimplythat4-SATis subexponentialif3-SATissubexponential.However,itisknownthatthedegree-boundedk-SATproblem(forsomefixed B
>
0)issolvableinsubexponentialtime ifandonlyifk-SATis solvableinsubexponentialtime, usingthepowerfulidea ofsparsification [23]. Ifonethen reducesfromadegree-boundedproblemthetotalnumberofclausesislinearwithrespecttothenumberofvariables,meaningthat theabovereductionpreservessubexponentialcomplexity.
Impagliazzoetal. [23] introduceamoregeneraltheoryofreductionspreservingsubexponentialcomplexitybutforour purposes,it issufficientwithpolynomial-timemany-onereductionswhichgivenaninstance withn variablesproducean instancewithO
(n)
variables.4.1. ETH-basedlowerboundsandNP-hardness
Arbitrarilychoose
B
inH
.Wehavetwochallengestoovercome:first,isitpossibletofindauniform reductionapplicable toeveryCSP(
B
∨=)
problem;second,cansuchareduction,ifitevenexists,beusedtoobtainlowerboundsundertheETH? We will reachan affirmative answer toboth ofthese questionsinthis section,and willsee that itis possibleto obtain lowerboundsevenfordegree-boundedCSP(B
∨=)
-B problems,indeed,evenfortheseverelyrestrictedproblemCSP(B
∨=)
-3 whereavariablemayoccurinatmost3constraints.However,beforeweturntothedetailsweconsideranexamplewhich showsalargedifferencebetweenCSP(B
∨=)
problemsandrelatedCSPs,andhighlighttheinvolveddifficulty.Example4.Fora partitionscheme
B
over thedomain D, letB
∨k be the setof all relationsdefinable by disjunctions of length at mostk, where each atom is a constraintoverB
. It is easy to see thatB
∨=⊆
B
∨k for some k, but that the converseisnotnecessarilytrue.Infact,B
∨k isingeneralmuchmoreexpressivethanB
∨= inthecontext ofCSPs. Tosee this,considerthefollowingreductionfrom3-SATtoCSP(B
∨3)
.Weonlysketchthedetailssincethey arenotimportantfor thesubsequentresults.1. AssumethatthedomainD containsatleasttwoelements.
2. Since
B
isapartitionschemeitalwayscontainstheequalityrelationeqD andtheinequalityrelationneqD overD. 3. Introducetwofreshvariablesxf andxt andconstrainthemasneqD(x
f,
xt)
.4. Foreach3-clause,e.g.,
(x
1∨
x2∨ ¬
x3)
introducetheconstrainteqD(x
1,
xt)
∨
eqD(x
2,
xt)
∨
eqD(x
3,
xf)
.Inotherwordsthisreductionisastandardgadgetreductionfrom3-SATtoCSP
(B
∨3)
whichreplaceseach3-clauseby the corresponding disjunctionoverB
.Moreover,since itonlyintroduces2freshvariablesintotal,itimmediatelyfollowsthat CSP(
B
∨3)
cannotbesolvedinsubexponentialtimewithoutviolatingtheETH(recallExample3).Notethatwedonoteven requireanyadditionalassumptionsonB
:itissufficientthatitisapartitionscheme.ForCSP
(B
∨=)
the situationismuch moredifficultsince it (ingeneral) isnot possibleto representdisjunctionsofthe required form. We will soon seethat while it is possibleto obtain a suitable reduction to CSP(B
∨=)
whenB ∈ H
, it is significantlymorecomplicatedthanthereductioninExample4.Beforeweproceedwiththeactualreductionwedefinea usefulgadget.Lemma6.Assumethat
B ∈ H.
ThenthereexistsaninstanceofCSP(B∨=)
withvariables{
a,b,c,x1,
x2}
whichsatisfiesthefollowing properties:G1. Forarbitraryelementsda
,
db,
dc∈
D suchthatda≺
db≺
dcandda≺
dc,thereexistelementsd1,
d2∈
D suchthatthefunction s:
V→ {
da,
db,
dc,
d1,
d2}
definedbys(a)=
da,s(b)=
db,s(c)=
dc,s(x1)
=
d1ands(x2)
=
d2isasolutiontotheinstance(V
,
C∪ {
a≺
b,b≺
c})
.G2. Forarbitraryelementsda
,
db,
dc∈
D suchthatdc≺
db≺
daanddc≺
da,thereexistelementsd1,
d2∈
D suchthatthefunction s:
V→ {
da,
db,
dc,
d1,
d2}
definedbys(a)=
dc,s(b)=
db,s(c)=
da,s(x1)
=
d1ands(x2)
=
d2isasolutiontotheinstance(V
,
C∪ {
c≺
b,b≺
a})
.G3.
(V
,
C∪ {
b≺
a,b≺
c,a(≺,
)
c})
isnotsatisfiable. G4.(V
,
C∪ {
a≺
b,c≺
b,a(≺,
)
c})
isnotsatisfiable.Proof. DefinethegadgetG(a,b,c,x1
,
x2)
tobetheCSP(B
∨=)
instance(
{
a,b,c,x1,
x2}, {
x1a,x1b,x1(
≺, )
c,x2(
≺, )
a,x2b,x2c}).
We demonstratethat G satisfies G1-G4.Properties G1 and G2 followimmediatelyfromin-forkandout-fork.Toprove G3
andG4,we needtoshowthat whenevera,b,c istotallyordered ina waydifferentfroma
≺
b≺
c orc≺
b≺
a,then thegadgetisnotsatisfied.Assumeforinstancethatb
≺
a≺
c.Then,{
b≺
a,a≺
c,x2(
≺,
)
a,x2b,x2c}
mustbesatisfiableandthisviolatesproperty C4.Theremainingthreecasescan beruledout analogously.Weconcludethat G hastheproperties G1–G4.
Informally,thegadgetG(a,b,c,x1
,
x2)
constrainsb tobebetweena andc.Equippedwiththislemma,wearenowreadyLemma7.Let
B ∈ H.
ThenCSP(B∨=)
isNP-hardanditisnotsolvableinsubexponentialtime,unlesstheETHisfalse.Proof. Recallthat NAE-3-SAT restrictedtopositiveliteralsmaybeviewedasCSP
(
{
N})
whereN= {
0,
1}
3\{(
0,
0,
0),
(
1,
1,
1)
}
,andthat this problemisNP-complete. We willshow that there exists a polynomial-timemany-to-onereduction f from CSP
(
{
N})
toCSP(
B
∨=)
.Arbitrarilychooseaninstance
(A,
T)
ofCSP(
{
N})
andconstructaninstanceI=
f((A,
T))
ofCSP(B
∨=)
asfollows: F1: addthevariableM to I,F2: foreacha
∈
A,addavariablea andtheconstrainta(≺,
)
M to I,F3: foreachtripleN(a,b,c)
∈
T ,introducefivevariablesz,x1,
x2,
x3,
x4andadda(≺,
)
b,a(≺,
)
c,b(≺,
)
c,G(a,M,z,x1,
x2)
,andG(b,z,c,x3,
x4)
toI,whereG isthegadgetfromLemma6.Clearly,thereductionabovecanbecarriedoutinpolynomialtime.Weproceedwiththecorrectnessproof.
First,assume that s isasolutionto I.Foreacha
∈
A,eithers(a)≺
s(M)ors(a)s(M).Wedefine asolutions:
A→
{
0,
1}
suchthats(a)
=
0 ifandonlyifs(a)≺
M.Wecontinuebyprovingthatssatisfieseach N(a,b,c)∈
T .Assumetothe contrarythat s(a)
=
s(b)
=
s(c)
=
0,i.e. s(a),s(b),s(c)≺
s(M).We analyse thegadgets G(a,M,z,x1,
x2)
, G(b,z,r,x3,
x4)
andthefourorderingsthattheyallow.
1. s
(a)
≺
s(M)≺
s(z)ands(b)≺
s(z)≺
s(c).Weseethats(M)≺
s(z)≺
s(c)sos(c)
=
1 andthisisnotpossible. 2. s(a)
s(M)s(z)ands(b)≺
s(z)≺
s(r).Thisisnotpossiblesinces(a)≺
s(M).3. s
(a)
≺
s(M)≺
s(z)ands(b)s(z)s(r).Weseethats(M)≺
s(z)≺
s(b)sos(b)
=
1 andthisisnotpossible. 4. s(a)
s(M)s(z)ands(b)s(z)s(r).Thisisnotpossiblesinceweknowthats(a)≺
s(M).Thecasewhens
(a)
=
s(b)
=
s(c)
=
1 canbe ruledoutsimilarly.Weconcludethatatleastonevariableisassigned0, atleastonevariableisassigned1,andtheconstraintN(a,b,c)issatisfied.Fortheotherdirection,assumethatthereexistsasolutions
:
A→ {
0,
1}
to(A,
T)
.Weshowhowtoconstructasolution totheinstanceI.LetA0⊆
A bethevariablesthatareassigned0 bysandlet A1⊆
A thatareassigned1.Let(L,
≺)
denoteastricttotalorderin
(D,
≺)
thatcontains2|
A|
+
2 elementsd1
≺
e1≺
d2≺
e2≺ · · · ≺
e|A|≺
d|A|+1≺
e|A|+1.
Constructs
:
A∪ {
M}
→ {
d1,
. . . ,
d|A|+1}
suchthats(a)≺
s(M)ifa∈
A0 ands(a)s(M)ifa∈
A1.Thefunctions satisfiesallconstraintsintroducedinstepF2.WecontinuebytheconstraintsintroducedinstepF3.Consideranarbitraryconstraint N(a,b,c)
∈
T and thecorresponding constraintsin I:wehaveintroduced fivefreshvariables z,x1,
x2,
x3,
x4 andthecon-straints:(1)a(
≺,
)
b,(2)a(≺,
)
c,(3)b(≺,
)
c,(4)G(a,M,z,x1,
x2)
,and(5)G(b,z,c,x3,
x4)
.Theconstraints(
1)
− (
3)
areclearly satisfiedby s.Wewillnowshowhowtochooses(z)inordertosatisfyconstraints
(
3)
and(
4)
.Haveinmindthat, forinstanceinconstraint(
4)
,itissufficienttochooses(z)suchthats(a)≺
s(M)≺
s(z)ors(a)s(M)s(z);suitablevalues alwaysexistforx1 andx2duetoG1 andG2.Lete+bethee-elementin
(L,
≺)
thatistheimmediatelargerneighbourtotheelement f(M)
anddefinee−analogously. Giventwodistincta,b∈
A,leteabbe anarbitrarye-element in(L,
≺)
that liesbetweens(a)ands(b).Thefollowingtable summariseshows(z)shouldbechosen.s
(a)
s(b)
s(c)
s(z) 0 0 1 e+ 0 1 0 e+ 0 1 1 ebc 1 0 0 ebc 1 0 1 e− 1 1 0 e−Weconcludethatthefunctions canbeextendedtoasolutiontoI.
Weneedthelaststeppingstonetoprovethestrongerversionofthelemmaabove(recallthatCSP
(B
∨=)
-3 isthe degree-boundedproblemwhereavariablemayoccurinatmost3 constraints).Lemma8.Let
B
beapartitionschemeandassume(V
,
C)isaninstanceofCSP(B
∨=).
If|
C|
≤
c|
V|
forsomeconstantc,then(V
,
C)
canbereducedtoaninstanceofCSP(B∨=)-3 with
atmost2c|
V|
variablesinpolynomialtime.Proof. First,recallthateqD
∈
B
sinceB
isapartitionscheme.Thenpickavariablex∈
V occurringinconstraintsc1,
. . . ,
ck fork>
3.Introducek freshvariables x1,
. . . ,
xk togetherwiththeconstraintsx1(
eqD)x
2,x2(
eqD)x
3,. . . , xk−1(
eqD)x
k.Next,replaceeachoccurrenceofx inci bythecorrespondingvariablexi.Clearly,thedegreeofeachxivariableisatmost3,and theequalityconstraintsenforcethatx1
,
. . . ,
xk arealwaysassignedthesamevalueinanysatisfyingassignment.Moreover, eachconstraintcontainstwovariables,sothetotalnumberofvariablesintroducedbythisreductionisboundedfromabove by2|
C|
≤
2c|
V|
.Withthislemmaathand,wearenowreadytoprovethemainresultbycarefullyanalysingthereductioninLemma7.
Theorem9.Let
B ∈ H
.ThenCSP(B
∨=)-3 is
NP-hardanditisnotsolvableinsubexponentialtime,unlesstheETHisfalse.Proof. Asbefore, let N
= {
0,
1}
3\ {(
0,
0,
0),
(
1,
1,
1)
}
. Thereexists a constant B≥
1 suchthat CSP(
{
N})
-B is NP-complete andsolvableinsubexponentialtimeifandonlyiftheETHisfalse [26].Take an arbitrary instance
(A,
T)
of CSP(
{
N})
-B with|
A|
=
n (note that|
T|
≤
Bn) and apply the reduction f from Lemma 7to obtain an instance(V
,
C)=
f((A,
T))
ofCSP(B
∨=)
.Observe that|
C|
= |
A|
+
5|
T|
≤ (
1+
5B)n,
since we in-troduce a constrainta(≺,
)
M for each a∈
A and five constraints foreach N(a,
b,c)∈
T . The term 1+
5B is constant. Hence,combining f withthereductionfromLemma7yieldsaninstanceofCSP(
B
∨=)
-3 with O(n)variablesinpolynomialtime.
Naturally,Theorem9alsoimpliesthatCSP
(B
∨=)
-3 (and,hence,CSP(B
∨=)
)isNP-complete.Forstrictpartialorderswe maycombineTheorem9withtheobservationinTheorem3toobtainthefollowingcorollary.Corollary10.Let
B
beapartitionschemewithdomainD suchthatB
∨=containsastrictpartialorder≺
.Assume≺
togetherwith theincomparabilityrelationsatisfyC1–C3.ThenCSP(B∨=)-3
isNP-hardandnotsolvableinsubexponentialtime,unlesstheETHis false.In summary,wemayrule out subexponentialtime algorithmsforCSP
(B
∨=)
-3forpartition schemesB ∈ H
.However, the best general algorithm forCSP(B
∨=)
runsin O(
2O(n2))
time (if CSP(B)
istractable) [25,39]. Hence, there is a large discrepancybetweenthe upperandlower boundforthisproblem, suggestingthat (atleast) oneof theseboundscanbe strengthened.WereturntothisquestioninSection5.4.2. Consequences
The properties in Definition 2 are sufficient for establishing NP-hardness of CSP
(B
∨=)
, and it is thus natural to ask to whichextent they are alsonecessary. Althougha complete answerseems difficult toobtain, we mayatleastobserve that if≺ ∈
B
isan acyclicordersuch that every stricttotal orderinit contains atmostk elements andthereis atleast one strict total order with three or more elements, then CSP(
B
∨=)
is NP-hard, regardless of whether≺
has properties C2–C4 ornot.This canbe seenvia apolynomial-timereduction fromk-Colourability (i.e.theproblemCSP(
{
Rk})
where Rk= {(
x,y)∈ {
1,
. . . ,
k}
2|
x=
y}
)toCSP(B
∨=)
.Let(V
,
E)beanarbitraryundirectedgraph.Introducevariablesc1,
. . . ,
ckfor eachcolour,andconstrainthemasc1(
≺)
c2(
≺)
. . . (
≺)
ck.Foreachvertexv∈
V ,introduceavariable w andtheconstraints w(≺,
,
eqD)c
i, 1≤
i≤
k. Recall that,
eqD∈
B
sinceB
is apartition schemeso the relation(
≺,
,
eqD)
is a member ofB
∨=.Notethattheseconstraintsimplythat w equalsexactly onecolourvariablein anysatisfyingassignment. Finally, introducetheconstraintw(≺,
)
wforeachedge(v,
v)
inE.ItiseasytoverifythattheresultingCSP(
B
∨=)
instancehasa solutionifandonlyif(V
,
E)
isk-colourable.Itisalsoeasytoverifythatthereductioncanbecomputedinpolynomialtime sincek isaconstantthatonlydependsonthechoiceofB
.Sincek-Colourability isNP-hardwheneverk≥
3,NP-hardness ofCSP(
B
∨=)
follows.Similarly,itisnaturaltoaskwhathappensif
≺
isan acyclicorderthatcontainsinfinitestricttotalordersbutdoesnot havein- and/orout-forks.Wehaveseenthatthissometimesleadstotractability,asinthecaseofe.g.thepointalgebraand thebranchingtimealgebra,butthisisnotalwaysthecase.Forasimplecounterexample,letD= {(
0,
i),(
1,
i),(
2,
i)|
i∈ N}
anddefine≺ ⊆
D2 such that(a,
b)≺ (
c,d) ifandonly ifa=
c and b<
d.It is easy toverify that≺
isan acyclic order (in fact,itis astrict partialorder),it contains infinitestrictpartial orders(suchas(
0,
0)
≺ (
0,
1)
≺ (
0,
2)
≺ . . .
),andthat it doesnothave in- orout-forks.LetB = {≺,
,
,
eqD}
where=
D2\
{≺,
,
eqD}
,andobservethatB
is apartition scheme.WeshowthatCSP(
B
∨=)
isanNP-hardproblemviaapolynomial-timereductionfrom3-Colourability. Let(V
,
E)
be anarbitraryundirectedgraph.Foreachvertexv∈
V ,introduceavariable w,andforeachedge(w,
w)
∈
E, introduce theconstraintww.Notethat((a,
b),(c,
d))∈
ifandonlyifa=
c andthata andc arerestrictedtothethree-element set{
0,
1,
2}
. Giventhis, it is easy to verifythat the resulting CSP(
B
∨=)
instance has a solution ifand only if(V
,
E)
is 3-colourable.4.3. Atractablesubclassofdegree-boundedproblems
GiventhatCSP
(B
∨=)
-3 isNP-hardwheneverB ∈ H
,itisinterestingtoseewhetherthedegreeboundcanbefurther low-eredwithretainedNP-hardnessornot.Wewillnotbeabletoanswerthisquestioninitsfullgeneralitybutforω
-categoricalpartition schemes
B
,CSP(B
∨=)
-2 is, to thecontrary, always solvableinpolynomial time. Webeginby recapitulatingthe conceptofω
-categoricityanditsconnectionstoqualitativeCSPs.Afirst-ordertheory isasetoffirst-ordersentencesandthe first-ordertheoryofaconstraintlanguageisthesetoffirst-ordersentencesthatarelogicallyentailedby
.Wesaythat asatisfiable first-ordertheory T is
ω
-categoricalifallcountablemodelsofareisomorphic,anda constraintlanguage is
ω
-categorical ifitsfirst-ordertheoryisω
-categorical.ItisknownthatalargenumberofqualitativeCSPscanbecapturedviaω
-categorical constraintlanguages:well-knownexamplesincludeAllen’salgebra [21] andRCC-8 [8].Manymoreexamples canbefoundinSection1ofBodirsky&Jonsson [7].Thebasicideabehindourtractabilityresultistostudythetree-widthofCSP
(
B
∨=)
-2 instancesandexploit aresultby Bodirsky & Dalmau [6].A tree-decomposition of a graph G= (
V,
E) is a pairD = (T ,
f)
, whereT
is a rooted treewith vertexsetT and f:
T→
2V isafunctionsuchthatthefollowingpropertieshold:(T1)
t∈T f(t)
=
V ,(T2) foreveryu
∈
V ,theset{
t∈
T|
u∈
f(t)
}
inducesaconnectedsubtreeofT
,and(T3) foreachedge
(u,
v)∈
E,thereexistsat∈
T suchthat{
u,v}
⊆
f(t)
.The width ofthe tree-decomposition
D
is maxt∈T|
f(t)
|
−
1, andthe treewidth of G is the minimum width over all tree-decompositionsofG.We willconsiderthetreewidthofGaifmangraphs.TheGaifmangraph(ortheprimalgraph)ofaCSPinstance
(V
,
C) is thegraphonvertexsetV wheretwodistinctverticesvi andvjareadjacentifandonlyifviandvjsimultaneouslyappear inthescopeofsomeconstraintinC .ThefollowingresultisadirectconsequenceofCorollary 1inBodirsky&Dalmau [6].Proposition11.Let
beafinite
ω
-categoricalconstraintlanguage.ThenCSP()restrictedtoinstanceswhoseGaifmangraphshave tree-widthboundedbysomeconstantissolvableinpolynomialtime.Theorem12.If
B
isanω
-categoricalpartitionscheme,thenCSP(B
∨=)-2 is
solvableinpolynomialtime.Proof. If
B
isω
-categorical,thenB
∨= isω
-categorical,too,since thisproperty ispreservedunderfirst-order definitions [22,Theorem7.3.8]. Let(V
,
C)bean arbitraryinstanceofCSP(B
∨=)
-2.SincetherelationsinB
∨= arebinary,itiseasy to seethat the Gaifmangraph of(V
,
C)isthe disjointunionofsimple pathsandcycles.It iswell-known (andnotdifficult to verify)thatsuch a graphhastree-widthatmost2.TheresultfollowsfromProposition 11sinceB
∨= isafinite setof relations.5. Fasterexponential-timealgorithmsforCSP
(
B
∨=)
WehaveestablishedthatCSP
(B
∨=)
forB ∈ H
isunlikelytobesolvableinsubexponentialtime,sowefocusourefforts on constructingfasterexponential-time algorithms.Algorithm 1(thatwe presentbelow) isan abstractdescriptionofthe “classical” backtracking algorithm forsolving CSPsoverpartition schemes. It isnot so difficultto seethat thisalgorithm solvesCSP(B
∨=)
in2O(n2)time(cf.Jonsson&Lagerkvist [25] orRenz&Nebel [38]),andwewillsoonseethatthisalgorithm appliedtothedegree-boundedproblemrunsin2O(n)time.Thealgorithmiswell-knownbutwegiveadetailedaccountofitsinceitmakesthepresentationofthedegree-boundedcasemuchsimpler.Wenotethatthegeneralupperboundcanbe improvedforseveralspecificpartitionschemes,forinstance:
•
theCSPoverAllen’sintervalalgebraadmitsa2O(n log n)timealgorithm [25],and•
theCSPoverAllen’sintervalalgebrarestrictedtointervalsofunitlengthadmitsa2O(n log log n) timealgorithm [11].Importantly,aswewill proveinthissection, theCSPproblemoverRCC-8 alsoadmitsa 2O(n log n) time algorithm.This immediatelyimplies,forinstance,thattheCSPsforRCC-5andthepartial-ordertimealgebracanbesolvedwithinthistime bound,too [3].
5.1. Thebranchingalgorithm
Whenpresentingthebranchingalgorithmweforsimplicityassumethattheconstraintlanguage
B
isapartitionscheme where CSP(B
) is solvable in polynomial time. One can show that an instance I= (
V,
C) of CSP(B
∨=)
is satisfiable by providingacertificate definedasasatisfiableinstanceI= (
V,
C)
ofCSP(B
)obtainedbyremovingallbutonerelationfrom eachconstraintinC .Notethat I issatisfiableifandonlyifithasacertificate:asatisfyingassignmenttoI satisfiesI,and viceversa.Lemma13.Let