Skip to content

Commit 0471d4e

Browse files
authored
make the bfs det order default (#44)
It seems that the bfs det order is doing a nice job in practice, so we move it to be the default and one can disable it with `--no-det-order-bfs`
1 parent 8c4d3c3 commit 0471d4e

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ We tested the Tesseract decoder for:
5050
* **Detailed Statistics:** provides comprehensive statistics output, including shot counts, error
5151
counts, and processing times.
5252
* **Heuristics**: includes flexible heuristic options: `--beam`, `--det-penalty`,
53-
`--beam-climbing`, `--no-revisit-dets`, `--at-most-two-errors-per-detector`, `--det-order-bfs` and `--pqlimit` to
53+
`--beam-climbing`, `--no-revisit-dets`, `--at-most-two-errors-per-detector`, and `--pqlimit` to
5454
improve performance while maintaining a low logical error rate. To learn more about these
5555
options, use `./bazel-bin/src/tesseract --help`
5656
* **Visualization tool:** open the [viz directory](viz/) in your browser to view decoding results. See [viz/README.md](viz/README.md) for instructions on generating the visualization JSON.

src/tesseract_main.cc

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct Args {
3333
// Manifold orientation options
3434
uint64_t det_order_seed;
3535
size_t num_det_orders = 10;
36-
bool det_order_bfs = false;
36+
bool det_order_bfs = true;
3737

3838
// Sampling options
3939
size_t sample_num_shots = 0;
@@ -382,10 +382,21 @@ int main(int argc, char* argv[]) {
382382
.metavar("N")
383383
.default_value(size_t(1))
384384
.store_into(args.num_det_orders);
385-
program.add_argument("--det-order-bfs")
386-
.help("Use BFS-based detector ordering instead of geometric orientation")
387-
.flag()
385+
program.add_argument("--no-det-order-bfs")
386+
.help("Disable BFS-based detector ordering and use geometric orientation")
387+
.default_value(true)
388+
.implicit_value(false)
388389
.store_into(args.det_order_bfs);
390+
program.add_argument("--det-order-bfs")
391+
.action([&](auto const&) {
392+
std::cout << "BFS-based detector ordering is the default now; "
393+
"--det-order-bfs is ignored."
394+
<< std::endl;
395+
})
396+
.default_value(true)
397+
.implicit_value(true)
398+
.store_into(args.det_order_bfs)
399+
.hidden();
389400
program.add_argument("--det-order-seed")
390401
.help(
391402
"Seed used when initializing the random detector traversal "

viz/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Visualization
1+
#Visualization
22

33
This tool displays the detectors and errors from a Tesseract decoding run in 3D.
44

@@ -10,7 +10,7 @@ include only the lines used by the converter script:
1010
```bash
1111
bazel build src:all && \
1212
./bazel-bin/src/tesseract \
13-
--sample-num-shots 1 --det-order-seed 13267562 --pqlimit 10000 --beam 1 --num-det-orders 20 --det-order-bfs \
13+
--sample-num-shots 1 --det-order-seed 13267562 --pqlimit 10000 --beam 1 --num-det-orders 20 \
1414
--circuit testdata/colorcodes/r\=9\,d\=9\,p\=0.002\,noise\=si1000\,c\=superdense_color_code_X\,q\=121\,gates\=cz.stim \
1515
--sample-seed 717347 --threads 1 --verbose | \
1616
grep -E 'Error|Detector|activated_errors|activated_dets' > logfile.txt
@@ -19,9 +19,10 @@ python viz/to_json.py logfile.txt -o logfile.json
1919
```
2020

2121

22-
The `--det-order-bfs` flag is compatible with visualization logs. Just make
23-
sure `--verbose` is enabled so the detector coordinates are printed for
24-
`to_json.py` to parse.
22+
The `--no-det-order-bfs` flag is compatible with visualization logs. BFS-based
23+
detector ordering is now enabled by default, so include this flag only if you
24+
want to disable it. Make sure `--verbose` is enabled so the detector
25+
coordinates are printed for `to_json.py` to parse.
2526

2627
The `to_json.py` script produces `logfile.json`, which contains the detector
2728
coordinates and animation frames for the viewer.
@@ -31,4 +32,3 @@ coordinates and animation frames for the viewer.
3132
Open `viz/index.html` in a modern browser. It will automatically try to load
3233
`logfile.json` from the same directory. If the file picker is used, any JSON
3334
produced by `to_json.py` can be visualized.
34-

0 commit comments

Comments
 (0)