Commit 964df446 by chengshuyao

add BSD_features

parent 7807d33f
...@@ -65,11 +65,11 @@ class BSD_features{ ...@@ -65,11 +65,11 @@ class BSD_features{
public: public:
int BSD_depth; int BSD_depth;
int BSD_area; int BSD_area;
int BSD_area_layers[parameter_input_bit_width];
double accuracy; double accuracy;
int BSD_area_layers[parameter_input_bit_width];
int accuracy_layers[parameter_input_bit_width]; int accuracy_layers[parameter_input_bit_width];
//int nodes_for_each_start_node[parameter_max_BDD_width];
int area_for_each_start_node[parameter_output_bit_width];
}; };
void search_order(); void search_order();
int search_reward(BSD_features BSD_features_0); int search_reward(BSD_features BSD_features_0);
...@@ -141,7 +141,8 @@ int BSD_execute(int variable_order_number,int* variable_order,BSD_features BSD_f ...@@ -141,7 +141,8 @@ int BSD_execute(int variable_order_number,int* variable_order,BSD_features BSD_f
for(int zi=0;zi<parameter_input_bit_width;zi++){ for(int zi=0;zi<parameter_input_bit_width;zi++){
variable_order [zi] = BDD_class_main.most_influence[zi]; variable_order [zi] = BDD_class_main.most_influence[zi];
tmp_split_nodes [zi] = BDD_class_main.split_nodes_each_layer[zi]; BSD_features_0.BSD_area_layers [zi] = BDD_class_main.split_nodes_each_layer[zi];
BSD_features_0.accuracy_layers [zi] = BDD_class_main.accuracy_each_layer[zi];
} }
BSD_features_0.BSD_depth = BDD_class_main.total_BDD_depth+1; BSD_features_0.BSD_depth = BDD_class_main.total_BDD_depth+1;
...@@ -298,7 +299,7 @@ void search_order(){ ...@@ -298,7 +299,7 @@ void search_order(){
best_area_depth = tmp_BDD_depth; best_area_depth = tmp_BDD_depth;
for(int vi=0;vi<tmp_BDD_depth;vi++){ for(int vi=0;vi<tmp_BDD_depth;vi++){
best_variable_order[vi] = variable_order[vi]; best_variable_order[vi] = variable_order[vi];
best_BDD_split_nodes[vi] = tmp_split_nodes[vi]; best_BDD_split_nodes[vi] = BSD_features_0.BSD_area_layers[vi];
} }
parameter_early_stop_split_nodes = best_area+10; parameter_early_stop_split_nodes = best_area+10;
} }
......
...@@ -135,7 +135,9 @@ public: ...@@ -135,7 +135,9 @@ public:
int BSD_variable_order[parameter_input_bit_width]; int BSD_variable_order[parameter_input_bit_width];
int BSD_variable_order_number; int BSD_variable_order_number;
int* split_nodes_each_layer;
int split_nodes_each_layer[parameter_input_bit_width+1];
int accuracy_each_layer[parameter_input_bit_width+1];
BDD_class(){ BDD_class(){
most_influence = new int [parameter_input_bit_width]; most_influence = new int [parameter_input_bit_width];
...@@ -157,7 +159,6 @@ public: ...@@ -157,7 +159,6 @@ public:
left_mask_output_data_all = new bool [long(parameter_max_BDD_width)*long(parameter_max_samples)]; left_mask_output_data_all = new bool [long(parameter_max_BDD_width)*long(parameter_max_samples)];
right_mask_output_data_all = new bool [long(parameter_max_BDD_width)*long(parameter_max_samples)]; right_mask_output_data_all = new bool [long(parameter_max_BDD_width)*long(parameter_max_samples)];
split_nodes_each_layer = new int [parameter_input_bit_width+1];
}; };
...@@ -706,6 +707,7 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int ...@@ -706,6 +707,7 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int
cout<<endl; cout<<endl;
split_nodes_each_layer[i] = total_split_nodes; split_nodes_each_layer[i] = total_split_nodes;
accuracy_each_layer[i] = ((total_finish_weight)/pow(2.0,20))/double(parameter_output_bit_width);
cout<<"BSD "<<BDD_id<<" nodes = "<<total_nodes_amount<<endl; cout<<"BSD "<<BDD_id<<" nodes = "<<total_nodes_amount<<endl;
cout<<"BSD "<<BDD_id<<" split nodes = "<<total_split_nodes; cout<<"BSD "<<BDD_id<<" split nodes = "<<total_split_nodes;
......
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