Search strategies, that is, strategies that describe how to explore search trees, have raised much interest for constraint satisfaction in recent years. In particular, limited discrepancy search and its variations have been shown to achieve significant imp
368 L.MichelandP.VanHentenryck
intRLDSMIN(Goalg,Storeσ,Exprf){
QueueQ:= ;
f :=∞;
returnRLDSMINIMIZE(g,σ,f,f ,<>,Q);
}
intRLDSMINIMIZE(Goalg,Storeσ,Exprf,intf ,Pathp,QueueQ){
ifSUCCESS(σ)then{
f :=EVAL(f,σ);
returnRLDSMINIMIZE(σ,f,f ,p,Q);
}elseifFAILURE(σ)thenreturnRLDSMINIMIZEQUEUE(g,σ,f,f ,p,Q);else{
<(gl,cl),(gr,cr)>:=BRANCH(g,σ);
Q.push(p::(right,f ));
TELL(σ,cl∧f<f );
returnRLDSMINIMIZE(gl,σ,f,f ,p::(left,f ),Q);
}
}
intRLDSMINIMIZEQUEUE(Storeσ,Exprf,intf ,Pathpc,QueueQ){
ifQ.isEmpty()thenreturnf ;
po:=Q.getMinDiscrepancies();
<g,σ>:=RLDSRESTOREMIN(g,σ,pc,po);
returnRLDSMINIMIZE(g,σ,f,f ,po,Q);
}
<Goal,Store>RLDSRESTOREMIN(Goalg,Storeσ,Exprf,intf ,Pathpc,Pathpo){
ccccletpc=<(d1,f1),...,(dn,fn),(dn+1,fn+1),...,(dn+i,fn+i)>;
ooooletpo=<(d1,f1),...,(dn,fn),(dn+1,fn+1),...,(dn+i,fn+i)>;
for(k=1;k<=i;k++){
BACKTRACK(σ);
g:=PARENT(g);
}
o fn+i+1:=f;
for(k=1;k<=j;k++){
<(gl,cl),(gr,cr)>:=BRANCH(g,σ);
oifdn+k=leftthen{
g:=gl;
oTELL(σ,cl∧f<fn+k+1);
}else{
g:=gr;
oTELL(σ,cr∧f<fn+k+1);
}
}
return<g,σ>;
}
Fig.7.ArecomputationimplementationofLDS:Minimization.
ACMTransactionsonComputationalLogic,Vol.5,No.2,April2004.