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

Function estimate

gecode/int/linear/post.hpp:40–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38
39 template<class View>
40 inline void
41 estimate(Term<View>* t, int n, int c, int& l, int &u) {
42 long long int min = c;
43 long long int max = c;
44 for (int i=0; i<n; i++) {
45 long long int a = t[i].a;
46 if (a > 0) {
47 min += a*t[i].x.min();
48 max += a*t[i].x.max();
49 } else {
50 max += a*t[i].x.min();
51 min += a*t[i].x.max();
52 }
53 }
54 if (min < Limits::min)
55 min = Limits::min;
56 if (min > Limits::max)
57 min = Limits::max;
58 l = static_cast<int>(min);
59 if (max < Limits::min)
60 max = Limits::min;
61 if (max > Limits::max)
62 max = Limits::max;
63 u = static_cast<int>(max);
64 }
65
66 /// Sort linear terms by view
67 template<class View>

Callers 6

postFunction · 0.70
postMethod · 0.50
postMethod · 0.50
divmodFunction · 0.50
linearFunction · 0.50
linearFunction · 0.50

Calls 2

minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected