8
8
#include < memory>
9
9
#include < thread>
10
10
#include < boost/lockfree/queue.hpp>
11
+ #include < cstdint>
11
12
12
13
template <typename T>
13
14
std::ostream &operator <<(std::ostream &strm, const std::set<T> &set) {
@@ -77,6 +78,12 @@ namespace graph_colouring {
77
78
*/
78
79
ColorCount colorCount (const Colouring &s);
79
80
81
+ /* *
82
+ * @param s a graph colouring
83
+ * @return the sum of squared color class sizes used in the configuration times -1 \s
84
+ */
85
+ int64_t squaredColorClassSizes (const Colouring &s);
86
+
80
87
/* *
81
88
* @param G the target graph
82
89
* @param s the colouring of graph \p G
@@ -107,6 +114,15 @@ namespace graph_colouring {
107
114
size_t numberOfConflictingEdges (const graph_access &G,
108
115
const Colouring &s);
109
116
117
+ /* *
118
+ *
119
+ * @param G the target graph
120
+ * @param s the colouring of graph \p G
121
+ * @return the sum of the degrees of the vertices that are uncolored
122
+ */
123
+ size_t sumUncoloredDegree (const graph_access &G,
124
+ const Colouring &s);
125
+
110
126
/* *
111
127
* @param s a colouring
112
128
* @return the number of nodes thate have no associated color
@@ -209,6 +225,23 @@ namespace graph_colouring {
209
225
}
210
226
};
211
227
228
+ /* *
229
+ * This strategy is supposed for operator families which can handle invalid colourings
230
+ */
231
+ class FixedKPartialColouringStrategy : public ColouringStrategy {
232
+ public:
233
+ bool compare (const graph_access &G,
234
+ const Colouring &a,
235
+ const Colouring &b) const override {
236
+ return sumUncoloredDegree (G, a) >
237
+ sumUncoloredDegree (G, b);
238
+ }
239
+
240
+ bool isFixedKStrategy () const override {
241
+ return true ;
242
+ }
243
+ };
244
+
212
245
/* *
213
246
* This strategy is supposed for operator families which can handle valid colourings
214
247
*/
@@ -217,8 +250,8 @@ namespace graph_colouring {
217
250
bool compare (const graph_access &G,
218
251
const Colouring &a,
219
252
const Colouring &b) const override {
220
- return colorCount (a) >
221
- colorCount (b);
253
+ return squaredColorClassSizes (a) >
254
+ squaredColorClassSizes (b);
222
255
}
223
256
224
257
bool isFixedKStrategy () const override {
@@ -262,4 +295,4 @@ namespace graph_colouring {
262
295
};
263
296
264
297
265
- }
298
+ }
0 commit comments