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

Function bounds_propagation

gecode/int/sorted/propagate.hpp:72–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70
71 template<class View, bool Perm>
72 ExecStatus
73 bounds_propagation(Space& home, Propagator& p,
74 ViewArray<View>& x,
75 ViewArray<View>& y,
76 ViewArray<View>& z,
77 bool& repairpass,
78 bool& nofix,
79 bool& match_fixed){
80
81 int n = x.size();
82
83 Region r;
84 int* tau = r.alloc<int>(n);
85 int* phi = r.alloc<int>(n);
86 int* phiprime = r.alloc<int>(n);
87 OfflineMinItem* sequence = r.alloc<OfflineMinItem>(n);
88 int* vertices = r.alloc<int>(n);
89
90 if (match_fixed) {
91 // sorting is determined, sigma and tau coincide
92 for (int i=0; i<n; i++)
93 tau[z[i].val()] = i;
94 } else {
95 for (int i=0; i<n; i++)
96 tau[i] = i;
97 }
98
99 if (Perm) {
100 // normalized and sorted
101 // collect all bounds
102
103 Rank* allbnd = r.alloc<Rank>(x.size());
104#ifndef NDEBUG
105 for (int i=n; i--;)
106 allbnd[i].min = allbnd[i].max = -1;
107#endif
108 for (int i=n; i--;) {
109 int min = x[i].min();
110 int max = x[i].max();
111 for (int j=0; j<n; j++) {
112 if ( (y[j].min() > min) ||
113 (y[j].min() <= min && min <= y[j].max()) ) {
114 allbnd[i].min = j;
115 break;
116 }
117 }
118 for (int j=n; j--;) {
119 if (y[j].min() > max) {
120 allbnd[i].max = j-1;
121 break;
122 } else if (y[j].min() <= max && min <= y[j].max()) {
123 allbnd[i].max = j;
124 break;
125 }
126 }
127 }
128
129 for (int i=0; i<n; i++) {

Callers

nothing calls this directly

Calls 15

me_failedFunction · 0.85
me_modifiedFunction · 0.85
gloverFunction · 0.85
revgloverFunction · 0.85
narrow_domyFunction · 0.85
computesccsFunction · 0.85
ES_SUBSUMEDMethod · 0.80
channelFunction · 0.70
normalizeFunction · 0.70
sizeMethod · 0.45
valMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected