-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprobe.c
48 lines (45 loc) · 1.45 KB
/
probe.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "probe.h"
#include "assign.h"
#include "backtrack.h"
#include "fail.h"
#include "message.h"
#include "propagate.h"
#include "ring.h"
#include "scale.h"
#include "search.h"
#include "utilities.h"
#include "vivify.h"
#include <inttypes.h>
bool probing (struct ring *ring) {
if (!ring->options.probe)
return false;
if (ring->statistics.reductions < ring->limits.probe.reductions)
return false;
return SEARCH_CONFLICTS > ring->limits.probe.conflicts;
}
int probe (struct ring *ring) {
if (!backtrack_propagate_iterate (ring))
return 20;
assert (ring->size);
assert (ring->options.probe);
STOP_SEARCH_AND_START (probe);
assert (ring->context == SEARCH_CONTEXT);
ring->context = PROBING_CONTEXT;
ring->statistics.probings++;
failed_literal_probing (ring);
vivify_clauses (ring);
ring->context = SEARCH_CONTEXT;
ring->last.probing = SEARCH_TICKS;
struct ring_statistics *statistics = &ring->statistics;
struct ring_limits *limits = &ring->limits;
uint64_t base = ring->options.probe_interval;
uint64_t interval = base * nlogn (statistics->probings);
uint64_t scaled = scale_interval (ring, "probe", interval);
limits->probe.conflicts = SEARCH_CONFLICTS + scaled;
limits->probe.reductions = statistics->reductions + 1;
very_verbose (
ring, "new probe limit at %" PRIu64 " after %" PRIu64 " conflicts",
limits->probe.conflicts, scaled);
STOP_AND_START_SEARCH (probe);
return ring->inconsistent ? 20 : 0;
}