atmostOne.hpp /usr/include/gecode/set/distinct.hh Gecode Gecode::Set Gecode::Set::Distinct /*-*-mode:C++;c-basic-offset:2;indent-tabs-mode:nil-*-*/ /* *Mainauthors: *GuidoTack<tack@gecode.org> * *Copyright: *GuidoTack,2004 * *Lastmodified: *$Date:2009-10-1217:36:53+0200(Mon,12Oct2009)$by$Author:schulte$ *$Revision:9878$ * *ThisfileispartofGecode,thegenericconstraint *developmentenvironment: *http://www.gecode.org * *Permissionisherebygranted,freeofcharge,toanypersonobtaining *acopyofthissoftwareandassociateddocumentationfiles(the *"Software"),todealintheSoftwarewithoutrestriction,including *withoutlimitationtherightstouse,copy,modify,merge,publish, *distribute,sublicense,and/orsellcopiesoftheSoftware,andto *permitpersonstowhomtheSoftwareisfurnishedtodoso,subjectto *thefollowingconditions: * *Theabovecopyrightnoticeandthispermissionnoticeshallbe *includedinallcopiesorsubstantialportionsoftheSoftware. * *THESOFTWAREISPROVIDED"ASIS",WITHOUTWARRANTYOFANYKIND, *EXPRESSORIMPLIED,INCLUDINGBUTNOTLIMITEDTOTHEWARRANTIESOF *MERCHANTABILITY,FITNESSFORAPARTICULARPURPOSEAND *NONINFRINGEMENT.INNOEVENTSHALLTHEAUTHORSORCOPYRIGHTHOLDERSBE *LIABLEFORANYCLAIM,DAMAGESOROTHERLIABILITY,WHETHERINANACTION *OFCONTRACT,TORTOROTHERWISE,ARISINGFROM,OUTOFORINCONNECTION *WITHTHESOFTWAREORTHEUSEOROTHERDEALINGSINTHESOFTWARE. * */ namespaceGecode{namespaceSet{namespaceDistinct{ /* *"AtMostOneIntersection"propagator * */ forceinline AtmostOne::AtmostOne(Homehome,ViewArray<SetView>&x,unsignedint_c) :NaryPropagator<SetView,PC_SET_ANY>(home,x),c(_c){} forceinline AtmostOne::AtmostOne(Space&home,boolshare,AtmostOne&p) :NaryPropagator<SetView,PC_SET_ANY>(home,share,p),c(p.c){} forceinlineExecStatus AtmostOne::post(Homehome,ViewArray<SetView>x,unsignedintc){ for(inti=x.size();i--;){ GECODE_ME_CHECK(x[i].cardMin(home,c)); GECODE_ME_CHECK(x[i].cardMax(home,c)); } (void)new(home)AtmostOne(home,x,c); returnES_OK; } }}} //STATISTICS:set-prop