Commit 4088da2c by chengshuyao

add BSD_feature class, still working on it

parent 33b26eea
......@@ -60,7 +60,19 @@ int tmp_BDD_depth;
int tmp_split_nodes [parameter_input_bit_width];
void search_order(){};
class BSD_features{
public:
int BSD_depth;
int BSD_area;
int BSD_area_layers[parameter_input_bit_width];
double accuracy;
int accuracy_layers[parameter_input_bit_width];
int area_for_each_start_node[parameter_output_bit_width];
};
void search_order();
int search_reward(BSD_features BSD_features_0);
int main(int argc,char* argv[]){
......@@ -99,7 +111,7 @@ int main(int argc,char* argv[]){
};
int BSD_execute(int variable_order_number,int* variable_order){
int BSD_execute(int variable_order_number,int* variable_order,BSD_features BSD_features_0){
BDD_class BDD_class_main;
BDD_class_main.which_demo_function = GLOBAL_which_demo_function;
......@@ -131,16 +143,32 @@ int BSD_execute(int variable_order_number,int* variable_order){
variable_order [zi] = BDD_class_main.most_influence[zi];
tmp_split_nodes [zi] = BDD_class_main.split_nodes_each_layer[zi];
}
tmp_BDD_depth = BDD_class_main.total_BDD_depth+1;
int reward = (1000000*(1-BDD_class_main.circuit_accuracy));
if(BDD_class_main.circuit_accuracy <1)
reward += 1000*(parameter_input_bit_width-BDD_class_main.total_BDD_depth);
reward += BDD_class_main.total_split_nodes;
BSD_features_0.BSD_depth = BDD_class_main.total_BDD_depth+1;
BSD_features_0.BSD_area = BDD_class_main.total_split_nodes;
BSD_features_0.accuracy = BDD_class_main.circuit_accuracy;
int reward = search_reward(BSD_features_0);
//tmp_BDD_depth = BDD_class_main.total_BDD_depth+1;
//int reward = (1000000*(1-BDD_class_main.circuit_accuracy));
//if(BDD_class_main.circuit_accuracy <1)
// reward += 1000*(parameter_input_bit_width-BDD_class_main.total_BDD_depth);
//reward += BDD_class_main.total_split_nodes;
return reward;
};
void search_order(){
int search_reward(BSD_features BSD_features_0){
int reward = (1000000*(1-BSD_features_0.accuracy));
if(BSD_features_0.accuracy <1)
reward += 1000*(parameter_input_bit_width-BSD_features_0.BSD_depth);
reward += BSD_features_0.BSD_depth;
return reward;
};
void search_order(){
ofstream result_0("result_0_20bit",ios::app);
ofstream result_10("result_10_20bit",ios::app);
ofstream result_100("result_100_20bit",ios::app);
......@@ -157,19 +185,14 @@ void search_order(){
random_device rd;
mt19937 gen(rd());
int variable_select_time [parameter_input_bit_width];
double feature_variable[parameter_input_bit_width];
for (int vi=0;vi<parameter_input_bit_width;vi++){
variable_select_time[vi] = 0;
}
int best_area_0;
int best_area_10;
int best_area_100;
int best_area_1000;
BSD_features BSD_features_0;
for (int i=0;i<10000;i++){
......@@ -262,15 +285,13 @@ void search_order(){
// feature_variable[variable_order[j]] = 9999999;
//}
if (i==0)
area = BSD_execute(0,variable_order);
if (i==0){
area = BSD_execute(0,variable_order,BSD_features_0);
}
else
area = BSD_execute(mutation_depth,variable_order);
area = BSD_execute(mutation_depth,variable_order,BSD_features_0);
for(int vi=0;vi<tmp_BDD_depth;vi++){
variable_select_time[variable_order[vi]] += 1;
}
if(area < best_area){
best_area = area;
......@@ -297,7 +318,7 @@ void search_order(){
}
parameter_early_stop_split_nodes = 999999;
parameter_max_BDD_width=2000;
area = BSD_execute(parameter_input_bit_width,best_variable_order);
area = BSD_execute(parameter_input_bit_width,best_variable_order,BSD_features_0);
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment