bool-base.hpp /usr/include/gecode/int/nvalues.hh Gecode Gecode::Int Gecode::Int::NValues /*-*-mode:C++;c-basic-offset:2;indent-tabs-mode:nil-*-*/ /* *Mainauthors: *ChristianSchulte<schulte@gecode.org> * *Copyright: *ChristianSchulte,2011 * *Lastmodified: *$Date:2011-08-1111:59:30+0200(Thu,11Aug2011)$by$Author:schulte$ *$Revision:12270$ * *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{namespaceInt{namespaceNValues{ template<classVY> forceinline BoolBase<VY>::BoolBase(Homehome, intstatus0,ViewArray<BoolView>&x,VYy0) :Propagator(home),status(status0),c(home),y(y0){ y.subscribe(home,*this,PC_INT_BND); for(inti=x.size();i--;){ assert(!x[i].assigned()); (void)new(home)ViewAdvisor<BoolView>(home,*this,c,x[i]); } } template<classVY> forceinline BoolBase<VY>::BoolBase(Space&home,boolshare,BoolBase<VY>&p) :Propagator(home,share,p),status(p.status){ c.update(home,share,p.c); y.update(home,share,p.y); } template<classVY> PropCost BoolBase<VY>::cost(constSpace&,constModEventDelta&)const{ returnPropCost::unary(PropCost::LO); } template<classVY> ExecStatus BoolBase<VY>::advise(Space&home,Advisor&_a,constDelta&){ ViewAdvisor<BoolView>&a(static_cast<ViewAdvisor<BoolView>&>(_a)); ExecStatuses; if(status==(VS_ZERO|VS_ONE)){ //Everythingisalreadydecided es=ES_FIX; }else{ if(a.view().zero()) status|=VS_ZERO; else status|=VS_ONE; es=ES_NOFIX; } a.dispose(home,c); if(c.empty()) es=ES_NOFIX; returnes; } template<classVY> forceinlinesize_t BoolBase<VY>::dispose(Space&home){ c.dispose(home); y.cancel(home,*this,PC_INT_BND); (void)Propagator::dispose(home); returnsizeof(*this); } }}} //STATISTICS:int-prop