File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1717#include < algorithm>
1818#include < boost/functional/hash.hpp> // For boost::hash_range
1919#include < cassert>
20+ #include < cstdint>
2021#include < functional> // For std::hash (though not strictly necessary here, but good practice)
2122#include < iostream>
2223
@@ -85,24 +86,26 @@ bool Node::operator>(const Node& other) const {
8586double TesseractDecoder::get_detcost (
8687 size_t d, const std::vector<DetectorCostTuple>& detector_cost_tuples) const {
8788 double min_cost = INF;
89+ uint32_t min_det_cost = std::numeric_limits<uint32_t >::infinity ();
8890 double error_cost;
8991 ErrorCost ec;
9092 DetectorCostTuple dct;
9193
9294 for (int ei : d2e[d]) {
9395 ec = error_costs[ei];
94- if (ec.min_cost >= min_cost) break ;
96+ if (ec.likelihood_cost * min_det_cost >= min_cost * errors[ei]. symptom . detectors . size () ) break ;
9597
9698 dct = detector_cost_tuples[ei];
9799 if (!dct.error_blocked ) {
98- error_cost = ec.likelihood_cost / dct. detectors_count ;
99- if (error_cost < min_cost) {
100+ error_cost = ec.likelihood_cost ;
101+ if (ec. likelihood_cost < min_cost * dct. detectors_count ) {
100102 min_cost = error_cost;
103+ min_det_cost = dct.detectors_count ;
101104 }
102105 }
103106 }
104107
105- return min_cost + config.det_penalty ;
108+ return ( min_cost / min_det_cost) + config.det_penalty ;
106109}
107110
108111TesseractDecoder::TesseractDecoder (TesseractConfig config_) : config(config_) {
You can’t perform that action at this time.
0 commit comments