arithmetic.hh gecode/int.hh gecode/int/rel.hh gecode/int/linear.hh gecode/int/arithmetic/abs.hpp gecode/int/arithmetic/max.hpp gecode/int/arithmetic/pow-ops.hpp gecode/int/arithmetic/pow.hpp gecode/int/arithmetic/nroot.hpp gecode/int/arithmetic/mult.hpp gecode/int/arithmetic/divmod.hpp Gecode::Int::Arithmetic::AbsBnd Gecode::Int::Arithmetic::AbsDom Gecode::Int::Arithmetic::MaxBnd Gecode::Int::Arithmetic::NaryMaxBnd Gecode::Int::Arithmetic::MaxDom Gecode::Int::Arithmetic::NaryMaxDom Gecode::Int::Arithmetic::SqrOps Gecode::Int::Arithmetic::PowOps Gecode::Int::Arithmetic::PowPlusBnd Gecode::Int::Arithmetic::PowBnd Gecode::Int::Arithmetic::PowPlusDom Gecode::Int::Arithmetic::PowDom Gecode::Int::Arithmetic::NrootPlusBnd Gecode::Int::Arithmetic::NrootBnd Gecode::Int::Arithmetic::NrootPlusDom Gecode::Int::Arithmetic::NrootDom Gecode::Int::Arithmetic::MultZeroOne Gecode::Int::Arithmetic::MultPlusBnd Gecode::Int::Arithmetic::MultBnd Gecode::Int::Arithmetic::MultPlusDom Gecode::Int::Arithmetic::MultDom Gecode::Int::Arithmetic::DivPlusBnd Gecode::Int::Arithmetic::DivBnd Gecode::Int::Arithmetic::DivMod Gecode::Int::Arithmetic Gecode Gecode::Int /*-*-mode:C++;c-basic-offset:2;indent-tabs-mode:nil-*-*/ /* *Mainauthors: *ChristianSchulte<schulte@gecode.org> *GuidoTack<tack@gecode.org> * *Copyright: *ChristianSchulte,2002 *GuidoTack,2004 * *Lastmodified: *$Date:2013-08-2916:05:54+0200(Thu,29Aug2013)$by$Author:schulte$ *$Revision:13993$ * *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_ARITHMETIC_HH__ #define__GECODE_INT_ARITHMETIC_HH__ #include<gecode/int.hh> #include<gecode/int/rel.hh> #include<gecode/int/linear.hh> namespaceGecode{namespaceInt{namespaceArithmetic{ template<classView> classAbsBnd:publicBinaryPropagator<View,PC_INT_BND>{ protected: usingBinaryPropagator<View,PC_INT_BND>::x0; usingBinaryPropagator<View,PC_INT_BND>::x1; AbsBnd(Space&home,boolshare,AbsBnd&p); AbsBnd(Homehome,Viewx0,Viewx1); public: virtualActor*copy(Space&home,boolshare); virtualPropCostcost(constSpace&home,constModEventDelta&med)const; virtualExecStatuspropagate(Space&home,constModEventDelta&med); staticExecStatuspost(Homehome,Viewx0,Viewx1); }; template<classView> classAbsDom:publicBinaryPropagator<View,PC_INT_DOM>{ protected: usingBinaryPropagator<View,PC_INT_DOM>::x0; usingBinaryPropagator<View,PC_INT_DOM>::x1; AbsDom(Space&home,boolshare,AbsDom&p); AbsDom(Homehome,Viewx0,Viewx1); public: virtualActor*copy(Space&home,boolshare); virtualPropCostcost(constSpace&home,constModEventDelta&med)const; virtualExecStatuspropagate(Space&home,constModEventDelta&med); staticExecStatuspost(Homehome,Viewx0,Viewx1); }; }}} #include<gecode/int/arithmetic/abs.hpp> namespaceGecode{namespaceInt{namespaceArithmetic{ template<classView> classMaxBnd:publicTernaryPropagator<View,PC_INT_BND>{ protected: usingTernaryPropagator<View,PC_INT_BND>::x0; usingTernaryPropagator<View,PC_INT_BND>::x1; usingTernaryPropagator<View,PC_INT_BND>::x2; MaxBnd(Space&home,boolshare,MaxBnd&p); MaxBnd(Homehome,Viewx0,Viewx1,Viewx2); public: MaxBnd(Space&home,boolshare,Propagator&p,Viewx0,Viewx1,Viewx2); virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); staticExecStatuspost(Homehome,Viewx0,Viewx1,Viewx2); }; template<classView> classNaryMaxBnd:publicNaryOnePropagator<View,PC_INT_BND>{ protected: usingNaryOnePropagator<View,PC_INT_BND>::x; usingNaryOnePropagator<View,PC_INT_BND>::y; NaryMaxBnd(Space&home,boolshare,NaryMaxBnd&p); NaryMaxBnd(Homehome,ViewArray<View>&x,Viewy); public: virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); staticExecStatuspost(Homehome,ViewArray<View>&x,Viewy); }; template<classView> classMaxDom:publicTernaryPropagator<View,PC_INT_DOM>{ protected: usingTernaryPropagator<View,PC_INT_DOM>::x0; usingTernaryPropagator<View,PC_INT_DOM>::x1; usingTernaryPropagator<View,PC_INT_DOM>::x2; MaxDom(Space&home,boolshare,MaxDom&p); MaxDom(Homehome,Viewx0,Viewx1,Viewx2); public: MaxDom(Space&home,boolshare,Propagator&p,Viewx0,Viewx1,Viewx2); virtualActor*copy(Space&home,boolshare); virtualPropCostcost(constSpace&home,constModEventDelta&med)const; virtualExecStatuspropagate(Space&home,constModEventDelta&med); staticExecStatuspost(Homehome,Viewx0,Viewx1,Viewx2); }; template<classView> classNaryMaxDom:publicNaryOnePropagator<View,PC_INT_DOM>{ protected: usingNaryOnePropagator<View,PC_INT_DOM>::x; usingNaryOnePropagator<View,PC_INT_DOM>::y; NaryMaxDom(Space&home,boolshare,NaryMaxDom&p); NaryMaxDom(Homehome,ViewArray<View>&x,Viewy); public: virtualActor*copy(Space&home,boolshare); virtualPropCostcost(constSpace&home,constModEventDelta&med)const; virtualExecStatuspropagate(Space&home,constModEventDelta&med); staticExecStatuspost(Homehome,ViewArray<View>&x,Viewy); }; }}} #include<gecode/int/arithmetic/max.hpp> namespaceGecode{namespaceInt{namespaceArithmetic{ classSqrOps{ public: booleven(void)const; intexp(void)const; voidexp(intm); template<classIntType> IntTypepow(IntTypex)const; inttpow(intx)const; intfnroot(intx)const; intcnroot(intx)const; }; classPowOps{ protected: intn; staticbooleven(intm); boolpowgr(longlongintr,intx)const; boolpowle(longlongintr,intx)const; public: PowOps(intn); booleven(void)const; intexp(void)const; voidexp(intm); template<classIntType> IntTypepow(IntTypex)const; inttpow(intx)const; intfnroot(intx)const; intcnroot(intx)const; }; }}} #include<gecode/int/arithmetic/pow-ops.hpp> namespaceGecode{namespaceInt{namespaceArithmetic{ template<classVA,classVB,classOps> classPowPlusBnd:publicMixBinaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND>{ protected: usingMixBinaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND>::x0; usingMixBinaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND>::x1; Opsops; PowPlusBnd(Homehome,VAx0,VBx1,constOps&ops); PowPlusBnd(Space&home,boolshare,PowPlusBnd<VA,VB,Ops>&p); public: virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); staticExecStatuspost(Homehome,VAx0,VBx1,Opsops); }; template<classOps> classPowBnd:publicBinaryPropagator<IntView,PC_INT_BND>{ protected: usingBinaryPropagator<IntView,PC_INT_BND>::x0; usingBinaryPropagator<IntView,PC_INT_BND>::x1; Opsops; PowBnd(Space&home,boolshare,PowBnd&p); PowBnd(Homehome,IntViewx0,IntViewx1,constOps&ops); public: virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); staticExecStatuspost(Homehome,IntViewx0,IntViewx1,Opsops); }; template<classVA,classVB,classOps> classPowPlusDom:publicMixBinaryPropagator<VA,PC_INT_DOM,VB,PC_INT_DOM>{ protected: usingMixBinaryPropagator<VA,PC_INT_DOM,VB,PC_INT_DOM>::x0; usingMixBinaryPropagator<VA,PC_INT_DOM,VB,PC_INT_DOM>::x1; Opsops; PowPlusDom(Homehome,VAx0,VBx1,constOps&ops); PowPlusDom(Space&home,boolshare,PowPlusDom<VA,VB,Ops>&p); public: virtualActor*copy(Space&home,boolshare); virtualPropCostcost(constSpace&home,constModEventDelta&med)const; virtualExecStatuspropagate(Space&home,constModEventDelta&med); staticExecStatuspost(Homehome,VAx0,VBx1,Opsops); }; template<classOps> classPowDom:publicBinaryPropagator<IntView,PC_INT_DOM>{ protected: usingBinaryPropagator<IntView,PC_INT_DOM>::x0; usingBinaryPropagator<IntView,PC_INT_DOM>::x1; Opsops; PowDom(Space&home,boolshare,PowDom<Ops>&p); PowDom(Homehome,IntViewx0,IntViewx1,constOps&ops); public: virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); virtualPropCostcost(constSpace&home,constModEventDelta&med)const; staticExecStatuspost(Homehome,IntViewx0,IntViewx1,Opsops); }; }}} #include<gecode/int/arithmetic/pow.hpp> namespaceGecode{namespaceInt{namespaceArithmetic{ template<classOps,boolminus> classNrootPlusBnd:publicBinaryPropagator<IntView,PC_INT_BND>{ protected: usingBinaryPropagator<IntView,PC_INT_BND>::x0; usingBinaryPropagator<IntView,PC_INT_BND>::x1; Opsops; NrootPlusBnd(Space&home,boolshare,NrootPlusBnd<Ops,minus>&p); NrootPlusBnd(Homehome,IntViewx0,IntViewx1,constOps&ops); public: virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); staticExecStatuspost(Homehome,IntViewx0,IntViewx1,Opsops); }; template<classOps> classNrootBnd:publicBinaryPropagator<IntView,PC_INT_BND>{ protected: usingBinaryPropagator<IntView,PC_INT_BND>::x0; usingBinaryPropagator<IntView,PC_INT_BND>::x1; Opsops; NrootBnd(Space&home,boolshare,NrootBnd<Ops>&p); NrootBnd(Homehome,IntViewx0,IntViewx1,constOps&ops); public: virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); staticExecStatuspost(Homehome,IntViewx0,IntViewx1,Opsops); }; template<classOps,boolminus> classNrootPlusDom:publicBinaryPropagator<IntView,PC_INT_DOM>{ protected: usingBinaryPropagator<IntView,PC_INT_DOM>::x0; usingBinaryPropagator<IntView,PC_INT_DOM>::x1; Opsops; NrootPlusDom(Space&home,boolshare,NrootPlusDom<Ops,minus>&p); NrootPlusDom(Homehome,IntViewx0,IntViewx1,constOps&ops); public: virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); virtualPropCostcost(constSpace&home,constModEventDelta&med)const; staticExecStatuspost(Homehome,IntViewx0,IntViewx1,Opsops); }; template<classOps> classNrootDom:publicBinaryPropagator<IntView,PC_INT_DOM>{ protected: usingBinaryPropagator<IntView,PC_INT_DOM>::x0; usingBinaryPropagator<IntView,PC_INT_DOM>::x1; Opsops; NrootDom(Space&home,boolshare,NrootDom<Ops>&p); NrootDom(Homehome,IntViewx0,IntViewx1,constOps&ops); public: virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); virtualPropCostcost(constSpace&home,constModEventDelta&med)const; staticExecStatuspost(Homehome,IntViewx0,IntViewx1,Opsops); }; }}} #include<gecode/int/arithmetic/nroot.hpp> namespaceGecode{namespaceInt{namespaceArithmetic{ template<classView,PropCondpc> classMultZeroOne:publicBinaryPropagator<View,pc>{ protected: usingBinaryPropagator<View,pc>::x0; usingBinaryPropagator<View,pc>::x1; MultZeroOne(Space&home,boolshare,MultZeroOne<View,pc>&p); MultZeroOne(Homehome,Viewx0,Viewx1); staticRelTestequal(Viewx,intn); public: virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); staticExecStatuspost(Homehome,Viewx0,Viewx1); }; template<classVA,classVB,classVC> classMultPlusBnd: publicMixTernaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND,VC,PC_INT_BND>{ protected: usingMixTernaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND,VC,PC_INT_BND>::x0; usingMixTernaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND,VC,PC_INT_BND>::x1; usingMixTernaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND,VC,PC_INT_BND>::x2; public: MultPlusBnd(Homehome,VAx0,VBx1,VCx2); MultPlusBnd(Space&home,boolshare,MultPlusBnd<VA,VB,VC>&p); staticExecStatuspost(Homehome,VAx0,VBx1,VCx2); virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); }; classMultBnd:publicTernaryPropagator<IntView,PC_INT_BND>{ protected: usingTernaryPropagator<IntView,PC_INT_BND>::x0; usingTernaryPropagator<IntView,PC_INT_BND>::x1; usingTernaryPropagator<IntView,PC_INT_BND>::x2; MultBnd(Space&home,boolshare,MultBnd&p); public: MultBnd(Homehome,IntViewx0,IntViewx1,IntViewx2); GECODE_INT_EXPORT staticExecStatuspost(Homehome,IntViewx0,IntViewx1,IntViewx2); GECODE_INT_EXPORT virtualActor*copy(Space&home,boolshare); GECODE_INT_EXPORT virtualExecStatuspropagate(Space&home,constModEventDelta&med); }; template<classVA,classVB,classVC> classMultPlusDom: publicMixTernaryPropagator<VA,PC_INT_DOM,VB,PC_INT_DOM,VC,PC_INT_DOM>{ protected: usingMixTernaryPropagator<VA,PC_INT_DOM,VB,PC_INT_DOM,VC,PC_INT_DOM>::x0; usingMixTernaryPropagator<VA,PC_INT_DOM,VB,PC_INT_DOM,VC,PC_INT_DOM>::x1; usingMixTernaryPropagator<VA,PC_INT_DOM,VB,PC_INT_DOM,VC,PC_INT_DOM>::x2; public: MultPlusDom(Homehome,VAx0,VBx1,VCx2); MultPlusDom(Space&home,boolshare,MultPlusDom<VA,VB,VC>&p); staticExecStatuspost(Homehome,VAx0,VBx1,VCx2); virtualActor*copy(Space&home,boolshare); virtualPropCostcost(constSpace&home,constModEventDelta&med)const; virtualExecStatuspropagate(Space&home,constModEventDelta&med); }; classMultDom:publicTernaryPropagator<IntView,PC_INT_DOM>{ protected: usingTernaryPropagator<IntView,PC_INT_DOM>::x0; usingTernaryPropagator<IntView,PC_INT_DOM>::x1; usingTernaryPropagator<IntView,PC_INT_DOM>::x2; MultDom(Space&home,boolshare,MultDom&p); public: MultDom(Homehome,IntViewx0,IntViewx1,IntViewx2); GECODE_INT_EXPORT staticExecStatuspost(Homehome,IntViewx0,IntViewx1,IntViewx2); GECODE_INT_EXPORT virtualActor*copy(Space&home,boolshare); GECODE_INT_EXPORT virtualPropCostcost(constSpace&home,constModEventDelta&med)const; GECODE_INT_EXPORT virtualExecStatuspropagate(Space&home,constModEventDelta&med); }; }}} #include<gecode/int/arithmetic/mult.hpp> namespaceGecode{namespaceInt{namespaceArithmetic{ template<classVA,classVB,classVC> classDivPlusBnd: publicMixTernaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND,VC,PC_INT_BND>{ protected: usingMixTernaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND,VC,PC_INT_BND>::x0; usingMixTernaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND,VC,PC_INT_BND>::x1; usingMixTernaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND,VC,PC_INT_BND>::x2; public: DivPlusBnd(Homehome,VAx0,VBx1,VCx2); DivPlusBnd(Space&home,boolshare,DivPlusBnd<VA,VB,VC>&p); staticExecStatuspost(Homehome,VAx0,VBx1,VCx2); virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); }; template<classView> classDivBnd:publicTernaryPropagator<View,PC_INT_BND>{ protected: usingTernaryPropagator<View,PC_INT_BND>::x0; usingTernaryPropagator<View,PC_INT_BND>::x1; usingTernaryPropagator<View,PC_INT_BND>::x2; DivBnd(Space&home,boolshare,DivBnd<View>&p); public: DivBnd(Homehome,Viewx0,Viewx1,Viewx2); staticExecStatuspost(Homehome,Viewx0,Viewx1,Viewx2); virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); }; template<classView> classDivMod:publicTernaryPropagator<View,PC_INT_BND>{ protected: usingTernaryPropagator<View,PC_INT_BND>::x0; usingTernaryPropagator<View,PC_INT_BND>::x1; usingTernaryPropagator<View,PC_INT_BND>::x2; DivMod(Space&home,boolshare,DivMod<View>&p); public: DivMod(Homehome,Viewx0,Viewx1,Viewx2); staticExecStatuspost(Homehome,Viewx0,Viewx1,Viewx2); virtualActor*copy(Space&home,boolshare); virtualExecStatuspropagate(Space&home,constModEventDelta&med); }; }}} #include<gecode/int/arithmetic/divmod.hpp> #endif //STATISTICS:int-prop