固定权值
This commit is contained in:
parent
5e6315c9df
commit
73a06ebe64
@ -78,7 +78,7 @@ int* flip_need_update;
|
|||||||
std::vector<Gate*> flip_update_queue;
|
std::vector<Gate*> flip_update_queue;
|
||||||
|
|
||||||
// incremental stem struct
|
// incremental stem struct
|
||||||
int STEM_INC = 0;
|
const int STEM_INC = 10000;
|
||||||
const int STEM_WEIGHT_MAX = 1e9;
|
const int STEM_WEIGHT_MAX = 1e9;
|
||||||
ll stem_total_weight;
|
ll stem_total_weight;
|
||||||
int stem_total_cnt;
|
int stem_total_cnt;
|
||||||
|
32
ls.cpp
32
ls.cpp
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
bool Circuit::local_search(std::unordered_set<Fault*> &faults) {
|
bool Circuit::local_search(std::unordered_set<Fault*> &faults) {
|
||||||
|
|
||||||
STEM_INC = 0;
|
//STEM_INC = 0;
|
||||||
|
|
||||||
// 初始化并重置所有 ls 数据结构
|
// 初始化并重置所有 ls 数据结构
|
||||||
ls_init_data_structs();
|
ls_init_data_structs();
|
||||||
@ -142,7 +142,7 @@ bool Circuit::local_search(std::unordered_set<Fault*> &faults) {
|
|||||||
|
|
||||||
void Circuit::ls_update_weight() {
|
void Circuit::ls_update_weight() {
|
||||||
|
|
||||||
STEM_INC++;
|
//STEM_INC += 5;
|
||||||
|
|
||||||
if(rand() % 10000 <= SP * 10000) {
|
if(rand() % 10000 <= SP * 10000) {
|
||||||
for(Gate* g : gates) {
|
for(Gate* g : gates) {
|
||||||
@ -179,25 +179,29 @@ 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;
|
for(Gate* pre : g->suc_stems) {
|
||||||
// for(Gate* suc : g->suc_stems) {
|
// int inc = 0.2 * fault_weight[pre->id][i];
|
||||||
// int inc = 0.2 * fault_weight[g->id][i];
|
// inc = std::max(1, inc);
|
||||||
|
|
||||||
// inc = std::max(inc, 1);
|
// if(g->type == Gate::NAND || g->type == Gate::NOR || g->type == Gate::NOT || g->type == Gate::XNOR) {
|
||||||
|
// if(fault_weight[g->id][!pre->value] + inc <= FAULT_WEIGHT_MAX) {
|
||||||
// if(fault_weight[suc->id][0] + inc <= FAULT_WEIGHT_MAX) {
|
// fault_weight[g->id][!pre->value] += inc;
|
||||||
// fault_weight[suc->id][0] += inc;
|
// if(g->sa[!pre->value]) fault_total_weight += inc;
|
||||||
// if(suc->sa[0]) fault_total_weight += inc;
|
// }
|
||||||
|
// } else {
|
||||||
|
// if(fault_weight[g->id][pre->value] + inc <= FAULT_WEIGHT_MAX) {
|
||||||
|
// fault_weight[g->id][pre->value] += inc;
|
||||||
|
// if(g->sa[pre->value]) fault_total_weight += inc;
|
||||||
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if(fault_weight[suc->id][1] + inc <= FAULT_WEIGHT_MAX) {
|
// if(fault_weight[suc->id][1] + inc <= FAULT_WEIGHT_MAX) {
|
||||||
// fault_weight[suc->id][1] += inc;
|
// fault_weight[suc->id][1] += inc;
|
||||||
// if(suc->sa[1]) fault_total_weight += 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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user