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
SunMaple
BSD
Commits
e5ac145a
Commit
e5ac145a
authored
Dec 09, 2025
by
chengshuyao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add early stop mode
parent
5db33f20
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
5 deletions
+64
-5
src/BSD.cpp
+3
-3
src/BSD.h
+34
-1
src/tool_function.h
+25
-1
src/top.h
+2
-0
No files found.
src/BSD.cpp
View file @
e5ac145a
...
@@ -319,10 +319,10 @@ int BSD_execute(int variable_order_number,int** variable_order, int partition_de
...
@@ -319,10 +319,10 @@ int BSD_execute(int variable_order_number,int** variable_order, int partition_de
};
};
int
search_reward
(
BSD_features
BSD_features_0
){
int
search_reward
(
BSD_features
BSD_features_0
){
int
reward
=
(
1000000
*
double
(
1
-
BSD_features_0
.
accuracy
));
int
reward
=
0
;
//
(1000000*double(1-BSD_features_0.accuracy));
reward
+=
BSD_features_0
.
BSD_area
;
reward
+=
BSD_features_0
.
BSD_area
;
if
(
BSD_features_0
.
accuracy
<
1
)
if
(
BSD_features_0
.
accuracy
<
parameter_early_stop_accuracy
)
reward
=
int
(
1.2
*
reward
);
reward
=
int
(
1.2
*
reward
)
+
(
1000000
*
double
(
1
-
BSD_features_0
.
accuracy
))
;
cout
<<
"BSD accuracy: "
<<
BSD_features_0
.
accuracy
<<
endl
;
cout
<<
"BSD accuracy: "
<<
BSD_features_0
.
accuracy
<<
endl
;
cout
<<
"BSD area: "
<<
BSD_features_0
.
BSD_area
<<
endl
;
cout
<<
"BSD area: "
<<
BSD_features_0
.
BSD_area
<<
endl
;
//reward += int(BSD_features_0.feature_area/100) ;
//reward += int(BSD_features_0.feature_area/100) ;
...
...
src/BSD.h
View file @
e5ac145a
...
@@ -719,7 +719,40 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int
...
@@ -719,7 +719,40 @@ int BDD_class::train_BDD(BDD_node** BDD,int* most_influence,int start_depth, int
all_one_right_list
[
j
]
=
0
;
all_one_right_list
[
j
]
=
0
;
all_zero_right_list
[
j
]
=
1
;
all_zero_right_list
[
j
]
=
1
;
}
}
}
else
{
}
else
if
(
parameter_early_stop_accuracy
<
double
(
1
-
double
(
1
/
BSD_samples
))){
int
how_many_zeros_left
=
0
;
int
how_many_ones_left
=
0
;
int
how_many_zeros_right
=
0
;
int
how_many_ones_right
=
0
;
for
(
int
zi
=
0
;
zi
<
BSD_samples
;
zi
++
){
left_mask_output_data_tmp
[
zi
]
=
left_mask_output_data_all
[
zi
+
BSD_samples
*
j
];
right_mask_output_data_tmp
[
zi
]
=
right_mask_output_data_all
[
zi
+
BSD_samples
*
j
];
if
(
left_mask_output_data_tmp
[
zi
]){
how_many_ones_left
+=
1
;
}
if
(
right_mask_output_data_tmp
[
zi
]){
how_many_ones_right
+=
1
;
}
}
how_many_zeros_left
=
BSD_samples
-
how_many_ones_left
;
how_many_zeros_right
=
BSD_samples
-
how_many_ones_right
;
all_zero_left_list
[
j
]
=
0
;
all_one_left_list
[
j
]
=
0
;
all_zero_right_list
[
j
]
=
0
;
all_one_right_list
[
j
]
=
0
;
double
early_stop_accuracy_node
=
1
-
(
1
-
parameter_early_stop_accuracy
)
/
double
(
1
);
if
(
double
(
how_many_zeros_left
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_zero_left_list
[
j
]
=
1
;
else
if
(
double
(
how_many_ones_left
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_one_left_list
[
j
]
=
1
;
if
(
double
(
how_many_zeros_right
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_zero_right_list
[
j
]
=
1
;
else
if
(
double
(
how_many_ones_right
)
/
double
(
BSD_samples
)
>
parameter_early_stop_accuracy
)
all_one_right_list
[
j
]
=
1
;
}
else
{
all_zero_left_list
[
j
]
=
1
;
all_zero_left_list
[
j
]
=
1
;
all_one_left_list
[
j
]
=
1
;
all_one_left_list
[
j
]
=
1
;
all_zero_right_list
[
j
]
=
1
;
all_zero_right_list
[
j
]
=
1
;
...
...
src/tool_function.h
View file @
e5ac145a
...
@@ -67,7 +67,31 @@ int BDD_class::compare_simplify_list(int list_line_amount,bool* this_line,bool**
...
@@ -67,7 +67,31 @@ int BDD_class::compare_simplify_list(int list_line_amount,bool* this_line,bool**
int
i
,
j
;
int
i
,
j
;
bool
it_can_simplify_here
;
bool
it_can_simplify_here
;
which_list_number
=
-
1
;
which_list_number
=
-
1
;
if
(
1
){
double
early_stop_accuracy_node
=
1
-
(
1
-
parameter_early_stop_accuracy
)
/
double
(
4
);
if
(
early_stop_accuracy_node
<
1
-
double
(
1
)
/
BSD_samples
){
for
(
int
i
=
list_line_amount
-
1
;
i
>=
0
;
i
--
){
it_can_simplify_here
=
0
;
int
same_bit
=
0
;
if
((
hash_number
<
double
(
hash_simplify_list
[
i
])
*
early_stop_accuracy_node
)
||
(
hash_number
>
double
(
hash_simplify_list
[
i
])
/
early_stop_accuracy_node
)){
it_can_simplify_here
=
0
;
}
else
{
for
(
int
j
=
0
;
j
<
BSD_samples
;
j
++
){
if
(
simplify_list
[
i
][
j
]
==
this_line
[
j
]){
same_bit
+=
1
;
}
}
if
(
double
(
same_bit
)
/
double
(
BSD_samples
)
>
early_stop_accuracy_node
)
it_can_simplify_here
=
1
;
}
if
(
it_can_simplify_here
){
it_can_simplify
=
1
;
which_list_number
=
i
;
break
;
}
}
}
else
{
for
(
int
i
=
list_line_amount
-
1
;
i
>=
0
;
i
--
){
for
(
int
i
=
list_line_amount
-
1
;
i
>=
0
;
i
--
){
it_can_simplify_here
=
1
;
it_can_simplify_here
=
1
;
if
(
hash_number
!=
hash_simplify_list
[
i
]){
if
(
hash_number
!=
hash_simplify_list
[
i
]){
...
...
src/top.h
View file @
e5ac145a
...
@@ -10,6 +10,8 @@ int parameter_output_bit_width = PO_WIDTH;//最小为1,最大为PO_WIDTH
...
@@ -10,6 +10,8 @@ int parameter_output_bit_width = PO_WIDTH;//最小为1,最大为PO_WIDTH
extern
const
int
parameter_search_iterations
=
10
;
//最大设计次数
extern
const
int
parameter_search_iterations
=
10
;
//最大设计次数
extern
const
int
parameter_test_ios
=
1000000
;
//测试要求多少样本
extern
const
int
parameter_test_ios
=
1000000
;
//测试要求多少样本
extern
const
int
parameter_max_samples
=
64
*
100
;
//BSD每一个节点最多进行多少次采样,至少为64
extern
const
int
parameter_max_samples
=
64
*
100
;
//BSD每一个节点最多进行多少次采样,至少为64
extern
const
double
parameter_early_stop_accuracy
=
0
.
99
;
//允许的错误率,如果完全不允许,设为1; 没有特殊需要不要设到<1,会慢一些。
//0.5以下无意义,建议至少设到0.8吧.
extern
const
int
parameter_num_threads
=
32
;
//线程数
extern
const
int
parameter_num_threads
=
32
;
//线程数
...
...
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