同步mac数据
This commit is contained in:
parent
359c2e8cd1
commit
798b266d25
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
|
"*.ejs": "html",
|
||||||
"*.tcc": "cpp",
|
"*.tcc": "cpp",
|
||||||
"cctype": "cpp",
|
"cctype": "cpp",
|
||||||
"clocale": "cpp",
|
"clocale": "cpp",
|
||||||
@ -27,6 +28,7 @@
|
|||||||
"typeinfo": "cpp",
|
"typeinfo": "cpp",
|
||||||
"sstream": "cpp",
|
"sstream": "cpp",
|
||||||
"ostream": "cpp",
|
"ostream": "cpp",
|
||||||
"iostream": "cpp"
|
"iostream": "cpp",
|
||||||
|
"stack": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,7 +29,7 @@ int max_clause_len;
|
|||||||
int min_clause_len;
|
int min_clause_len;
|
||||||
int formula_len=0;
|
int formula_len=0;
|
||||||
double avg_clause_len;
|
double avg_clause_len;
|
||||||
double ratio;
|
double ratio;
|
||||||
|
|
||||||
/* literal arrays */
|
/* literal arrays */
|
||||||
lit* var_lit[MAX_VARS]; //var_lit[i][j] means the j'th literal of var i.
|
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 pscore[MAX_VARS];
|
||||||
int fix[MAX_VARS];
|
int fix[MAX_VARS];
|
||||||
|
|
||||||
|
|
||||||
/* Information about the clauses */
|
/* Information about the clauses */
|
||||||
int clause_weight[MAX_CLAUSES];
|
int clause_weight[MAX_CLAUSES];
|
||||||
int sat_count[MAX_CLAUSES];
|
int sat_count[MAX_CLAUSES];
|
||||||
@ -133,7 +132,7 @@ int build_instance(char *filename)
|
|||||||
infile.getline(line,1000000);
|
infile.getline(line,1000000);
|
||||||
|
|
||||||
sscanf(line, "%s %s %d %d", tempstr1, tempstr2, &num_vars, &num_clauses);
|
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)
|
if(num_vars>=MAX_VARS || num_clauses>=MAX_CLAUSES)
|
||||||
{
|
{
|
||||||
|
@ -246,7 +246,7 @@ void CCAnr::module_init()
|
|||||||
|
|
||||||
cout<<"c Instance: Number of variables = "<<num_vars<<endl;
|
cout<<"c Instance: Number of variables = "<<num_vars<<endl;
|
||||||
cout<<"c Instance: Number of clauses = "<<num_clauses<<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: 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 Instance: Avg (Min,Max) clause length = "<<avg_clause_len<<" ("<<min_clause_len<<","<<max_clause_len<<")"<<endl;
|
||||||
cout<<"c Algorithmic: Random seed = "<<seed<<endl;
|
cout<<"c Algorithmic: Random seed = "<<seed<<endl;
|
||||||
|
@ -85,7 +85,7 @@ void set_clause_weighting()
|
|||||||
p_scale=0.3;
|
p_scale=0.3;
|
||||||
if(q_init==0)
|
if(q_init==0)
|
||||||
{
|
{
|
||||||
if(ratio<=15) q_scale=0;
|
if(::ratio<=15) q_scale=0;
|
||||||
else q_scale=0.7;
|
else q_scale=0.7;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
22
ls.cpp
22
ls.cpp
@ -18,7 +18,7 @@ bool Circuit::local_search() {
|
|||||||
|
|
||||||
ls_init_weight();
|
ls_init_weight();
|
||||||
|
|
||||||
//CCAnr::module_reset();
|
CCAnr::module_reset();
|
||||||
|
|
||||||
ls_random_circuit();
|
ls_random_circuit();
|
||||||
|
|
||||||
@ -30,6 +30,7 @@ bool Circuit::local_search() {
|
|||||||
|
|
||||||
int id = ls_pick();
|
int id = ls_pick();
|
||||||
|
|
||||||
|
CCAnr::module_flip_var(id);
|
||||||
ls_flip_var(id);
|
ls_flip_var(id);
|
||||||
|
|
||||||
if(stem_total_cnt == stems.size()) {
|
if(stem_total_cnt == stems.size()) {
|
||||||
@ -37,8 +38,6 @@ bool Circuit::local_search() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//assert(is_valid_circuit());
|
//assert(is_valid_circuit());
|
||||||
|
|
||||||
auto end = std::chrono::system_clock::now();
|
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());
|
//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 it = std::next(ClauseLS::falsified_clauses.begin(), rand() % ClauseLS::falsified_clauses.size());
|
||||||
|
|
||||||
auto& lits = (*it)->lits;
|
auto& lits = (*it)->lits;
|
||||||
@ -160,18 +154,10 @@ int Circuit::ls_pick() {
|
|||||||
|
|
||||||
assert(var != -1);
|
assert(var != -1);
|
||||||
|
|
||||||
return var;
|
|
||||||
|
|
||||||
int ccanr_var = CCAnr::module_pick_var();
|
int ccanr_var = CCAnr::module_pick_var();
|
||||||
int ccanr_score = ls_pick_score(ccanr_var);
|
int ccanr_score = ls_pick_score(ccanr_var);
|
||||||
|
|
||||||
return ccanr_var;
|
return ccanr_var;
|
||||||
|
|
||||||
// if(var_score > 0 && rand() % 100 <= 10) {
|
|
||||||
// return var;
|
|
||||||
// } else {
|
|
||||||
// return ccanr_var;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Circuit::ls_init_stems() {
|
void Circuit::ls_init_stems() {
|
||||||
@ -237,7 +223,6 @@ void Circuit::ls_init_stems() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Circuit::ls_flip_var(int var) {
|
void Circuit::ls_flip_var(int var) {
|
||||||
CCAnr::module_flip_var(var);
|
|
||||||
ClauseLS::flip(var);
|
ClauseLS::flip(var);
|
||||||
|
|
||||||
if(id2gate.count(var) && id2gate[var]->stem) {
|
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++) {
|
for(int i=1; i<=ClauseLS::num_vars; i++) {
|
||||||
int new_v = CCAnr::module_cur_soln()[i];
|
int new_v = CCAnr::module_cur_soln()[i];
|
||||||
if(new_v != ClauseLS::lit_value[i]) {
|
if(new_v != ClauseLS::lit_value[i]) {
|
||||||
//ls_flip_var(i);
|
ls_flip_var(i);
|
||||||
ClauseLS::flip(i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user