commit 79c11486db2d98a8c6672548ad5a9cd2959fc293
parent 347510bb35a95aae7764aec63c367012eceebb85
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Sat, 13 Oct 2018 00:56:16 +0200
uncommitted changes
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/decontamination.cpp b/decontamination.cpp
@@ -15,7 +15,7 @@
* separated by the nodes to query. */
// max number of vertices, change this
-#define MAXN 32
+#define MAXN 10
#include <cstdio>
#include <iostream>
@@ -52,7 +52,7 @@ int main() {
}
n++; // so that vertices are from 0 to n-1
- for (int k = 1; k <= n; k++) {
+ for (int k = 1; k <= 1; k++) {
// decontaminate simultaneously k nodes
// do a BFS on configurations
@@ -79,12 +79,18 @@ int main() {
bm.resize(n, 0);
do {
bitset<MAXN> nc; // new possible configuration
+ int myidx = -1;
+ for (int i = 0; i < n; i++)
+ if (bm[i])
+ myidx = i;
for (int i = 0; i < n; i++)
if (c[i] && !bm[i])
// i is contaminated and was not decontaminated at this turn
for (int j = 0; j < nG[i]; j++)
// all possible contaminations by i
nc.set(G[i][j]);
+ cout << c << " -> " << nc << " [label='" << myidx << "'];" << endl;
+ //cout << nc << endl;
if (!p.count(nc)) {
// nc was not reachable yet
p[nc] = c;
@@ -94,6 +100,8 @@ int main() {
} while (prev_permutation(bm.begin(), bm.end()));
}
+ return 0;
+
bitset<MAXN> e;
if (p.count(e)) {
// target configuration was reached: all nodes decontaminated