Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Emmanuel Hebrard
Blossom
Commits
537bcdec
Commit
537bcdec
authored
Jun 08, 2022
by
ehebrard
Browse files
limit
parent
74cbb405
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/include/Backtrack.hpp
View file @
537bcdec
...
...
@@ -263,6 +263,7 @@ private:
int
solution_root
;
double
prev_cpu
;
int
checking_period
;
bool
interrupted
;
...
...
src/include/utils.hpp
View file @
537bcdec
...
...
@@ -13,8 +13,8 @@
// #define DEBUG_MODE
#define PRINTTRACE \
(options.verbosity >
=
DTOptions::YACKING)
//
#define PRINTTRACE \
//
(options.verbosity > DTOptions::YACKING)
// #define REPRINTTRACE (algo.options.verbosity >= DTOptions::YACKING)
namespace
blossom
{
...
...
src/lib/Backtrack.cpp
View file @
537bcdec
...
...
@@ -155,6 +155,8 @@ void BacktrackingAlgorithm<ErrorPolicy, E_t>::init() {
time_limit
=
options
.
time
;
prev_cpu
=
cpu_time
();
checking_period
=
1000
;
interrupted
=
false
;
...
...
@@ -218,9 +220,25 @@ template <template<typename> class ErrorPolicy, typename E_t>
bool
BacktrackingAlgorithm
<
ErrorPolicy
,
E_t
>::
limit_out
()
{
++
search_size
;
if
(
time_limit
>
0
and
(
num_backtracks
%
checking_period
)
==
0
)
if
(
cpu_time
()
>=
(
time_limit
+
start_time
))
if
(
time_limit
>
0
and
(
search_size
%
checking_period
)
==
0
)
{
print_new_best
();
auto
cpu_now
{
cpu_time
()};
cout
<<
(
cpu_now
-
prev_cpu
)
<<
endl
;
if
((
cpu_now
-
prev_cpu
)
<
.25
)
checking_period
*=
2
;
else
if
((
cpu_now
-
prev_cpu
)
>
1
)
checking_period
/=
2
;
prev_cpu
=
cpu_now
;
if
(
cpu_now
>=
(
time_limit
+
start_time
))
interrupted
=
true
;
}
interrupted
=
interrupted
or
(
search_limit
and
search_size
>
search_limit
);
return
interrupted
;
...
...
@@ -339,7 +357,7 @@ void BacktrackingAlgorithm<ErrorPolicy, E_t>::print_new_best() {
template
<
template
<
typename
>
class
ErrorPolicy
,
typename
E_t
>
void
BacktrackingAlgorithm
<
ErrorPolicy
,
E_t
>::
print_progress
()
{
if
(
not
options
.
progress
)
if
(
not
options
.
progress
)
return
;
int
width
{
68
};
auto
ne
{
feature
[
0
]
-
ranked_feature
[
0
].
begin
()
+
1
};
...
...
@@ -1343,6 +1361,9 @@ bool BacktrackingAlgorithm<ErrorPolicy, E_t>::search() {
PRINT_TRACE
;
DO_ASSERTS
;
if
(
blossom
.
empty
())
{
if
(
not
notify_solution
(
sat
))
...
...
Write
Preview
Supports
Markdown
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