From 798b266d253cf98029452d96016ff77f4cd685ac Mon Sep 17 00:00:00 2001 From: YuhangQ Date: Tue, 21 Mar 2023 17:14:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5mac=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 4 +++- CCAnr/basis.h | 5 ++--- CCAnr/cca.cpp | 2 +- CCAnr/cw.h | 2 +- atpg | Bin 324616 -> 536321 bytes ls.cpp | 22 +++------------------- 6 files changed, 10 insertions(+), 25 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c822fb6..6d46c39 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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" } } \ No newline at end of file diff --git a/CCAnr/basis.h b/CCAnr/basis.h index b5ac82e..a4daedf 100644 --- a/CCAnr/basis.h +++ b/CCAnr/basis.h @@ -29,7 +29,7 @@ int max_clause_len; int min_clause_len; int formula_len=0; double avg_clause_len; -double ratio; +double ratio; /* literal arrays */ lit* var_lit[MAX_VARS]; //var_lit[i][j] means the j'th literal of var i. @@ -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) { diff --git a/CCAnr/cca.cpp b/CCAnr/cca.cpp index 0842263..a865fa0 100644 --- a/CCAnr/cca.cpp +++ b/CCAnr/cca.cpp @@ -246,7 +246,7 @@ void CCAnr::module_init() cout<<"c Instance: Number of variables = "<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); } }