extensional.hh gecode/int.hh gecode/int/rel.hh gecode/int/extensional/layered-graph.hpp gecode/int/extensional/base.hpp gecode/int/extensional/basic.hpp gecode/int/extensional/incremental.hpp Gecode::Int::Extensional::LayeredGraph Gecode::Int::Extensional::LayeredGraph::State Gecode::Int::Extensional::LayeredGraph::Edge Gecode::Int::Extensional::LayeredGraph::Support Gecode::Int::Extensional::LayeredGraph::Layer Gecode::Int::Extensional::LayeredGraph::LayerValues Gecode::Int::Extensional::LayeredGraph::Index Gecode::Int::Extensional::LayeredGraph::IndexRange Gecode::Int::Extensional::Base Gecode::Int::Extensional::Basic Gecode::Int::Extensional::Incremental Gecode::Int::Extensional::Incremental::SupportEntry Gecode::Int::Extensional::Incremental::WorkEntry Gecode::Int::Extensional::Incremental::Work Gecode::Int::Extensional::Incremental::SupportAdvisor Gecode::Int::Extensional Gecode Gecode::Int /*-*-mode:C++;c-basic-offset:2;indent-tabs-mode:nil-*-*/ /* *Mainauthors: *MikaelLagerkvist<lagerkvist@gecode.org> *ChristianSchulte<schulte@gecode.org> * *Copyright: *MikaelLagerkvist,2007 *ChristianSchulte,2004 * *Lastmodified: *$Date:2012-07-1908:53:57+0200(Thu,19Jul2012)$by$Author:tack$ *$Revision:12963$ * *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. * */ #ifndef__GECODE_INT_EXTENSIONAL_HH__ #define__GECODE_INT_EXTENSIONAL_HH__ #include<gecode/int.hh> #include<gecode/int/rel.hh> namespaceGecode{namespaceInt{namespaceExtensional{ template<classView,classVal,classDegree,classStateIdx> classLayeredGraph:publicPropagator{ protected: classState{ public: Degreei_deg; Degreeo_deg; voidinit(void); }; classEdge{ public: StateIdxi_state; StateIdxo_state; }; classSupport{ public: Valval; Degreen_edges; Edge*edges; }; typedeftypenameGecode::Support::IntTypeTraits<Val>::utypeValSize; classLayer{ public: Viewx; StateIdxn_states; ValSizesize; State*states; Support*support; }; classLayerValues{ private: constSupport*s1; constSupport*s2; public: LayerValues(void); LayerValues(constLayer&l); voidinit(constLayer&l); booloperator ()(void)const; voidoperator ++(void); intval(void)const; }; classIndex:publicAdvisor{ public: inti; Index(Space&home,Propagator&p,Council<Index>&c,inti); Index(Space&home,boolshare,Index&a); }; classIndexRange{ private: int_fst; int_lst; public: IndexRange(void); voidreset(void); voidadd(inti); voidadd(constIndexRange&ir); voidlshift(intn); boolempty(void)const; intfst(void)const; intlst(void)const; }; Council<Index>c; intn; Layer*layers; StateIdxmax_states; unsignedintn_states; unsignedintn_edges; IndexRangei_ch; IndexRangeo_ch; IndexRangea_ch; State&i_state(inti,StateIdxis); State&i_state(inti,constEdge&e); booli_dec(inti,constEdge&e); State&o_state(inti,StateIdxos); State&o_state(inti,constEdge&e); boolo_dec(inti,constEdge&e); voidaudit(void); template<classVar> ExecStatusinitialize(Space&home, constVarArgArray<Var>&x,constDFA&dfa); LayeredGraph(Space&home,boolshare, LayeredGraph<View,Val,Degree,StateIdx>&p); public: template<classVar> LayeredGraph(Homehome, constVarArgArray<Var>&x,constDFA&dfa); virtualActor*copy(Space&home,boolshare); virtualPropCostcost(constSpace&home,constModEventDelta&med)const; virtualExecStatusadvise(Space&home,Advisor&a,constDelta&d); virtualExecStatuspropagate(Space&home,constModEventDelta&med); virtualsize_tdispose(Space&home); template<classVar> staticExecStatuspost(Homehome, constVarArgArray<Var>&x,constDFA&dfa); }; template<classVar> ExecStatuspost_lgp(Homehome, constVarArgArray<Var>&x,constDFA&dfa); }}} #include<gecode/int/extensional/layered-graph.hpp> namespaceGecode{namespaceInt{namespaceExtensional{ typedefTupleSet::TupleTuple; typedefSupport::BitSetBaseBitSet; typedefSupport::BitSetBase*Domain; template<classView,boolsubscribe=true> classBase:publicPropagator{ protected: ViewArray<View>x; TupleSettupleSet; Tuple**last_data; TupleSet::TupleSetI*ts(void); Base(Space&home,boolshare,Base<View,subscribe>&p); Base(Homehome,ViewArray<View>&x,constTupleSet&t); voidinit_last(Space&home,Tuple**source,Tuple*base); Tuplelast(inti,intn); Tuplelast_next(inti,intn); voidinit_dom(Space&home,Domaindom); boolvalid(Tuplet,Domaindom); Tuplefind_support(Domaindom,inti,intn); public: virtualPropCostcost(constSpace&home,constModEventDelta&med)const; virtualsize_tdispose(Space&home); protected: virtual~Base(void){} }; }}} #include<gecode/int/extensional/base.hpp> namespaceGecode{namespaceInt{namespaceExtensional{ template<classView,boolshared> classBasic:publicBase<View>{ protected: usingBase<View>::x; usingBase<View>::tupleSet; usingBase<View>::ts; usingBase<View>::last; usingBase<View>::last_next; usingBase<View>::init_last; usingBase<View>::init_dom; usingBase<View>::find_support; Basic(Space&home,boolshare,Basic<View,shared>&p); Basic(Homehome,ViewArray<View>&x,constTupleSet&t); public: virtualExecStatuspropagate(Space&home,constModEventDelta&med); virtualPropCostcost(constSpace&home,constModEventDelta&med)const; virtualActor*copy(Space&home,boolshare); staticExecStatuspost(Homehome,ViewArray<View>&x,constTupleSet&t); }; }}} #include<gecode/int/extensional/basic.hpp> namespaceGecode{namespaceInt{namespaceExtensional{ template<classView> classIncremental:publicBase<View,false>{ protected: usingBase<View, false>::x; usingBase<View, false>::tupleSet; usingBase<View, false>::ts; usingBase<View, false>::last; usingBase<View, false>::last_next; usingBase<View, false>::init_last; usingBase<View, false>::init_dom; classSupportEntry:publicFreeList{ public: Tuplet; SupportEntry*next(void)const; SupportEntry**nextRef(void); SupportEntry(Tuplet); SupportEntry(Tuplet,SupportEntry*n); voiddispose(Space&home,SupportEntry*l); voiddispose(Space&home); staticvoid*operatornew(size_ts,Space&home); staticvoidoperatordelete(void*p); staticvoidoperatordelete(void*p,Space&home); }; classWorkEntry:publicFreeList{ public: inti; intn; WorkEntry(inti,intn,WorkEntry*ne); WorkEntry*next(void)const; voidnext(WorkEntry*n); voiddispose(Space&home); staticvoid*operatornew(size_ts,Space&home); staticvoidoperatordelete(void*p); staticvoidoperatordelete(void*p,Space&home); }; classWork{ private: WorkEntry*we; public: Work(void); boolempty(void)const; voidpush(Space&home,inti,intn); voidpop(Space&home,int&i,int&n); }; Workw_support; Workw_remove; SupportEntry**support_data; intunassigned; Incremental(Space&home,boolshare,Incremental<View>&p); Incremental(Homehome,ViewArray<View>&x,constTupleSet&t); voidinit_support(Space&home); voidfind_support(Space&home,Domaindom,inti,intn); voidadd_support(Space&home,Tuplel); voidremove_support(Space&home,Tuplel,inti,intn); SupportEntry*support(inti,intn); public: virtualExecStatuspropagate(Space&home,constModEventDelta&med); virtualPropCostcost(constSpace&home,constModEventDelta&med)const; virtualActor*copy(Space&home,boolshare); staticExecStatuspost(Homehome,ViewArray<View>&x,constTupleSet&t); size_tdispose(Space&home); private: classSupportAdvisor:publicAdvisor{ public: inti; SupportAdvisor(Space&home,Propagator&p,Council<SupportAdvisor>&c, inti); SupportAdvisor(Space&home,boolshare,SupportAdvisor&a); voiddispose(Space&home,Council<SupportAdvisor>&c); }; Council<SupportAdvisor>ac; public: virtualExecStatusadvise(Space&home,Advisor&a,constDelta&d); }; }}} #include<gecode/int/extensional/incremental.hpp> #endif //STATISTICS:int-prop