ldsb.hh gecode/int.hh gecode/int/ldsb/brancher.hpp gecode/int/ldsb/sym-imp.hpp /usr/include/gecode/set/ldsb.hh Gecode::Int::LDSB::Literal Gecode::ArrayTraits< ArgArray< VarImpBase * > > Gecode::ArrayTraits< LiteralArgs > Gecode::Int::LDSB::SymmetryObject Gecode::Int::LDSB::VariableSymmetryObject Gecode::Int::LDSB::ValueSymmetryObject Gecode::Int::LDSB::VariableSequenceSymmetryObject Gecode::Int::LDSB::ValueSequenceSymmetryObject Gecode::Int::LDSB::SymmetryImp Gecode::Int::LDSB::VariableSymmetryImp Gecode::Int::LDSB::ValueSymmetryImp Gecode::Int::LDSB::VariableSequenceSymmetryImp Gecode::Int::LDSB::ValueSequenceSymmetryImp Gecode::Int::LDSB::LDSBChoice Gecode::Int::LDSB::LDSBBrancher Gecode::Int::LDSB Gecode Gecode::Int /*-*-mode:C++;c-basic-offset:2;indent-tabs-mode:nil-*-*/ /* *Mainauthors: *ChristopherMears<chris.mears@monash.edu> * *Copyright: *ChristopherMears,2012 * *Lastmodified: *$Date:2013-05-0813:30:48+0200(Wed,08May2013)$by$Author:schulte$ *$Revision:13622$ * *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_LDSB_HH__ #define__GECODE_INT_LDSB_HH__ #include<gecode/int.hh> namespaceGecode{namespaceInt{namespaceLDSB{ classLiteral{ public: Literal(void); Literal(int_var,int_val); int_variable; int_value; booloperator <(constLiteral&rhs)const; }; GECODE_INT_EXPORT std::pair<int,int> findVar(int*indices,unsignedintn_values,unsignedintseq_size,intindex); }}} namespaceGecode{ template<> classArrayTraits<ArgArray<VarImpBase*>>{ public: typedefArgArray<VarImpBase*>StorageType; typedefVarImpBase*ValueType; typedefArgArray<VarImpBase*>ArgsType; }; typedefArgArray<Int::LDSB::Literal>LiteralArgs; template<> classArrayTraits<LiteralArgs>{ public: typedefLiteralArgsStorageType; typedefInt::LDSB::LiteralValueType; typedefLiteralArgsArgsType; }; } namespaceGecode{namespaceInt{namespaceLDSB{ classGECODE_INT_EXPORTSymmetryObject{ public: intnrefs; SymmetryObject(void); virtual~SymmetryObject(void); }; classGECODE_INT_EXPORTVariableSymmetryObject:publicSymmetryObject{ public: VarImpBase**xs; intnxs; VariableSymmetryObject(ArgArray<VarImpBase*>vars); ~VariableSymmetryObject(void); }; classGECODE_INT_EXPORTValueSymmetryObject:publicSymmetryObject{ public: IntSetvalues; ValueSymmetryObject(IntSetvs); }; classGECODE_INT_EXPORTVariableSequenceSymmetryObject:publicSymmetryObject{ public: VarImpBase**xs; intnxs; intseq_size; VariableSequenceSymmetryObject(ArgArray<VarImpBase*>vars,intss); ~VariableSequenceSymmetryObject(); }; classGECODE_INT_EXPORTValueSequenceSymmetryObject:publicSymmetryObject{ public: IntArgsvalues; intseq_size; ValueSequenceSymmetryObject(IntArgsvs,intss); }; template<classView> classSymmetryImp{ public: virtualArgArray<Literal>symmetric(Literal,constViewArray<View>&)const=0; virtualvoidupdate(Literal)=0; virtualSymmetryImp<View>*copy(Space&home,boolshare)const=0; virtualsize_tdispose(Space&home)=0; staticvoid*operatornew(size_ts,Space&home); staticvoidoperatordelete(void*,Space&); staticvoidoperatordelete(void*); }; template<classView> classVariableSymmetryImp:publicSymmetryImp<View>{ protected: Support::BitSetOffset<Space>indices; public: VariableSymmetryImp<View>(Space&home,int*vs,unsignedintn); VariableSymmetryImp<View>(Space&home,constVariableSymmetryImp<View>&other); virtualsize_tdispose(Space&home); voidupdate(Literal); virtualArgArray<Literal>symmetric(Literal,constViewArray<View>&)const; SymmetryImp<View>*copy(Space&home,boolshare)const; }; template<classView> classValueSymmetryImp:publicSymmetryImp<View> { public: Support::BitSetOffset<Space>values; ValueSymmetryImp<View>(Space&home,int*vs,unsignedintn); ValueSymmetryImp<View>(Space&home,constValueSymmetryImp<View>&other); virtualsize_tdispose(Space&home); voidupdate(Literal); virtualArgArray<Literal>symmetric(Literal,constViewArray<View>&)const; SymmetryImp<View>*copy(Space&home,boolshare)const; }; template<classView> classVariableSequenceSymmetryImp:publicSymmetryImp<View> { protected: unsignedint*indices; unsignedintn_indices; unsignedintseq_size; unsignedintn_seqs; //e.g.lookup[2]==10indicatesthatthevariablewithindex2 //occursatposition10inthe"indices"array. //Ifavariableoccursmorethanonce,onlythefirstoccurrence //isrecorded. //Avalueof-1indicatesthatthevariabledoesnotoccurin //"indices". int*lookup; unsignedintlookup_size; intgetVal(unsignedintsequence,unsignedintposition)const; public: VariableSequenceSymmetryImp<View>(Space&home,int*_indices,unsignedintn,unsignedintseqsize); VariableSequenceSymmetryImp<View>(Space&home,boolshare,constVariableSequenceSymmetryImp<View>&s); virtualsize_tdispose(Space&home); voidupdate(Literal); virtualArgArray<Literal>symmetric(Literal,constViewArray<View>&)const; SymmetryImp<View>*copy(Space&home,boolshare)const; }; template<classView> classValueSequenceSymmetryImp:publicSymmetryImp<View> { protected: int*values; unsignedintn_values; unsignedintseq_size; unsignedintn_seqs; Support::BitSet<Space>dead_sequences; intgetVal(unsignedintsequence,unsignedintposition)const; private: ValueSequenceSymmetryImp<View>(constValueSequenceSymmetryImp<View>&); public: ValueSequenceSymmetryImp<View>(Space&home,int*_values,unsignedintn,unsignedintseqsize); ValueSequenceSymmetryImp<View>(Space&home,constValueSequenceSymmetryImp<View>&vss); virtualsize_tdispose(Space&home); voidupdate(Literal); virtualArgArray<Literal>symmetric(Literal,constViewArray<View>&)const; SymmetryImp<View>*copy(Space&home,boolshare)const; }; template<classVal> classGECODE_VTABLE_EXPORTLDSBChoice:publicPosValChoice<Val>{ private: constLiteral*const_literals; constint_nliterals; public: LDSBChoice(constBrancher&b,unsignedinta,constPos&p,constVal&n, constLiteral*literals,intnliterals); ~LDSBChoice(void); constLiteral*literals(void)const; intnliterals(void)const; virtualsize_tsize(void)const; virtualvoidarchive(Archive&e)const; }; template<classView,intn,classVal,unsignedinta> classLDSBBrancher:publicViewValBrancher<View,n,Val,a>{ typedeftypenameViewBrancher<View,n>::BranchFilterBranchFilter; public: SymmetryImp<View>**_syms; int_nsyms; //Positionofvariablethatlastchoicewascreatedfor int_prevPos; protected: typedefvoid(*VarValPrint)(constSpace&home,constBrancherHandle&bh, unsignedintb, typenameView::VarTypex,inti, constVal&m, std::ostream&o); LDSBBrancher(Space&home,boolshare,LDSBBrancher&b); LDSBBrancher(Homehome, ViewArray<View>&x, ViewSel<View>*vs[n], ValSelCommitBase<View,Val>*vsc, SymmetryImp<View>**syms,intnsyms, BranchFilterbf, VarValPrintvvp); public: virtualconstChoice*choice(Space&home); virtualconstChoice*choice(constSpace&home,Archive&e); virtualExecStatuscommit(Space&home,constChoice&c,unsignedintb); virtualActor*copy(Space&home,boolshare); virtualsize_tdispose(Space&home); staticBrancherHandlepost(Homehome, ViewArray<View>&x, ViewSel<View>*vs[n], ValSelCommitBase<View,Val>*vsc, SymmetryImp<View>**syms, intnsyms, BranchFilterbf, VarValPrintvvp); }; template<classView> ModEventprune(Space&home,Viewx,intv); }}} #include<gecode/int/ldsb/brancher.hpp> #include<gecode/int/ldsb/sym-imp.hpp> #endif //STATISTICS:int-branch