最初版本完工

This commit is contained in:
YuhangQ 2023-02-23 14:56:32 +08:00
parent c8031934fb
commit 5a49af7c9f
2 changed files with 16 additions and 14 deletions

BIN
atpg

Binary file not shown.

30
ls.cpp
View File

@ -187,23 +187,25 @@ void Circuit::ls_update_weight() {
} }
} }
for(int i=0; i<=1; i++) { // for(int i=0; i<=1; i++) {
if(!fault_weight[g->id][i]) continue; // if(!fault_weight[g->id][i]) continue;
for(Gate* suc : g->suc_stems) { // for(Gate* suc : g->suc_stems) {
int inc = std::max(1, fault_weight[g->id][i]); // int inc = 0.2 * fault_weight[g->id][i];
if(fault_weight[suc->id][0] + inc <= FAULT_WEIGHT_MAX) { // inc = std::max(inc, 1);
fault_weight[suc->id][0] += inc;
if(suc->sa[0]) fault_total_weight += inc;
}
if(fault_weight[suc->id][1] + inc <= FAULT_WEIGHT_MAX) { // if(fault_weight[suc->id][0] + inc <= FAULT_WEIGHT_MAX) {
fault_weight[suc->id][1] += inc; // fault_weight[suc->id][0] += inc;
if(suc->sa[1]) fault_total_weight += inc; // if(suc->sa[0]) fault_total_weight += inc;
} // }
} // if(fault_weight[suc->id][1] + inc <= FAULT_WEIGHT_MAX) {
} // fault_weight[suc->id][1] += inc;
// if(suc->sa[1]) fault_total_weight += inc;
// }
// }
// }
if(!g->sa[0] && fault_weight[g->id][0] > 0 && (fault_weight[g->id][0] + FAULT_INC < FAULT_WEIGHT_MAX)) { if(!g->sa[0] && fault_weight[g->id][0] > 0 && (fault_weight[g->id][0] + FAULT_INC < FAULT_WEIGHT_MAX)) {
fault_weight[g->id][0] += FAULT_INC; fault_weight[g->id][0] += FAULT_INC;