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
00035
00036
00037
00038 namespace Gecode { namespace Int { namespace Branch {
00039
00040 template<class View>
00041 forceinline
00042 ValCommitEq<View>::ValCommitEq(Space& home, const ValBranch<Var>& vb)
00043 : ValCommit<View,int>(home,vb) {}
00044 template<class View>
00045 forceinline
00046 ValCommitEq<View>::ValCommitEq(Space& home, bool shared, ValCommitEq& vc)
00047 : ValCommit<View,int>(home,shared,vc) {}
00048 template<class View>
00049 forceinline ModEvent
00050 ValCommitEq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
00051 return (a == 0) ? x.eq(home,n) : x.nq(home,n);
00052 }
00053 template<class View>
00054 forceinline NGL*
00055 ValCommitEq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
00056 if (a == 0)
00057 return new (home) EqNGL<View>(home,x,n);
00058 else
00059 return NULL;
00060 }
00061 template<class View>
00062 forceinline void
00063 ValCommitEq<View>::print(const Space&, unsigned int a, View, int i,
00064 int n, std::ostream& o) const {
00065 o << "var[" << i << "] "
00066 << ((a == 0) ? "=" : "!=") << " " << n;
00067 }
00068
00069 template<class View>
00070 forceinline
00071 ValCommitLq<View>::ValCommitLq(Space& home, const ValBranch<Var>& vb)
00072 : ValCommit<View,int>(home,vb) {}
00073 template<class View>
00074 forceinline
00075 ValCommitLq<View>::ValCommitLq(Space& home, bool shared, ValCommitLq& vc)
00076 : ValCommit<View,int>(home,shared,vc) {}
00077 template<class View>
00078 forceinline ModEvent
00079 ValCommitLq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
00080 return (a == 0) ? x.lq(home,n) : x.gr(home,n);
00081 }
00082 template<class View>
00083 forceinline NGL*
00084 ValCommitLq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
00085 if (a == 0)
00086 return new (home) LqNGL<View>(home,x,n);
00087 else
00088 return NULL;
00089 }
00090 template<class View>
00091 forceinline void
00092 ValCommitLq<View>::print(const Space&, unsigned int a, View, int i,
00093 int n, std::ostream& o) const {
00094 o << "var[" << i << "] "
00095 << ((a == 0) ? "<=" : ">") << " " << n;
00096 }
00097
00098 template<class View>
00099 forceinline
00100 ValCommitGq<View>::ValCommitGq(Space& home, const ValBranch<Var>& vb)
00101 : ValCommit<View,int>(home,vb) {}
00102 template<class View>
00103 forceinline
00104 ValCommitGq<View>::ValCommitGq(Space& home, bool shared, ValCommitGq& vc)
00105 : ValCommit<View,int>(home,shared,vc) {}
00106 template<class View>
00107 forceinline ModEvent
00108 ValCommitGq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
00109 return (a == 0) ? x.gq(home,n) : x.le(home,n);
00110 }
00111 template<class View>
00112 forceinline NGL*
00113 ValCommitGq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
00114 if (a == 0)
00115 return new (home) GqNGL<View>(home,x,n);
00116 else
00117 return NULL;
00118 }
00119 template<class View>
00120 forceinline void
00121 ValCommitGq<View>::print(const Space&, unsigned int a, View, int i,
00122 int n, std::ostream& o) const {
00123 o << "var[" << i << "] "
00124 << ((a == 0) ? ">=" : "<") << " " << n;
00125 }
00126
00127 template<class View>
00128 forceinline
00129 ValCommitGr<View>::ValCommitGr(Space& home, const ValBranch<Var>& vb)
00130 : ValCommit<View,int>(home,vb) {}
00131 template<class View>
00132 forceinline
00133 ValCommitGr<View>::ValCommitGr(Space& home, bool shared, ValCommitGr& vc)
00134 : ValCommit<View,int>(home,shared,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