minimodel.hh gecode/kernel.hh gecode/int.hh gecode/minimodel/exception.hpp iostream gecode/support/auto-link.hpp gecode/minimodel/int-rel.hpp gecode/minimodel/float-rel.hpp gecode/minimodel/bool-expr.hpp gecode/minimodel/set-expr.hpp gecode/minimodel/set-rel.hpp gecode/minimodel/matrix.hpp gecode/minimodel/ldsb.hpp gecode/minimodel/optimize.hpp /usr/include/gecode/driver.hh Gecode::NonLinIntExpr Gecode::LinIntExpr Gecode::LinIntRel Gecode::BoolExpr Gecode::BoolExpr::MiscExpr Gecode::REG Gecode::Matrix Gecode::Slice Gecode::Matrix Gecode::MiniModel::IntOptimizeSpace Gecode Gecode::MiniModel GECODE_MINIMODEL_EXPORT GECODE_LIBRARY_NAME "MiniModel" /*-*-mode:C++;c-basic-offset:2;indent-tabs-mode:nil-*-*/ /* *Mainauthors: *ChristianSchulte<schulte@gecode.org> *GuidoTack<tack@gecode.org> *MikaelLagerkvist<lagerkvist@gecode.org> *VincentBarichard<Vincent.Barichard@univ-angers.fr> * *Copyright: *ChristianSchulte,2004 *GuidoTack,2004 *MikaelLagerkvist,2005 *VincentBarichard,2012 * *Lastmodified: *$Date:2013-08-1914:00:39+0200(Mon,19Aug2013)$by$Author:schulte$ *$Revision:13982$ * *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_MINIMODEL_HH__ #define__GECODE_MINIMODEL_HH__ #include<gecode/kernel.hh> #include<gecode/int.hh> #ifdefGECODE_HAS_SET_VARS #include<gecode/set.hh> #endif #ifdefGECODE_HAS_FLOAT_VARS #include<gecode/float.hh> #endif #include<gecode/minimodel/exception.hpp> #include<iostream> /* *SupportforDLLsunderWindows * */ #if!defined(GECODE_STATIC_LIBS)&&\ (defined(__CYGWIN__)||defined(__MINGW32__)||defined(_MSC_VER)) #ifdefGECODE_BUILD_MINIMODEL #defineGECODE_MINIMODEL_EXPORT__declspec(dllexport) #else #defineGECODE_MINIMODEL_EXPORT__declspec(dllimport) #endif #else #ifdefGECODE_GCC_HAS_CLASS_VISIBILITY #defineGECODE_MINIMODEL_EXPORT__attribute__((visibility("default"))) #else #defineGECODE_MINIMODEL_EXPORT #endif #endif //Configureauto-linking #ifndefGECODE_BUILD_MINIMODEL #defineGECODE_LIBRARY_NAME"MiniModel" #include<gecode/support/auto-link.hpp> #endif namespaceGecode{ namespaceMiniModel{} classLinIntRel; #ifdefGECODE_HAS_SET_VARS classSetExpr; #endif #ifdefGECODE_HAS_FLOAT_VARS classLinFloatExpr; #endif classNonLinIntExpr{ public: virtualIntVarpost(Homehome,IntVar*ret,IntConLevelicl)const=0; virtualvoidpost(Homehome,IntRelTypeirt,intc, IntConLevelicl)const=0; virtualvoidpost(Homehome,IntRelTypeirt,intc, BoolVarb,IntConLevelicl)const=0; virtual~NonLinIntExpr(void){} staticIntVarresult(Homehome,IntVar*x){ if(x==NULL) returnIntVar(home,Int::Limits::min,Int::Limits::max); return*x; } staticIntVarresult(Homehome,IntVar*x,IntVary){ if(x!=NULL) rel(home,*x,IRT_EQ,y); returny; } void*operatornew(size_tsize){returnheap.ralloc(size);} voidoperatordelete(void*p,size_t){heap.rfree(p);} }; classLinIntExpr{ friendclassLinIntRel; #ifdefGECODE_HAS_SET_VARS friendclassSetExpr; #endif #ifdefGECODE_HAS_FLOAT_VARS friendclassLinFloatExpr; #endif public: enumNodeType{ NT_CONST, NT_VAR_INT, NT_VAR_BOOL, NT_NONLIN, NT_SUM_INT, NT_SUM_BOOL, NT_ADD, NT_SUB, NT_MUL }; private: classNode; Node*n; public: GECODE_MINIMODEL_EXPORT LinIntExpr(void); GECODE_MINIMODEL_EXPORT LinIntExpr(intc); GECODE_MINIMODEL_EXPORT LinIntExpr(constIntVar&x,inta=1); GECODE_MINIMODEL_EXPORT LinIntExpr(constBoolVar&x,inta=1); GECODE_MINIMODEL_EXPORT explicitLinIntExpr(constIntVarArgs&x); GECODE_MINIMODEL_EXPORT LinIntExpr(constIntArgs&a,constIntVarArgs&x); GECODE_MINIMODEL_EXPORT explicitLinIntExpr(constBoolVarArgs&x); GECODE_MINIMODEL_EXPORT LinIntExpr(constIntArgs&a,constBoolVarArgs&x); GECODE_MINIMODEL_EXPORT LinIntExpr(constLinIntExpr&e); GECODE_MINIMODEL_EXPORT LinIntExpr(constLinIntExpr&e0,NodeTypet,constLinIntExpr&e1); GECODE_MINIMODEL_EXPORT LinIntExpr(constLinIntExpr&e0,NodeTypet,intc); GECODE_MINIMODEL_EXPORT LinIntExpr(inta,constLinIntExpr&e); GECODE_MINIMODEL_EXPORT explicitLinIntExpr(NonLinIntExpr*e); GECODE_MINIMODEL_EXPORT constLinIntExpr&operator =(constLinIntExpr&e); GECODE_MINIMODEL_EXPORT voidpost(Homehome,IntRelTypeirt,IntConLevelicl)const; GECODE_MINIMODEL_EXPORT voidpost(Homehome,IntRelTypeirt,constBoolVar&b, IntConLevelicl)const; GECODE_MINIMODEL_EXPORT IntVarpost(Homehome,IntConLevelicl)const; GECODE_MINIMODEL_EXPORT NonLinIntExpr*nle(void)const; GECODE_MINIMODEL_EXPORT ~LinIntExpr(void); }; classBoolExpr; classLinIntRel{ friendclassBoolExpr; private: LinIntExpre; IntRelTypeirt; staticIntRelTypeneg(IntRelTypeirt); LinIntRel(void); public: LinIntRel(constLinIntExpr&l,IntRelTypeirt,constLinIntExpr&r); LinIntRel(constLinIntExpr&l,IntRelTypeirt,intr); LinIntRel(intl,IntRelTypeirt,constLinIntExpr&r); voidpost(Homehome,boolt,IntConLevelicl)const; voidpost(Homehome,constBoolVar&b,boolt,IntConLevelicl)const; }; GECODE_MINIMODEL_EXPORTLinIntExpr operator +(int,constIntVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(int,constBoolVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(int,constLinIntExpr&); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(constIntVar&,int); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(constBoolVar&,int); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(constLinIntExpr&,int); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(constIntVar&,constIntVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(constIntVar&,constBoolVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(constBoolVar&,constIntVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(constBoolVar&,constBoolVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(constIntVar&,constLinIntExpr&); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(constBoolVar&,constLinIntExpr&); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(constLinIntExpr&,constIntVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(constLinIntExpr&,constBoolVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator +(constLinIntExpr&,constLinIntExpr&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(int,constIntVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(int,constBoolVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(int,constLinIntExpr&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constIntVar&,int); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constBoolVar&,int); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constLinIntExpr&,int); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constIntVar&,constIntVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constIntVar&,constBoolVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constBoolVar&,constIntVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constBoolVar&,constBoolVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constIntVar&,constLinIntExpr&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constBoolVar&,constLinIntExpr&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constLinIntExpr&,constIntVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constLinIntExpr&,constBoolVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constLinIntExpr&,constLinIntExpr&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constIntVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constBoolVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator -(constLinIntExpr&); GECODE_MINIMODEL_EXPORTLinIntExpr operator *(int,constIntVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator *(int,constBoolVar&); GECODE_MINIMODEL_EXPORTLinIntExpr operator *(constIntVar&,int); GECODE_MINIMODEL_EXPORTLinIntExpr operator *(constBoolVar&,int); GECODE_MINIMODEL_EXPORTLinIntExpr operator *(constLinIntExpr&,int); GECODE_MINIMODEL_EXPORTLinIntExpr operator *(int,constLinIntExpr&); GECODE_MINIMODEL_EXPORTLinIntExpr sum(constIntVarArgs&x); GECODE_MINIMODEL_EXPORTLinIntExpr sum(constIntArgs&a,constIntVarArgs&x); GECODE_MINIMODEL_EXPORTLinIntExpr sum(constBoolVarArgs&x); GECODE_MINIMODEL_EXPORTLinIntExpr sum(constIntArgs&a,constBoolVarArgs&x); GECODE_MINIMODEL_EXPORTLinIntExpr sum(constIntArgs&args); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(intl,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(intl,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(intl,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(constIntVar&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(constBoolVar&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(constLinIntExpr&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(constIntVar&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(constIntVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(constBoolVar&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(constBoolVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(constIntVar&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(constBoolVar&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(constLinIntExpr&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(constLinIntExpr&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator ==(constLinIntExpr&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(intl,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(intl,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(intl,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(constIntVar&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(constBoolVar&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(constLinIntExpr&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(constIntVar&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(constIntVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(constBoolVar&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(constBoolVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(constIntVar&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(constBoolVar&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(constLinIntExpr&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(constLinIntExpr&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator !=(constLinIntExpr&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <(intl,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <(intl,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <(intl,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <(constIntVar&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator <(constBoolVar&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator <(constLinIntExpr&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator <(constIntVar&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <(constIntVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <(constBoolVar&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <(constBoolVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <(constIntVar&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <(constBoolVar&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <(constLinIntExpr&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <(constLinIntExpr&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <(constLinIntExpr&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(intl,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(intl,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(intl,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(constIntVar&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(constBoolVar&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(constLinIntExpr&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(constIntVar&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(constIntVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(constBoolVar&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(constBoolVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(constIntVar&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(constBoolVar&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(constLinIntExpr&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(constLinIntExpr&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator <=(constLinIntExpr&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >(intl,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >(intl,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >(intl,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >(constIntVar&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator >(constBoolVar&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator >(constLinIntExpr&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator >(constIntVar&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >(constIntVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >(constBoolVar&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >(constBoolVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >(constIntVar&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >(constBoolVar&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >(constLinIntExpr&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >(constLinIntExpr&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >(constLinIntExpr&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(intl,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(intl,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(intl,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(constIntVar&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(constBoolVar&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(constLinIntExpr&l,intr); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(constIntVar&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(constIntVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(constBoolVar&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(constBoolVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(constIntVar&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(constBoolVar&l,constLinIntExpr&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(constLinIntExpr&l,constIntVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(constLinIntExpr&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinIntRel operator >=(constLinIntExpr&l,constLinIntExpr&r); #ifdefGECODE_HAS_FLOAT_VARS classNonLinFloatExpr{ public: virtualFloatVarpost(Homehome,FloatVar*ret)const=0; virtualvoidpost(Homehome,FloatRelTypefrt,FloatValc)const=0; virtualvoidpost(Homehome,FloatRelTypefrt,FloatValc, BoolVarb)const=0; virtual~NonLinFloatExpr(void){} staticFloatVarresult(Homehome,FloatVar*x){ if(x==NULL) returnFloatVar(home,Float::Limits::min,Float::Limits::max); return*x; } staticFloatVarresult(Homehome,FloatVar*x,FloatVary){ if(x!=NULL) rel(home,*x,FRT_EQ,y); returny; } void*operatornew(size_tsize){returnheap.ralloc(size);} voidoperatordelete(void*p,size_t){heap.rfree(p);} }; classLinFloatExpr{ friendclassLinFloatRel; public: enumNodeType{ NT_CONST, NT_VAR, NT_NONLIN, NT_SUM, NT_ADD, NT_SUB, NT_MUL }; private: classNode; Node*n; public: GECODE_MINIMODEL_EXPORT LinFloatExpr(void); GECODE_MINIMODEL_EXPORT LinFloatExpr(constFloatVal&c); GECODE_MINIMODEL_EXPORT LinFloatExpr(constFloatVar&x); GECODE_MINIMODEL_EXPORT LinFloatExpr(constFloatVar&x,FloatVala); GECODE_MINIMODEL_EXPORT explicitLinFloatExpr(constFloatVarArgs&x); GECODE_MINIMODEL_EXPORT LinFloatExpr(constFloatValArgs&a,constFloatVarArgs&x); GECODE_MINIMODEL_EXPORT LinFloatExpr(constLinFloatExpr&e); GECODE_MINIMODEL_EXPORT LinFloatExpr(constLinFloatExpr&e0,NodeTypet,constLinFloatExpr&e1); GECODE_MINIMODEL_EXPORT LinFloatExpr(constLinFloatExpr&e0,NodeTypet,constFloatVal&c); GECODE_MINIMODEL_EXPORT LinFloatExpr(FloatVala,constLinFloatExpr&e); GECODE_MINIMODEL_EXPORT explicitLinFloatExpr(NonLinFloatExpr*e); GECODE_MINIMODEL_EXPORT constLinFloatExpr&operator=(constLinFloatExpr&e); GECODE_MINIMODEL_EXPORT voidpost(Homehome,FloatRelTypefrt)const; GECODE_MINIMODEL_EXPORT voidpost(Homehome,FloatRelTypefrt,constBoolVar&b)const; GECODE_MINIMODEL_EXPORT FloatVarpost(Homehome)const; GECODE_MINIMODEL_EXPORT NonLinFloatExpr*nlfe(void)const; GECODE_MINIMODEL_EXPORT ~LinFloatExpr(void); }; classBoolExpr; classLinFloatRel{ friendclassBoolExpr; private: LinFloatExpre; FloatRelTypefrt; staticFloatRelTypeneg(FloatRelTypefrt); LinFloatRel(void); public: LinFloatRel(constLinFloatExpr&l,FloatRelTypefrt,constLinFloatExpr&r); LinFloatRel(constLinFloatExpr&l,FloatRelTypefrt,FloatValr); LinFloatRel(FloatVall,FloatRelTypefrt,constLinFloatExpr&r); voidpost(Homehome,boolt)const; voidpost(Homehome,constBoolVar&b,boolt)const; }; GECODE_MINIMODEL_EXPORTLinFloatExpr operator +(constFloatVal&,constFloatVar&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator +(constFloatVal&,constLinFloatExpr&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator +(constFloatVar&,constFloatVal&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator +(constLinFloatExpr&,constFloatVal&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator +(constFloatVar&,constFloatVar&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator +(constFloatVar&,constLinFloatExpr&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator +(constLinFloatExpr&,constFloatVar&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator +(constLinFloatExpr&,constLinFloatExpr&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator -(constFloatVal&,constFloatVar&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator -(constFloatVal&,constLinFloatExpr&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator -(constFloatVar&,constFloatVal&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator -(constLinFloatExpr&,constFloatVal&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator -(constFloatVar&,constFloatVar&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator -(constFloatVar&,constLinFloatExpr&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator -(constLinFloatExpr&,constFloatVar&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator -(constLinFloatExpr&,constLinFloatExpr&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator -(constFloatVar&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator -(constLinFloatExpr&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator *(constFloatVal&,constFloatVar&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator *(constFloatVar&,constFloatVal&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator *(constLinFloatExpr&,constFloatVal&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator *(constFloatVal&,constLinFloatExpr&); GECODE_MINIMODEL_EXPORTLinFloatExpr sum(constFloatVarArgs&x); GECODE_MINIMODEL_EXPORTLinFloatExpr sum(constFloatValArgs&a,constFloatVarArgs&x); GECODE_MINIMODEL_EXPORTLinFloatRel operator ==(constFloatVal&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator ==(constFloatVal&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator ==(constFloatVar&l,constFloatVal&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator ==(constLinFloatExpr&l,constFloatVal&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator ==(constFloatVar&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator ==(constFloatVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator ==(constFloatVar&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator ==(constLinFloatExpr&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator ==(constLinFloatExpr&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator ==(constLinFloatExpr&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator !=(constFloatVal&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator !=(constFloatVal&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator !=(constFloatVar&l,constFloatVal&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator !=(constLinFloatExpr&l,constFloatVal&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator !=(constFloatVar&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator !=(constFloatVar&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator !=(constFloatVar&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator !=(constLinFloatExpr&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator !=(constLinFloatExpr&l,constBoolVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator !=(constLinFloatExpr&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <(constFloatVal&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <(constFloatVal&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <(constFloatVar&l,constFloatVal&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <(constLinFloatExpr&l,constFloatVal&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <(constFloatVar&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <(constFloatVar&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <(constLinFloatExpr&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <(constLinFloatExpr&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <=(constFloatVal&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <=(constFloatVal&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <=(constFloatVar&l,constFloatVal&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <=(constLinFloatExpr&l,constFloatVal&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <=(constFloatVar&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <=(constFloatVar&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <=(constLinFloatExpr&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator <=(constLinFloatExpr&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >(constFloatVal&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >(constFloatVal&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >(constFloatVar&l,constFloatVal&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >(constLinFloatExpr&l,constFloatVal&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >(constFloatVar&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >(constFloatVar&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >(constLinFloatExpr&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >(constLinFloatExpr&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >=(constFloatVal&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >=(constFloatVal&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >=(constFloatVar&l,constFloatVal&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >=(constLinFloatExpr&l,constFloatVal&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >=(constFloatVar&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >=(constFloatVar&l,constLinFloatExpr&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >=(constLinFloatExpr&l,constFloatVar&r); GECODE_MINIMODEL_EXPORTLinFloatRel operator >=(constLinFloatExpr&l,constLinFloatExpr&r); #endif #ifdefGECODE_HAS_SET_VARS classSetExpr{ public: enumNodeType{ NT_VAR, NT_CONST, NT_LEXP, NT_CMPL, NT_INTER, NT_UNION, NT_DUNION }; classNode; private: Node*n; public: SetExpr(void); GECODE_MINIMODEL_EXPORT SetExpr(constSetExpr&e); GECODE_MINIMODEL_EXPORT SetExpr(constSetExpr&l,NodeTypet,constSetExpr&r); GECODE_MINIMODEL_EXPORT SetExpr(constSetVar&x); GECODE_MINIMODEL_EXPORT explicitSetExpr(constLinIntExpr&x); GECODE_MINIMODEL_EXPORT SetExpr(constIntSet&s); GECODE_MINIMODEL_EXPORT SetExpr(constSetExpr&e,NodeTypet); GECODE_MINIMODEL_EXPORT SetVarpost(Homehome)const; GECODE_MINIMODEL_EXPORT voidpost(Homehome,SetRelTypesrt,constSetExpr&e)const; GECODE_MINIMODEL_EXPORT voidpost(Homehome,BoolVarb,boolt, SetRelTypesrt,constSetExpr&e)const; GECODE_MINIMODEL_EXPORT constSetExpr&operator=(constSetExpr&e); GECODE_MINIMODEL_EXPORT ~SetExpr(void); }; classSetCmpRel{ public: SetExprl; SetExprr; SetRelTypesrt; SetCmpRel(constSetExpr&l,SetRelTypesrt,constSetExpr&r); }; classSetRel{ private: SetExpr_e0; SetRelType_srt; SetExpr_e1; public: SetRel(void); SetRel(constSetExpr&e0,SetRelTypesrt,constSetExpr&e1); SetRel(constSetCmpRel&r); voidpost(Homehome,boolt)const; voidpost(Homehome,BoolVarb,boolt)const; }; GECODE_MINIMODEL_EXPORTSetExpr singleton(constLinIntExpr&); GECODE_MINIMODEL_EXPORTSetExpr operator-(constSetExpr&); GECODE_MINIMODEL_EXPORTSetExpr operator&(constSetExpr&,constSetExpr&); GECODE_MINIMODEL_EXPORTSetExpr operator|(constSetExpr&,constSetExpr&); GECODE_MINIMODEL_EXPORTSetExpr operator+(constSetExpr&,constSetExpr&); GECODE_MINIMODEL_EXPORTSetExpr operator-(constSetExpr&,constSetExpr&); GECODE_MINIMODEL_EXPORTSetExpr inter(constSetVarArgs&); GECODE_MINIMODEL_EXPORTSetExpr setunion(constSetVarArgs&); GECODE_MINIMODEL_EXPORTSetExpr setdunion(constSetVarArgs&); GECODE_MINIMODEL_EXPORTLinIntExpr cardinality(constSetExpr&); GECODE_MINIMODEL_EXPORTLinIntExpr min(constSetExpr&); GECODE_MINIMODEL_EXPORTLinIntExpr max(constSetExpr&); GECODE_MINIMODEL_EXPORTSetRel operator==(constSetExpr&,constSetExpr&); GECODE_MINIMODEL_EXPORTSetRel operator!=(constSetExpr&,constSetExpr&); GECODE_MINIMODEL_EXPORTSetCmpRel operator<=(constSetExpr&,constSetExpr&); GECODE_MINIMODEL_EXPORTBoolExpr operator<=(constSetCmpRel&,constSetExpr&); GECODE_MINIMODEL_EXPORTSetCmpRel operator>=(constSetExpr&,constSetExpr&); GECODE_MINIMODEL_EXPORTBoolExpr operator>=(constSetCmpRel&,constSetExpr&); GECODE_MINIMODEL_EXPORTSetRel operator ||(constSetExpr&,constSetExpr&); #endif classBoolExpr{ public: enumNodeType{ NT_VAR, NT_NOT, NT_AND, NT_OR, NT_EQV, NT_RLIN, NT_RLINFLOAT, NT_RSET, NT_MISC }; classMiscExpr{ public: virtualvoidpost(Space&home,BoolVarb,boolneg, IntConLevelicl)=0; virtualGECODE_MINIMODEL_EXPORT~MiscExpr(void); staticvoid*operatornew(size_tsize); staticvoidoperatordelete(void*p,size_tsize); }; classNode; private: Node*n; public: GECODE_MINIMODEL_EXPORT BoolExpr(void); GECODE_MINIMODEL_EXPORT BoolExpr(constBoolExpr&e); GECODE_MINIMODEL_EXPORT BoolExpr(constBoolExpr&l,NodeTypet,constBoolExpr&r); GECODE_MINIMODEL_EXPORT BoolExpr(constBoolVar&x); GECODE_MINIMODEL_EXPORT BoolExpr(constBoolExpr&e,NodeTypet); GECODE_MINIMODEL_EXPORT BoolExpr(constLinIntRel&rl); #ifdefGECODE_HAS_FLOAT_VARS GECODE_MINIMODEL_EXPORT BoolExpr(constLinFloatRel&rfl); #endif #ifdefGECODE_HAS_SET_VARS GECODE_MINIMODEL_EXPORT BoolExpr(constSetRel&rs); GECODE_MINIMODEL_EXPORT BoolExpr(constSetCmpRel&rs); #endif GECODE_MINIMODEL_EXPORT explicitBoolExpr(MiscExpr*m); GECODE_MINIMODEL_EXPORT BoolVarexpr(Homehome,IntConLevelicl)const; GECODE_MINIMODEL_EXPORT voidrel(Homehome,IntConLevelicl)const; GECODE_MINIMODEL_EXPORT constBoolExpr&operator =(constBoolExpr&e); GECODE_MINIMODEL_EXPORT ~BoolExpr(void); }; GECODE_MINIMODEL_EXPORTBoolExpr operator !(constBoolExpr&); GECODE_MINIMODEL_EXPORTBoolExpr operator &&(constBoolExpr&,constBoolExpr&); GECODE_MINIMODEL_EXPORTBoolExpr operator ||(constBoolExpr&,constBoolExpr&); GECODE_MINIMODEL_EXPORTBoolExpr operator ^(constBoolExpr&,constBoolExpr&); GECODE_MINIMODEL_EXPORTBoolExpr operator !=(constBoolExpr&,constBoolExpr&); GECODE_MINIMODEL_EXPORTBoolExpr operator ==(constBoolExpr&,constBoolExpr&); GECODE_MINIMODEL_EXPORTBoolExpr operator >>(constBoolExpr&,constBoolExpr&); GECODE_MINIMODEL_EXPORTBoolExpr operator <<(constBoolExpr&,constBoolExpr&); GECODE_MINIMODEL_EXPORTIntVar expr(Homehome,constLinIntExpr&e,IntConLevelicl=ICL_DEF); #ifdefGECODE_HAS_FLOAT_VARS GECODE_MINIMODEL_EXPORTFloatVar expr(Homehome,constLinFloatExpr&e); #endif #ifdefGECODE_HAS_SET_VARS GECODE_MINIMODEL_EXPORTSetVar expr(Homehome,constSetExpr&e); #endif GECODE_MINIMODEL_EXPORTBoolVar expr(Homehome,constBoolExpr&e,IntConLevelicl=ICL_DEF); GECODE_MINIMODEL_EXPORTvoid rel(Homehome,constBoolExpr&e,IntConLevelicl=ICL_DEF); } #include<gecode/minimodel/int-rel.hpp> #include<gecode/minimodel/float-rel.hpp> #include<gecode/minimodel/bool-expr.hpp> #include<gecode/minimodel/set-expr.hpp> #include<gecode/minimodel/set-rel.hpp> namespaceGecode{ namespaceMiniModel{ classExpInfo; } classGECODE_MINIMODEL_EXPORTREG{ friendclassMiniModel::ExpInfo; private: classExp; Exp*e; REG(Exp*e); public: REG(void); REG(ints); REG(constIntArgs&x); REG(constREG&r); constREG&operator=(constREG&r); REGoperator +(constREG&r); REG&operator+=(constREG&r); REGoperator|(constREG&r); REG&operator|=(constREG&r); REGoperator *(void); REGoperator +(void); REGoperator()(unsignedintn,unsignedintm); REGoperator()(unsignedintn); template<classChar,classTraits> std::basic_ostream<Char,Traits>& print(std::basic_ostream<Char,Traits>&os)const; operatorDFA(void); ~REG(void); }; template<classChar,classTraits> std::basic_ostream<Char,Traits>& operator<<(std::basic_ostream<Char,Traits>&os,constREG&r); GECODE_MINIMODEL_EXPORTLinIntExpr abs(constLinIntExpr&e); GECODE_MINIMODEL_EXPORTLinIntExpr min(constLinIntExpr&x,constLinIntExpr&y); GECODE_MINIMODEL_EXPORTLinIntExpr min(constIntVarArgs&x); GECODE_MINIMODEL_EXPORTLinIntExpr max(constLinIntExpr&x,constLinIntExpr&y); GECODE_MINIMODEL_EXPORTLinIntExpr max(constIntVarArgs&x); #ifdefGECODE_HAS_FLOAT_VARS GECODE_MINIMODEL_EXPORTLinFloatExpr operator *(constFloatVar&,constFloatVar&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator *(constFloatVar&,constLinFloatExpr&); GECODE_MINIMODEL_EXPORTLinFloatExpr operator *(constLinFloatExpr&,constFloatVar&); #endif GECODE_MINIMODEL_EXPORTLinIntExpr operator *(constLinIntExpr&x,constLinIntExpr&y); GECODE_MINIMODEL_EXPORTLinIntExpr operator /(constLinIntExpr&x,constLinIntExpr&y); GECODE_MINIMODEL_EXPORTLinIntExpr operator %(constLinIntExpr&x,constLinIntExpr&y); GECODE_MINIMODEL_EXPORTLinIntExpr sqr(constLinIntExpr&x); GECODE_MINIMODEL_EXPORTLinIntExpr sqrt(constLinIntExpr&x); GECODE_MINIMODEL_EXPORTLinIntExpr pow(constLinIntExpr&x,intn); GECODE_MINIMODEL_EXPORTLinIntExpr nroot(constLinIntExpr&x,intn); GECODE_MINIMODEL_EXPORTLinIntExpr element(constIntVarArgs&x,constLinIntExpr&y); GECODE_MINIMODEL_EXPORTBoolExpr element(constBoolVarArgs&x,constLinIntExpr&y); GECODE_MINIMODEL_EXPORTLinIntExpr element(constIntArgs&x,constLinIntExpr&y); GECODE_MINIMODEL_EXPORTLinIntExpr ite(constBoolExpr&b,constLinIntExpr&x,constLinIntExpr&y); #ifdefGECODE_HAS_FLOAT_VARS GECODE_MINIMODEL_EXPORTLinFloatExpr abs(constLinFloatExpr&e); GECODE_MINIMODEL_EXPORTLinFloatExpr min(constLinFloatExpr&x,constLinFloatExpr&y); GECODE_MINIMODEL_EXPORTLinFloatExpr min(constFloatVarArgs&x); GECODE_MINIMODEL_EXPORTLinFloatExpr max(constLinFloatExpr&x,constLinFloatExpr&y); GECODE_MINIMODEL_EXPORTLinFloatExpr max(constFloatVarArgs&x); GECODE_MINIMODEL_EXPORTLinFloatExpr operator *(constLinFloatExpr&x,constLinFloatExpr&y); GECODE_MINIMODEL_EXPORTLinFloatExpr operator /(constLinFloatExpr&x,constLinFloatExpr&y); GECODE_MINIMODEL_EXPORTLinFloatExpr sqr(constLinFloatExpr&x); GECODE_MINIMODEL_EXPORTLinFloatExpr sqrt(constLinFloatExpr&x); GECODE_MINIMODEL_EXPORTLinFloatExpr pow(constLinFloatExpr&x,intn); GECODE_MINIMODEL_EXPORTLinFloatExpr nroot(constLinFloatExpr&x,intn); #ifdefGECODE_HAS_MPFR GECODE_MINIMODEL_EXPORTLinFloatExpr exp(constLinFloatExpr&x); GECODE_MINIMODEL_EXPORTLinFloatExpr log(constLinFloatExpr&x); GECODE_MINIMODEL_EXPORTLinFloatExpr asin(constLinFloatExpr&x); GECODE_MINIMODEL_EXPORTLinFloatExpr sin(constLinFloatExpr&x); GECODE_MINIMODEL_EXPORTLinFloatExpr acos(constLinFloatExpr&x); GECODE_MINIMODEL_EXPORTLinFloatExpr cos(constLinFloatExpr&x); GECODE_MINIMODEL_EXPORTLinFloatExpr atan(constLinFloatExpr&x); GECODE_MINIMODEL_EXPORTLinFloatExpr tan(constLinFloatExpr&x); #endif #endif inlineBoolVar channel(Homehome,IntVarx, IntConLevelicl=ICL_DEF){ (void)icl; BoolVarb(home,0,1);channel(home,b,x); returnb; } inlineIntVar channel(Homehome,BoolVarb, IntConLevelicl=ICL_DEF){ (void)icl; IntVarx(home,0,1);channel(home,b,x); returnx; } #ifdefGECODE_HAS_FLOAT_VARS inlineIntVar channel(Homehome,FloatVarf){ intmin=static_cast<int>(std::max(static_cast<double>(Int::Limits::min), std::ceil(f.min()))); intmax=static_cast<int>(std::min(static_cast<double>(Int::Limits::max), std::floor(f.max()))); IntVarx(home,min,max); channel(home,f,x); returnx; } #endif #ifdefGECODE_HAS_SET_VARS inlineSetVar channel(Homehome,constIntVarArgs&x,IntConLevelicl=ICL_DEF){ (void)icl; SetVars(home,IntSet::empty,Set::Limits::min,Set::Limits::max); rel(home,SOT_UNION,x,s); nvalues(home,x,IRT_EQ,expr(home,cardinality(s))); returns; } #endif } namespaceGecode{ inlinevoid atmost(Homehome,constIntVarArgs&x,intn,intm, IntConLevelicl=ICL_DEF){ count(home,x,n,IRT_LQ,m,icl); } inlinevoid atmost(Homehome,constIntVarArgs&x,IntVary,intm, IntConLevelicl=ICL_DEF){ count(home,x,y,IRT_LQ,m,icl); } inlinevoid atmost(Homehome,constIntVarArgs&x,constIntArgs&y,intm, IntConLevelicl=ICL_DEF){ count(home,x,y,IRT_LQ,m,icl); } inlinevoid atmost(Homehome,constIntVarArgs&x,intn,IntVarz, IntConLevelicl=ICL_DEF){ count(home,x,n,IRT_LQ,z,icl); } inlinevoid atmost(Homehome,constIntVarArgs&x,IntVary,IntVarz, IntConLevelicl=ICL_DEF){ count(home,x,y,IRT_LQ,z,icl); } inlinevoid atmost(Homehome,constIntVarArgs&x,constIntArgs&y,IntVarz, IntConLevelicl=ICL_DEF){ count(home,x,y,IRT_LQ,z,icl); } inlinevoid atleast(Homehome,constIntVarArgs&x,intn,intm, IntConLevelicl=ICL_DEF){ count(home,x,n,IRT_GQ,m,icl); } inlinevoid atleast(Homehome,constIntVarArgs&x,IntVary,intm, IntConLevelicl=ICL_DEF){ count(home,x,y,IRT_GQ,m,icl); } inlinevoid atleast(Homehome,constIntVarArgs&x,constIntArgs&y,intm, IntConLevelicl=ICL_DEF){ count(home,x,y,IRT_GQ,m,icl); } inlinevoid atleast(Homehome,constIntVarArgs&x,intn,IntVarz, IntConLevelicl=ICL_DEF){ count(home,x,n,IRT_GQ,z,icl); } inlinevoid atleast(Homehome,constIntVarArgs&x,IntVary,IntVarz, IntConLevelicl=ICL_DEF){ count(home,x,y,IRT_GQ,z,icl); } inlinevoid atleast(Homehome,constIntVarArgs&x,constIntArgs&y,IntVarz, IntConLevelicl=ICL_DEF){ count(home,x,y,IRT_GQ,z,icl); } inlinevoid exactly(Homehome,constIntVarArgs&x,intn,intm, IntConLevelicl=ICL_DEF){ count(home,x,n,IRT_EQ,m,icl); } inlinevoid exactly(Homehome,constIntVarArgs&x,IntVary,intm, IntConLevelicl=ICL_DEF){ count(home,x,y,IRT_EQ,m,icl); } inlinevoid exactly(Homehome,constIntVarArgs&x,constIntArgs&y,intm, IntConLevelicl=ICL_DEF){ count(home,x,y,IRT_EQ,m,icl); } inlinevoid exactly(Homehome,constIntVarArgs&x,intn,IntVarz, IntConLevelicl=ICL_DEF){ count(home,x,n,IRT_EQ,z,icl); } inlinevoid exactly(Homehome,constIntVarArgs&x,IntVary,IntVarz, IntConLevelicl=ICL_DEF){ count(home,x,y,IRT_EQ,z,icl); } inlinevoid exactly(Homehome,constIntVarArgs&x,constIntArgs&y,IntVarz, IntConLevelicl=ICL_DEF){ count(home,x,y,IRT_EQ,z,icl); } inlinevoid lex(Homehome,constIntVarArgs&x,IntRelTyper,constIntVarArgs&y, IntConLevelicl=ICL_DEF){ rel(home,x,r,y,icl); } inlinevoid lex(Homehome,constBoolVarArgs&x,IntRelTyper,constBoolVarArgs&y, IntConLevelicl=ICL_DEF){ rel(home,x,r,y,icl); } inlinevoid values(Homehome,constIntVarArgs&x,IntSety, IntConLevelicl=ICL_DEF){ dom(home,x,y,icl); nvalues(home,x,IRT_EQ,y.size(),icl); } #ifdefGECODE_HAS_SET_VARS inlinevoid channel(Homehome,constIntVarArgs&x,SetVary){ rel(home,SOT_UNION,x,y); nvalues(home,x,IRT_EQ,expr(home,cardinality(y))); } inlinevoid range(Homehome,constIntVarArgs&x,SetVary,SetVarz){ element(home,SOT_UNION,x,y,z); } inlinevoid roots(Homehome,constIntVarArgs&x,SetVary,SetVarz){ SetVarArgsxiv(home,z.lubMax()+1,IntSet::empty,0,x.size()-1); channel(home,x,xiv); element(home,SOT_UNION,xiv,z,y); } #endif } namespaceGecode{ template<class>classMatrix; template<classA> classSlice{ public: typedeftypenameArrayTraits<A>::ArgsTypeArgsType; private: ArgsType_r; unsignedint_fc, _tc, _fr, _tr; public: Slice(constMatrix<A>&a,intfc,inttc,intfr,inttr); Slice&reverse(void); operatorArgsType(void); operatorMatrix<ArgsType>(void); operatorconstArgsType(void)const; operatorconstMatrix<ArgsType>(void)const; }; template<classA> typenameSlice<A>::ArgsType operator+(constSlice<A>&x,constSlice<A>&y); template<classA> typenameSlice<A>::ArgsType operator+(constSlice<A>&x,consttypenameArrayTraits<A>::ArgsType&y); template<classA> typenameSlice<A>::ArgsType operator+(consttypenameArrayTraits<A>::ArgsType&x,constSlice<A>&y); template<classA> typenameSlice<A>::ArgsType operator+(constSlice<A>&x,consttypenameArrayTraits<A>::ValueType&y); template<classA> typenameSlice<A>::ArgsType operator+(consttypenameArrayTraits<A>::ValueType&x,constSlice<A>&y); template<classA> classMatrix{ public: typedeftypenameArrayTraits<A>::ValueTypeValueType; typedeftypenameArrayTraits<A>::ArgsTypeArgsType; private: typedeftypenameArrayTraits<A>::StorageTypeStorageType; StorageType_a; int_w; int_h; public: Matrix(Aa,intw,inth); Matrix(Aa,intn); intwidth(void)const; intheight(void)const; ArgsTypeconstget_array(void)const; ValueType&operator ()(intc,intr); constValueType&operator ()(intc,intr)const; Slice<A>slice(intfc,inttc,intfr,inttr)const; Slice<A>row(intr)const; Slice<A>col(intc)const; }; template<classChar,classTraits,classA> std::basic_ostream<Char,Traits>& operator<<(std::basic_ostream<Char,Traits>&os,constMatrix<A>&m); template<classChar,classTraits,classA> std::basic_ostream<Char,Traits>& operator<<(std::basic_ostream<Char,Traits>&os,constSlice<A>&s); voidelement(Homehome,constMatrix<IntArgs>&m,IntVarx,IntVary, IntVarz,IntConLevelicl=ICL_DEF); voidelement(Homehome,constMatrix<IntArgs>&m,IntVarx,IntVary, BoolVarz,IntConLevelicl=ICL_DEF); voidelement(Homehome,constMatrix<IntVarArgs>&m,IntVarx,IntVary, IntVarz,IntConLevelicl=ICL_DEF); voidelement(Homehome,constMatrix<BoolVarArgs>&m,IntVarx,IntVary, BoolVarz,IntConLevelicl=ICL_DEF); #ifdefGECODE_HAS_SET_VARS voidelement(Homehome,constMatrix<IntSetArgs>&m,IntVarx,IntVary, SetVarz); voidelement(Homehome,constMatrix<SetVarArgs>&m,IntVarx,IntVary, SetVarz); #endif template<classA> SymmetryHandlerows_interchange(constMatrix<A>&m); template<classA> SymmetryHandlecolumns_interchange(constMatrix<A>&m); template<classA> SymmetryHandlerows_reflect(constMatrix<A>&m); template<classA> SymmetryHandlecolumns_reflect(constMatrix<A>&m); template<classA> SymmetryHandlediagonal_reflect(constMatrix<A>&m); } #include<gecode/minimodel/matrix.hpp> #include<gecode/minimodel/ldsb.hpp> namespaceGecode{ GECODE_MINIMODEL_EXPORTLinIntExpr sum(constSlice<IntArgs>&slice); GECODE_MINIMODEL_EXPORTLinIntExpr sum(constMatrix<IntArgs>&matrix); } namespaceGecode{ namespaceMiniModel{ template<IntRelTypeirt> classIntOptimizeSpace:publicSpace{ public: IntOptimizeSpace(void); IntOptimizeSpace(boolshare,IntOptimizeSpace&s); virtualvoidconstrain(constSpace&best); virtualIntVarcost(void)const=0; }; #ifdefGECODE_HAS_FLOAT_VARS template<FloatRelTypefrt> classFloatOptimizeSpace:publicSpace{ public: FloatOptimizeSpace(void); FloatOptimizeSpace(boolshare,FloatOptimizeSpace&s); virtualvoidconstrain(constSpace&best); virtualFloatVarcost(void)const=0; }; #endif } typedefMiniModel::IntOptimizeSpace<IRT_LE>MinimizeSpace; typedefMiniModel::IntOptimizeSpace<IRT_GR>MaximizeSpace; typedefMiniModel::IntOptimizeSpace<IRT_LE>IntMinimizeSpace; typedefMiniModel::IntOptimizeSpace<IRT_GR>IntMaximizeSpace; #ifdefGECODE_HAS_FLOAT_VARS typedefMiniModel::FloatOptimizeSpace<FRT_LE>FloatMinimizeSpace; typedefMiniModel::FloatOptimizeSpace<FRT_GR>FloatMaximizeSpace; #endif } #include<gecode/minimodel/optimize.hpp> #endif //IFDEF:GECODE_HAS_INT_VARS //STATISTICS:minimodel-any