MCPcopy Create free account
hub / github.com/Gecode/gecode / normalize

Function normalize

gecode/int/sorted/order.hpp:92–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90 */
91 template<class View>
92 inline bool
93 normalize(Space& home,
94 ViewArray<View>& y,
95 ViewArray<View>& x,
96 bool& nofix) {
97
98 int ys = y.size();
99 for (int i = 1; i < ys; i++) {
100 ModEvent me_lb = y[i].gq(home, y[i - 1].min());
101 if (me_failed(me_lb))
102 return false;
103 nofix |= (me_modified(me_lb) && y[i - 1].min() != y[i].min());
104 }
105
106 for (int i = ys - 1; i--; ) {
107 ModEvent me_ub = y[i].lq(home, y[i + 1].max());
108 if (me_failed(me_ub))
109 return false;
110 nofix |= (me_modified(me_ub) && y[i + 1].max() != y[i].max());
111 }
112
113 int xs = x.size();
114 for (int i = xs; i--; ) {
115 ModEvent me = x[i].gq(home, y[0].min());
116 if (me_failed(me))
117 return false;
118 nofix |= (me_modified(me) && x[i].min() != y[0].min());
119
120 me = x[i].lq(home, y[xs - 1].max());
121 if (me_failed(me))
122 return false;
123 nofix |= (me_modified(me) && x[i].max() != y[xs - 1].max());
124 }
125 return true;
126 }
127
128 /**
129 * \brief Bounds consistency on the permutation views

Callers 2

bounds_propagationFunction · 0.70
propagateMethod · 0.70

Calls 7

me_failedFunction · 0.85
me_modifiedFunction · 0.85
sizeMethod · 0.45
gqMethod · 0.45
minMethod · 0.45
lqMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected