Generated on Thu Apr 11 13:58:59 2019 for Gecode by doxygen 1.6.3

rel.cpp

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Christian Schulte, 2002
00008  *
00009  *  This file is part of Gecode, the generic constraint
00010  *  development environment:
00011  *     http://www.gecode.org
00012  *
00013  *  Permission is hereby granted, free of charge, to any person obtaining
00014  *  a copy of this software and associated documentation files (the
00015  *  "Software"), to deal in the Software without restriction, including
00016  *  without limitation the rights to use, copy, modify, merge, publish,
00017  *  distribute, sublicense, and/or sell copies of the Software, and to
00018  *  permit persons to whom the Software is furnished to do so, subject to
00019  *  the following conditions:
00020  *
00021  *  The above copyright notice and this permission notice shall be
00022  *  included in all copies or substantial portions of the Software.
00023  *
00024  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00026  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00028  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00029  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00030  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00031  *
00032  */
00033 
00034 #include <gecode/int/rel.hh>
00035 #include <gecode/int/bool.hh>
00036 
00037 #include <algorithm>
00038 
00039 namespace Gecode {
00040 
00041   void
00042   rel(Home home, IntVar x0, IntRelType irt, int n, IntPropLevel) {
00043     using namespace Int;
00044     Limits::check(n,"Int::rel");
00045     GECODE_POST;
00046     IntView x(x0);
00047     switch (irt) {
00048     case IRT_EQ: GECODE_ME_FAIL(x.eq(home,n)); break;
00049     case IRT_NQ: GECODE_ME_FAIL(x.nq(home,n)); break;
00050     case IRT_LQ: GECODE_ME_FAIL(x.lq(home,n)); break;
00051     case IRT_LE: GECODE_ME_FAIL(x.le(home,n)); break;
00052     case IRT_GQ: GECODE_ME_FAIL(x.gq(home,n)); break;
00053     case IRT_GR: GECODE_ME_FAIL(x.gr(home,n)); break;
00054     default: throw UnknownRelation("Int::rel");
00055     }
00056   }
00057 
00058   void
00059   rel(Home home, const IntVarArgs& x, IntRelType irt, int n, IntPropLevel) {
00060     using namespace Int;
00061     Limits::check(n,"Int::rel");
00062     GECODE_POST;
00063     switch (irt) {
00064     case IRT_EQ:
00065       for (int i=0; i<x.size(); i++) {
00066         IntView xi(x[i]); GECODE_ME_FAIL(xi.eq(home,n));
00067       }
00068       break;
00069     case IRT_NQ:
00070       for (int i=0; i<x.size(); i++) {
00071         IntView xi(x[i]); GECODE_ME_FAIL(xi.nq(home,n));
00072       }
00073       break;
00074     case IRT_LQ:
00075       for (int i=0; i<x.size(); i++) {
00076         IntView xi(x[i]); GECODE_ME_FAIL(xi.lq(home,n));
00077       }
00078       break;
00079     case IRT_LE:
00080       for (int i=0; i<x.size(); i++) {
00081         IntView xi(x[i]); GECODE_ME_FAIL(xi.le(home,n));
00082       }
00083       break;
00084     case IRT_GQ:
00085       for (int i=0; i<x.size(); i++) {
00086         IntView xi(x[i]); GECODE_ME_FAIL(xi.gq(home,n));
00087       }
00088       break;
00089     case IRT_GR:
00090       for (int i=0; i<x.size(); i++) {
00091         IntView xi(x[i]); GECODE_ME_FAIL(xi.gr(home,n));
00092       }
00093       break;
00094     default:
00095       throw UnknownRelation("Int::rel");
00096     }
00097   }
00098 
00099   void
00100   rel(Home home, IntVar x0, IntRelType irt, IntVar x1, IntPropLevel ipl) {
00101     using namespace Int;
00102     GECODE_POST;
00103     switch (irt) {
00104     case IRT_EQ:
00105       if ((vbd(ipl) == IPL_DOM) || (vbd(ipl) == IPL_DEF)) {
00106         GECODE_ES_FAIL((Rel::EqDom<IntView,IntView>::post(home,x0,x1)));
00107       } else {
00108         GECODE_ES_FAIL((Rel::EqBnd<IntView,IntView>::post(home,x0,x1)));
00109       }
00110       break;
00111     case IRT_NQ:
00112       GECODE_ES_FAIL((Rel::Nq<IntView,IntView>::post(home,x0,x1))); break;
00113     case IRT_GQ:
00114       std::swap(x0,x1); // Fall through
00115     case IRT_LQ:
00116       GECODE_ES_FAIL((Rel::Lq<IntView,IntView>::post(home,x0,x1))); break;
00117     case IRT_GR:
00118       std::swap(x0,x1); // Fall through
00119     case IRT_LE:
00120       GECODE_ES_FAIL((Rel::Le<IntView,IntView>::post(home,x0,x1))); break;
00121     default:
00122       throw UnknownRelation("Int::rel");
00123     }
00124   }
00125 
00126   void
00127   rel(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
00128       IntPropLevel ipl) {
00129     using namespace Int;
00130     GECODE_POST;
00131     switch (irt) {
00132     case IRT_EQ:
00133       {
00134         ViewArray<IntView> xv(home,x.size()+1);
00135         xv[x.size()]=y;
00136         for (int i=0; i<x.size(); i++)
00137           xv[i]=x[i];
00138         if ((vbd(ipl) == IPL_DOM) || (vbd(ipl) == IPL_DEF)) {
00139           GECODE_ES_FAIL(Rel::NaryEqDom<IntView>::post(home,xv));
00140         } else {
00141           GECODE_ES_FAIL(Rel::NaryEqBnd<IntView>::post(home,xv));
00142         }
00143       }
00144       break;
00145     case IRT_NQ:
00146       for (int i=0; i<x.size(); i++) {
00147         GECODE_ES_FAIL((Rel::Nq<IntView,IntView>::post(home,x[i],y)));
00148       }
00149       break;
00150     case IRT_GQ:
00151       for (int i=0; i<x.size(); i++) {
00152         GECODE_ES_FAIL((Rel::Lq<IntView,IntView>::post(home,y,x[i])));
00153       }
00154       break;
00155     case IRT_LQ:
00156       for (int i=0; i<x.size(); i++) {
00157         GECODE_ES_FAIL((Rel::Lq<IntView,IntView>::post(home,x[i],y)));
00158       }
00159       break;
00160     case IRT_GR:
00161       for (int i=0; i<x.size(); i++) {
00162         GECODE_ES_FAIL((Rel::Le<IntView,IntView>::post(home,y,x[i])));
00163       }
00164       break;
00165     case IRT_LE:
00166       for (int i=0; i<x.size(); i++) {
00167         GECODE_ES_FAIL((Rel::Le<IntView,IntView>::post(home,x[i],y)));
00168       }
00169       break;
00170     default:
00171       throw UnknownRelation("Int::rel");
00172     }
00173   }
00174 
00175 
00176   void
00177   rel(Home home, IntVar x0, IntRelType irt, IntVar x1, Reify r,
00178       IntPropLevel ipl) {
00179     using namespace Int;
00180     GECODE_POST;
00181     switch (irt) {
00182     case IRT_EQ:
00183       if ((vbd(ipl) == IPL_DOM) || (vbd(ipl) == IPL_DEF)) {
00184         switch (r.mode()) {
00185         case RM_EQV:
00186           GECODE_ES_FAIL((Rel::ReEqDom<IntView,BoolView,RM_EQV>
00187                           ::post(home,x0,x1,r.var())));
00188           break;
00189         case RM_IMP:
00190           GECODE_ES_FAIL((Rel::ReEqDom<IntView,BoolView,RM_IMP>
00191                           ::post(home,x0,x1,r.var())));
00192           break;
00193         case RM_PMI:
00194           GECODE_ES_FAIL((Rel::ReEqDom<IntView,BoolView,RM_PMI>
00195                           ::post(home,x0,x1,r.var())));
00196           break;
00197         default: throw UnknownReifyMode("Int::rel");
00198         }
00199       } else {
00200         switch (r.mode()) {
00201         case RM_EQV:
00202           GECODE_ES_FAIL((Rel::ReEqBnd<IntView,BoolView,RM_EQV>
00203                           ::post(home,x0,x1,r.var())));
00204           break;
00205         case RM_IMP:
00206           GECODE_ES_FAIL((Rel::ReEqBnd<IntView,BoolView,RM_IMP>
00207                           ::post(home,x0,x1,r.var())));
00208           break;
00209         case RM_PMI:
00210           GECODE_ES_FAIL((Rel::ReEqBnd<IntView,BoolView,RM_PMI>
00211                           ::post(home,x0,x1,r.var())));
00212           break;
00213         default: throw UnknownReifyMode("Int::rel");
00214         }
00215       }
00216       break;
00217     case IRT_NQ:
00218       {
00219         NegBoolView n(r.var());
00220         if (vbd(ipl) == IPL_BND) {
00221           switch (r.mode()) {
00222           case RM_EQV:
00223             GECODE_ES_FAIL((Rel::ReEqBnd<IntView,NegBoolView,RM_EQV>
00224                             ::post(home,x0,x1,n)));
00225             break;
00226           case RM_IMP:
00227             GECODE_ES_FAIL((Rel::ReEqBnd<IntView,NegBoolView,RM_PMI>
00228                             ::post(home,x0,x1,n)));
00229             break;
00230           case RM_PMI:
00231             GECODE_ES_FAIL((Rel::ReEqBnd<IntView,NegBoolView,RM_IMP>
00232                             ::post(home,x0,x1,n)));
00233             break;
00234           default: throw UnknownReifyMode("Int::rel");
00235           }
00236         } else {
00237           switch (r.mode()) {
00238           case RM_EQV:
00239             GECODE_ES_FAIL((Rel::ReEqDom<IntView,NegBoolView,RM_EQV>
00240                             ::post(home,x0,x1,n)));
00241             break;
00242           case RM_IMP:
00243             GECODE_ES_FAIL((Rel::ReEqDom<IntView,NegBoolView,RM_PMI>
00244                             ::post(home,x0,x1,n)));
00245             break;
00246           case RM_PMI:
00247             GECODE_ES_FAIL((Rel::ReEqDom<IntView,NegBoolView,RM_IMP>
00248                             ::post(home,x0,x1,n)));
00249             break;
00250           default: throw UnknownReifyMode("Int::rel");
00251           }
00252         }
00253       }
00254       break;
00255     case IRT_GQ:
00256       std::swap(x0,x1); // Fall through
00257     case IRT_LQ:
00258       switch (r.mode()) {
00259       case RM_EQV:
00260         GECODE_ES_FAIL((Rel::ReLq<IntView,BoolView,RM_EQV>
00261                         ::post(home,x0,x1,r.var())));
00262         break;
00263       case RM_IMP:
00264         GECODE_ES_FAIL((Rel::ReLq<IntView,BoolView,RM_IMP>
00265                         ::post(home,x0,x1,r.var())));
00266         break;
00267       case RM_PMI:
00268         GECODE_ES_FAIL((Rel::ReLq<IntView,BoolView,RM_PMI>
00269                         ::post(home,x0,x1,r.var())));
00270         break;
00271       default: throw UnknownReifyMode("Int::rel");
00272       }
00273       break;
00274     case IRT_LE:
00275       std::swap(x0,x1); // Fall through
00276     case IRT_GR:
00277       {
00278         NegBoolView n(r.var());
00279         switch (r.mode()) {
00280         case RM_EQV:
00281           GECODE_ES_FAIL((Rel::ReLq<IntView,NegBoolView,RM_EQV>
00282                           ::post(home,x0,x1,n)));
00283           break;
00284         case RM_IMP:
00285           GECODE_ES_FAIL((Rel::ReLq<IntView,NegBoolView,RM_PMI>
00286                           ::post(home,x0,x1,n)));
00287           break;
00288         case RM_PMI:
00289           GECODE_ES_FAIL((Rel::ReLq<IntView,NegBoolView,RM_IMP>
00290                           ::post(home,x0,x1,n)));
00291           break;
00292         default: throw UnknownReifyMode("Int::rel");
00293         }
00294       }
00295       break;
00296     default:
00297       throw UnknownRelation("Int::rel");
00298     }
00299   }
00300 
00301   void
00302   rel(Home home, IntVar x, IntRelType irt, int n, Reify r,
00303       IntPropLevel ipl) {
00304     using namespace Int;
00305     Limits::check(n,"Int::rel");
00306     GECODE_POST;
00307     switch (irt) {
00308     case IRT_EQ:
00309       if ((vbd(ipl) == IPL_DOM) || (vbd(ipl) == IPL_DEF)) {
00310         switch (r.mode()) {
00311         case RM_EQV:
00312           GECODE_ES_FAIL((Rel::ReEqDomInt<IntView,BoolView,RM_EQV>
00313                           ::post(home,x,n,r.var())));
00314           break;
00315         case RM_IMP:
00316           GECODE_ES_FAIL((Rel::ReEqDomInt<IntView,BoolView,RM_IMP>
00317                           ::post(home,x,n,r.var())));
00318           break;
00319         case RM_PMI:
00320           GECODE_ES_FAIL((Rel::ReEqDomInt<IntView,BoolView,RM_PMI>
00321                           ::post(home,x,n,r.var())));
00322           break;
00323         default: throw UnknownReifyMode("Int::rel");
00324         }
00325       } else {
00326         switch (r.mode()) {
00327         case RM_EQV:
00328           GECODE_ES_FAIL((Rel::ReEqBndInt<IntView,BoolView,RM_EQV>
00329                           ::post(home,x,n,r.var())));
00330           break;
00331         case RM_IMP:
00332           GECODE_ES_FAIL((Rel::ReEqBndInt<IntView,BoolView,RM_IMP>
00333                           ::post(home,x,n,r.var())));
00334           break;
00335         case RM_PMI:
00336           GECODE_ES_FAIL((Rel::ReEqBndInt<IntView,BoolView,RM_PMI>
00337                           ::post(home,x,n,r.var())));
00338           break;
00339         default: throw UnknownReifyMode("Int::rel");
00340         }
00341       }
00342       break;
00343     case IRT_NQ:
00344       {
00345         NegBoolView nb(r.var());
00346         if (vbd(ipl) == IPL_BND) {
00347           switch (r.mode()) {
00348           case RM_EQV:
00349             GECODE_ES_FAIL((Rel::ReEqBndInt<IntView,NegBoolView,RM_EQV>
00350                             ::post(home,x,n,nb)));
00351             break;
00352           case RM_IMP:
00353             GECODE_ES_FAIL((Rel::ReEqBndInt<IntView,NegBoolView,RM_PMI>
00354                             ::post(home,x,n,nb)));
00355             break;
00356           case RM_PMI:
00357             GECODE_ES_FAIL((Rel::ReEqBndInt<IntView,NegBoolView,RM_IMP>
00358                             ::post(home,x,n,nb)));
00359             break;
00360           default: throw UnknownReifyMode("Int::rel");
00361           }
00362         } else {
00363           switch (r.mode()) {
00364           case RM_EQV:
00365             GECODE_ES_FAIL((Rel::ReEqDomInt<IntView,NegBoolView,RM_EQV>
00366                             ::post(home,x,n,nb)));
00367             break;
00368           case RM_IMP:
00369             GECODE_ES_FAIL((Rel::ReEqDomInt<IntView,NegBoolView,RM_PMI>
00370                             ::post(home,x,n,nb)));
00371             break;
00372           case RM_PMI:
00373             GECODE_ES_FAIL((Rel::ReEqDomInt<IntView,NegBoolView,RM_IMP>
00374                             ::post(home,x,n,nb)));
00375             break;
00376           default: throw UnknownReifyMode("Int::rel");
00377           }
00378         }
00379       }
00380       break;
00381     case IRT_LE:
00382       n--; // Fall through
00383     case IRT_LQ:
00384       switch (r.mode()) {
00385       case RM_EQV:
00386         GECODE_ES_FAIL((Rel::ReLqInt<IntView,BoolView,RM_EQV>
00387                         ::post(home,x,n,r.var())));
00388         break;
00389       case RM_IMP:
00390         GECODE_ES_FAIL((Rel::ReLqInt<IntView,BoolView,RM_IMP>
00391                         ::post(home,x,n,r.var())));
00392         break;
00393       case RM_PMI:
00394         GECODE_ES_FAIL((Rel::ReLqInt<IntView,BoolView,RM_PMI>
00395                         ::post(home,x,n,r.var())));
00396         break;
00397       default: throw UnknownReifyMode("Int::rel");
00398       }
00399       break;
00400     case IRT_GQ:
00401       n--; // Fall through
00402     case IRT_GR:
00403       {
00404         NegBoolView nb(r.var());
00405         switch (r.mode()) {
00406         case RM_EQV:
00407           GECODE_ES_FAIL((Rel::ReLqInt<IntView,NegBoolView,RM_EQV>
00408                           ::post(home,x,n,nb)));
00409           break;
00410         case RM_IMP:
00411           GECODE_ES_FAIL((Rel::ReLqInt<IntView,NegBoolView,RM_PMI>
00412                           ::post(home,x,n,nb)));
00413           break;
00414         case RM_PMI:
00415           GECODE_ES_FAIL((Rel::ReLqInt<IntView,NegBoolView,RM_IMP>
00416                           ::post(home,x,n,nb)));
00417           break;
00418         default: throw UnknownReifyMode("Int::rel");
00419         }
00420       }
00421       break;
00422     default:
00423       throw UnknownRelation("Int::rel");
00424     }
00425   }
00426 
00427   void
00428   rel(Home home, const IntVarArgs& x, IntRelType irt,
00429       IntPropLevel ipl) {
00430     using namespace Int;
00431     GECODE_POST;
00432     if ((irt != IRT_NQ) && (x.size() < 2))
00433       return;
00434     switch (irt) {
00435     case IRT_EQ:
00436       {
00437         ViewArray<IntView> xv(home,x);
00438         if ((vbd(ipl) == IPL_DOM) || (vbd(ipl) == IPL_DEF)) {
00439           GECODE_ES_FAIL(Rel::NaryEqDom<IntView>::post(home,xv));
00440         } else {
00441           GECODE_ES_FAIL(Rel::NaryEqBnd<IntView>::post(home,xv));
00442         }
00443       }
00444       break;
00445     case IRT_NQ:
00446       {
00447         ViewArray<IntView> y(home,x);
00448         GECODE_ES_FAIL((Rel::NaryNq<IntView>::post(home,y)));
00449       }
00450       break;
00451     case IRT_LE:
00452       {
00453         ViewArray<IntView> y(home,x);
00454         GECODE_ES_FAIL((Rel::NaryLqLe<IntView,1>::post(home,y)));
00455       }
00456       break;
00457     case IRT_LQ:
00458       {
00459         ViewArray<IntView> y(home,x);
00460         GECODE_ES_FAIL((Rel::NaryLqLe<IntView,0>::post(home,y)));
00461       }
00462       break;
00463     case IRT_GR:
00464       {
00465         ViewArray<IntView> y(home,x.size());
00466         for (int i=0; i<x.size(); i++)
00467           y[i] = x[x.size()-1-i];
00468         GECODE_ES_FAIL((Rel::NaryLqLe<IntView,1>::post(home,y)));
00469       }
00470       break;
00471     case IRT_GQ:
00472       {
00473         ViewArray<IntView> y(home,x.size());
00474         for (int i=0; i<x.size(); i++)
00475           y[i] = x[x.size()-1-i];
00476         GECODE_ES_FAIL((Rel::NaryLqLe<IntView,0>::post(home,y)));
00477       }
00478       break;
00479     default:
00480       throw UnknownRelation("Int::rel");
00481     }
00482   }
00483 
00484   void
00485   rel(Home home, const IntVarArgs& x, IntRelType irt, const IntVarArgs& y,
00486       IntPropLevel ipl) {
00487     using namespace Int;
00488     GECODE_POST;
00489 
00490     switch (irt) {
00491     case IRT_GR:
00492       {
00493         ViewArray<IntView> xv(home,x), yv(home,y);
00494         GECODE_ES_FAIL((Rel::LexLqLe<IntView,IntView>
00495                         ::post(home,yv,xv,true)));
00496       }
00497       break;
00498     case IRT_LE:
00499       {
00500         ViewArray<IntView> xv(home,x), yv(home,y);
00501         GECODE_ES_FAIL((Rel::LexLqLe<IntView,IntView>
00502                         ::post(home,xv,yv,true)));
00503       }
00504       break;
00505     case IRT_GQ:
00506       {
00507         ViewArray<IntView> xv(home,x), yv(home,y);
00508         GECODE_ES_FAIL((Rel::LexLqLe<IntView,IntView>
00509                         ::post(home,yv,xv,false)));
00510       }
00511       break;
00512     case IRT_LQ:
00513       {
00514         ViewArray<IntView> xv(home,x), yv(home,y);
00515         GECODE_ES_FAIL((Rel::LexLqLe<IntView,IntView>
00516                         ::post(home,xv,yv,false)));
00517       }
00518       break;
00519     case IRT_EQ:
00520       if (x.size() != y.size()) {
00521         home.fail();
00522       } else if ((vbd(ipl) == IPL_DOM) || (vbd(ipl) == IPL_DEF))
00523         for (int i=0; i<x.size(); i++) {
00524           GECODE_ES_FAIL((Rel::EqDom<IntView,IntView>
00525                           ::post(home,x[i],y[i])));
00526         }
00527       else
00528         for (int i=0; i<x.size(); i++) {
00529           GECODE_ES_FAIL((Rel::EqBnd<IntView,IntView>
00530                           ::post(home,x[i],y[i])));
00531         }
00532       break;
00533     case IRT_NQ:
00534       {
00535         ViewArray<IntView> xv(home,x), yv(home,y);
00536         GECODE_ES_FAIL((Rel::LexNq<IntView,IntView>
00537                         ::post(home,xv,yv)));
00538       }
00539       break;
00540     default:
00541       throw UnknownRelation("Int::rel");
00542     }
00543   }
00544 
00545   namespace {
00546 
00548     ViewArray<Int::ConstIntView>
00549     viewarray(Space& home, const IntArgs& x) {
00550       ViewArray<Int::ConstIntView> xv(home, x.size());
00551       for (int i=0; i<x.size(); i++) {
00552         Int::Limits::check(x[i],"Int::rel");
00553         xv[i] = Int::ConstIntView(x[i]);
00554       }
00555       return xv;
00556     }
00557 
00558   }
00559 
00560   void
00561   rel(Home home, const IntVarArgs& x, IntRelType irt, const IntArgs& y,
00562       IntPropLevel) {
00563     using namespace Int;
00564     GECODE_POST;
00565 
00566     switch (irt) {
00567     case IRT_GR:
00568       {
00569         ViewArray<IntView> xv(home,x);
00570         ViewArray<ConstIntView> yv(viewarray(home,y));
00571         GECODE_ES_FAIL((Rel::LexLqLe<ConstIntView,IntView>
00572                         ::post(home,yv,xv,true)));
00573       }
00574       break;
00575     case IRT_LE:
00576       {
00577         ViewArray<IntView> xv(home,x);
00578         ViewArray<ConstIntView> yv(viewarray(home,y));
00579         GECODE_ES_FAIL((Rel::LexLqLe<IntView,ConstIntView>
00580                         ::post(home,xv,yv,true)));
00581       }
00582       break;
00583     case IRT_GQ:
00584       {
00585         ViewArray<IntView> xv(home,x);
00586         ViewArray<ConstIntView> yv(viewarray(home,y));
00587         GECODE_ES_FAIL((Rel::LexLqLe<ConstIntView,IntView>
00588                         ::post(home,yv,xv,false)));
00589       }
00590       break;
00591     case IRT_LQ:
00592       {
00593         ViewArray<IntView> xv(home,x);
00594         ViewArray<ConstIntView> yv(viewarray(home,y));
00595         GECODE_ES_FAIL((Rel::LexLqLe<IntView,ConstIntView>
00596                         ::post(home,xv,yv,false)));
00597       }
00598       break;
00599     case IRT_EQ:
00600       if (x.size() != y.size()) {
00601         home.fail();
00602       } else {
00603         for (int i=0; i<x.size(); i++)
00604           GECODE_ME_FAIL(IntView(x[i]).eq(home,y[i]));
00605       }
00606       break;
00607     case IRT_NQ:
00608       {
00609         ViewArray<IntView> xv(home,x); 
00610         ViewArray<ConstIntView> yv(viewarray(home,y));
00611         GECODE_ES_FAIL((Rel::LexNq<IntView,ConstIntView>
00612                         ::post(home,xv,yv)));
00613       }
00614       break;
00615     default:
00616       throw UnknownRelation("Int::rel");
00617     }
00618   }
00619 
00620   void
00621   rel(Home home, const IntArgs& x, IntRelType irt, const IntVarArgs& y,
00622       IntPropLevel ipl) {
00623     rel(home,y,irt,x,ipl);
00624   }
00625 
00626 }
00627 
00628 // STATISTICS: int-post