00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 namespace Gecode { namespace Int { namespace Branch {
00035
00036 template<class View>
00037 forceinline
00038 ValCommitEq<View>::ValCommitEq
00039 (Space& home, const ValBranch<ValCommitEq<View>::Var>& vb)
00040 : ValCommit<View,int>(home,vb) {}
00041 template<class View>
00042 forceinline
00043 ValCommitEq<View>::ValCommitEq(Space& home, ValCommitEq& vc)
00044 : ValCommit<View,int>(home,vc) {}
00045 template<class View>
00046 forceinline ModEvent
00047 ValCommitEq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
00048 return (a == 0) ? x.eq(home,n) : x.nq(home,n);
00049 }
00050 template<class View>
00051 forceinline NGL*
00052 ValCommitEq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
00053 if (a == 0)
00054 return new (home) EqNGL<View>(home,x,n);
00055 else
00056 return NULL;
00057 }
00058 template<class View>
00059 forceinline void
00060 ValCommitEq<View>::print(const Space&, unsigned int a, View, int i,
00061 int n, std::ostream& o) const {
00062 o << "var[" << i << "] "
00063 << ((a == 0) ? "=" : "!=") << " " << n;
00064 }
00065
00066 template<class View>
00067 forceinline
00068 ValCommitLq<View>::ValCommitLq
00069 (Space& home, const ValBranch<ValCommitLq<View>::Var>& vb)
00070 : ValCommit<View,int>(home,vb) {}
00071 template<class View>
00072 forceinline
00073 ValCommitLq<View>::ValCommitLq(Space& home, ValCommitLq& vc)
00074 : ValCommit<View,int>(home,vc) {}
00075 template<class View>
00076 forceinline ModEvent
00077 ValCommitLq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
00078 return (a == 0) ? x.lq(home,n) : x.gr(home,n);
00079 }
00080 template<class View>
00081 forceinline NGL*
00082 ValCommitLq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
00083 if (a == 0)
00084 return new (home) LqNGL<View>(home,x,n);
00085 else
00086 return NULL;
00087 }
00088 template<class View>
00089 forceinline void
00090 ValCommitLq<View>::print(const Space&, unsigned int a, View, int i,
00091 int n, std::ostream& o) const {
00092 o << "var[" << i << "] "
00093 << ((a == 0) ? "<=" : ">") << " " << n;
00094 }
00095
00096 template<class View>
00097 forceinline
00098 ValCommitGq<View>::ValCommitGq
00099 (Space& home, const ValBranch<ValCommitGq<View>::Var>& vb)
00100 : ValCommit<View,int>(home,vb) {}
00101 template<class View>
00102 forceinline
00103 ValCommitGq<View>::ValCommitGq(Space& home, ValCommitGq& vc)
00104 : ValCommit<View,int>(home,vc) {}
00105 template<class View>
00106 forceinline ModEvent
00107 ValCommitGq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
00108 return (a == 0) ? x.gq(home,n) : x.le(home,n);
00109 }
00110 template<class View>
00111 forceinline NGL*
00112 ValCommitGq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
00113 if (a == 0)
00114 return new (home) GqNGL<View>(home,x,n);
00115 else
00116 return NULL;
00117 }
00118 template<class View>
00119 forceinline void
00120 ValCommitGq<View>::print(const Space&, unsigned int a, View, int i,
00121 int n, std::ostream& o) const {
00122 o << "var[" << i << "] "
00123 << ((a == 0) ? ">=" : "<") << " " << n;
00124 }
00125
00126 template<class View>
00127 forceinline
00128 ValCommitGr<View>::ValCommitGr
00129 (Space& home, const ValBranch<ValCommitGr<View>::Var>& vb)
00130 : ValCommit<View,int>(home,vb) {}
00131 template<class View>
00132 forceinline
00133 ValCommitGr<View>::ValCommitGr(Space& home, ValCommitGr& vc)
00134 : ValCommit<View,int>(home,vc) {}
00135 template<class View>
00136 forceinline ModEvent
00137 ValCommitGr<View>::commit(Space& home, unsigned int a, View x, int, int n) {
00138 return (a == 0) ? x.gr(home,n) : x.lq(home,n);
00139 }
00140 template<class View>
00141 forceinline NGL*
00142 ValCommitGr<View>::ngl(Space& home, unsigned int a, View x, int n) const {
00143 if (a == 0)
00144 return new (home) GqNGL<View>(home,x,n+1);
00145 else
00146 return NULL;
00147 }
00148 template<class View>
00149 forceinline void
00150 ValCommitGr<View>::print(const Space&, unsigned int a, View, int i,
00151 int n, std::ostream& o) const {
00152 o << "var[" << i << "] "
00153 << ((a == 0) ? ">" : "<=") << " " << n;
00154 }
00155
00156 }}}
00157
00158
00159