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

Function unshare

gecode/int/unshare.cpp:107–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105 /// Replace unassigned shared variables by fresh, yet equal variables
106 template<class Var>
107 forceinline void
108 unshare(Home home, VarArgArray<Var>& x, IntPropLevel ipl) {
109 int n=x.size();
110 if (n < 2)
111 return;
112
113 Region r;
114 Var** y = r.alloc<Var*>(n);
115 for (int i=0; i<n; i++)
116 y[i]=&x[i];
117
118 VarPtrLess<Var> vpl;
119 Support::quicksort<Var*,VarPtrLess<Var> >(y,n,vpl);
120
121 // Replace all shared variables with new and equal variables
122 for (int i=0; i<n;) {
123 int j=i++;
124 while ((i<n) && (y[j]->varimp() == y[i]->varimp()))
125 i++;
126 if (!y[j]->assigned())
127 link(home,&y[j],i-j,ipl);
128 }
129 }
130
131}}}
132

Callers 15

postMethod · 0.85
postMethod · 0.85
postMethod · 0.85
postMethod · 0.85
postMethod · 0.85
postMethod · 0.85
postMethod · 0.85
p_distinctFunction · 0.85
p_distinctOffsetFunction · 0.85
p_int_divFunction · 0.85
p_int_modFunction · 0.85
p_bin_packing_loadFunction · 0.85

Calls 4

linkFunction · 0.85
sizeMethod · 0.45
varimpMethod · 0.45
assignedMethod · 0.45

Tested by

no test coverage detected