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