Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BSD
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chengshuyao
BSD
Commits
4088da2c
Commit
4088da2c
authored
Apr 23, 2025
by
chengshuyao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add BSD_feature class, still working on it
parent
33b26eea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
21 deletions
+42
-21
src/BSD.cpp
+42
-21
No files found.
src/BSD.cpp
View file @
4088da2c
...
...
@@ -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
);
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment