同步mac数据

This commit is contained in:
YuhangQ 2023-03-21 17:14:32 +08:00
parent 359c2e8cd1
commit 798b266d25
6 changed files with 10 additions and 25 deletions

View File

@ -1,5 +1,6 @@
{
"files.associations": {
"*.ejs": "html",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
@ -27,6 +28,7 @@
"typeinfo": "cpp",
"sstream": "cpp",
"ostream": "cpp",
"iostream": "cpp"
"iostream": "cpp",
"stack": "cpp"
}
}

View File

@ -50,7 +50,6 @@ int var_neighbor_count[MAX_VARS];
//int pscore[MAX_VARS];
int fix[MAX_VARS];
/* Information about the clauses */
int clause_weight[MAX_CLAUSES];
int sat_count[MAX_CLAUSES];
@ -133,7 +132,7 @@ int build_instance(char *filename)
infile.getline(line,1000000);
sscanf(line, "%s %s %d %d", tempstr1, tempstr2, &num_vars, &num_clauses);
ratio = double(num_clauses)/num_vars;
::ratio = double(num_clauses) / num_vars;
if(num_vars>=MAX_VARS || num_clauses>=MAX_CLAUSES)
{

View File

@ -246,7 +246,7 @@ void CCAnr::module_init()
cout<<"c Instance: Number of variables = "<<num_vars<<endl;
cout<<"c Instance: Number of clauses = "<<num_clauses<<endl;
cout<<"c Instance: Ratio = "<<ratio<<endl;
cout<<"c Instance: Ratio = "<<::ratio<<endl;
cout<<"c Instance: Formula length = "<<formula_len<<endl;
cout<<"c Instance: Avg (Min,Max) clause length = "<<avg_clause_len<<" ("<<min_clause_len<<","<<max_clause_len<<")"<<endl;
cout<<"c Algorithmic: Random seed = "<<seed<<endl;

View File

@ -85,7 +85,7 @@ void set_clause_weighting()
p_scale=0.3;
if(q_init==0)
{
if(ratio<=15) q_scale=0;
if(::ratio<=15) q_scale=0;
else q_scale=0.7;
}
else

BIN
atpg

Binary file not shown.

22
ls.cpp
View File

@ -18,7 +18,7 @@ bool Circuit::local_search() {
ls_init_weight();
//CCAnr::module_reset();
CCAnr::module_reset();
ls_random_circuit();
@ -30,6 +30,7 @@ bool Circuit::local_search() {
int id = ls_pick();
CCAnr::module_flip_var(id);
ls_flip_var(id);
if(stem_total_cnt == stems.size()) {
@ -37,8 +38,6 @@ bool Circuit::local_search() {
break;
}
//assert(is_valid_circuit());
auto end = std::chrono::system_clock::now();
@ -144,11 +143,6 @@ int Circuit::ls_pick() {
//printf("[UP] stem: %lld, fault:%lld, stem_cnt: %lld, fault_cnt:%lld, fpl_score: %lld citcuit-score: %lld\n", stem_total_cost, fault_total_weight, stems.size() - stem_total_cnt, fault_total_cnt, fault_propagate_score, ls_circuit_score());
if(ClauseLS::falsified_clauses.size() == 0) {
print_circuit();
exit(-1);
}
auto it = std::next(ClauseLS::falsified_clauses.begin(), rand() % ClauseLS::falsified_clauses.size());
auto& lits = (*it)->lits;
@ -160,18 +154,10 @@ int Circuit::ls_pick() {
assert(var != -1);
return var;
int ccanr_var = CCAnr::module_pick_var();
int ccanr_score = ls_pick_score(ccanr_var);
return ccanr_var;
// if(var_score > 0 && rand() % 100 <= 10) {
// return var;
// } else {
// return ccanr_var;
// }
}
void Circuit::ls_init_stems() {
@ -237,7 +223,6 @@ void Circuit::ls_init_stems() {
}
void Circuit::ls_flip_var(int var) {
CCAnr::module_flip_var(var);
ClauseLS::flip(var);
if(id2gate.count(var) && id2gate[var]->stem) {
@ -284,8 +269,7 @@ void Circuit::ls_random_circuit() {
for(int i=1; i<=ClauseLS::num_vars; i++) {
int new_v = CCAnr::module_cur_soln()[i];
if(new_v != ClauseLS::lit_value[i]) {
//ls_flip_var(i);
ClauseLS::flip(i);
ls_flip_var(i);
}
}