25 namespace search_strategy {
61 int cost_snapshot = 0;
76 ws_printer(printer), ws_automorphism(automorphism) {}
89 int ind_v_right, ind_v_left;
90 std::tie(ind_v_left, ind_v_right) = state_right.
diff_pair(state_left);
96 const int col_sz_right = state_right.
c->
ptn[col] + 1;
97 const int col_sz_left = state_left.
c->
ptn[col] + 1;
102 if (col_sz_right < 2 || col_sz_left != col_sz_right)
return 0;
130 ws_automorphism.
reset();
132 const bool found_auto = state_right.
certify(g, ws_automorphism);
147 std::vector<std::pair<int, int>>& computed_orbits,
bool prune =
true) {
160 ws_automorphism.
reset();
171 int failed_first_level = -1;
174 double recent_cost_snapshot = 0;
176 int trace_pos_reset = 0;
187 const int col_sz = state_right.
c->
ptn[col] + 1;
189 if((state_right.
s_base_pos & 0x00000FFF) == 0x00000FFD)
192 -state_right.
s_base_pos,
"cost_snapshot", recent_cost_snapshot);
196 int prune_cost_snapshot = 0;
197 orbit_handled.
reset();
200 for (
int i = 0; i < col_sz; ++i) {
208 if(orbit_handled.
get(ind_v))
continue;
209 orbit_handled.
set(ind_v);
228 const int prev_base_pos = state_right.
s_base_pos;
235 bool found_auto =
false;
242 const int wr_pos_st = state_right.
base[state_right.
base.size() - 1].singleton_pt;
243 const int wr_pos_end = (int) state_right.
singletons.size();
245 ws_automorphism.
reset();
252 found_auto = state_right.
certify(g, ws_automorphism);
254 dej_assert(ws_automorphism.
p()[base_vertex] == ind_v);
257 ws_automorphism.
reset();
268 found_auto = (return_code == 1);
269 pruned = (return_code == 2);
275 double cost_partial = (cost_end - cost_start) / (cost_snapshot*1.0);
276 recent_cost_snapshot = (cost_partial + recent_cost_snapshot * 3) / 4;
277 prune_cost_snapshot += pruned?(cost_end - cost_start):0;
282 dej_assert(ws_automorphism.
p()[ind_v] == base_vertex ||
283 ws_automorphism.
p()[base_vertex] == ind_v);
285 if(hook) (*hook)(g->
v_size, ws_automorphism.
p(), ws_automorphism.
nsupp(),
286 ws_automorphism.
supp());
288 ws_automorphism.
reset();
291 while (prev_base_pos < state_right.
s_base_pos) {
298 if ((!found_auto && !pruned) ||
299 ((4*prune_cost_snapshot > cost_snapshot) && (prev_base_pos > 0)) ||
300 (pruned && !prune)) {
302 if(failed_first_level == -1)
322 return fail?failed_first_level + (fail):state_right.
s_base_pos;
326 std::vector<std::pair<int, int>>& computed_orbits,
bool prune =
true) {
335 ws_automorphism.
reset();
343 int failed_first_level = -1;
346 double recent_cost_snapshot = 0;
348 int trace_pos_reset = 0;
356 if((state_right.
s_base_pos & 0x00000FFF) == 0x00000FFD)
359 -state_right.
s_base_pos,
"cost_snapshot", recent_cost_snapshot);
362 const int col_sz = state_right.
c->
ptn[col] + 1;
366 int prune_cost_snapshot = 0;
369 for (
int i = 0; i < col_sz; ++i) {
381 const int prev_base_pos = state_right.
s_base_pos;
388 bool found_auto =
false;
395 const int wr_pos_st = state_right.
base[state_right.
base.size() - 1].singleton_pt;
396 const int wr_pos_end = (int) state_right.
singletons.size();
398 ws_automorphism.
reset();
404 found_auto = state_right.
certify(g, ws_automorphism);
406 dej_assert(ws_automorphism.
p()[base_vertex] == ind_v);
412 double cost_partial = (cost_end - cost_start) / (cost_snapshot*1.0);
413 recent_cost_snapshot = (cost_partial + recent_cost_snapshot * 3) / 4;
414 prune_cost_snapshot += pruned?(cost_end - cost_start):0;
419 dej_assert(ws_automorphism.
p()[ind_v] == base_vertex ||
420 ws_automorphism.
p()[base_vertex] == ind_v);
422 if(hook) (*hook)(g->
v_size, ws_automorphism.
p(), ws_automorphism.
nsupp(),
423 ws_automorphism.
supp());
425 ws_automorphism.
reset();
428 while (prev_base_pos < state_right.
s_base_pos) {
435 if ((!found_auto && !pruned) ||
436 ((4*prune_cost_snapshot > cost_snapshot) && (prev_base_pos > 0)) ||
437 (pruned && !prune)) {
439 if(failed_first_level == -1)
459 return fail?failed_first_level + (fail):state_right.
s_base_pos;
void multiply(int number)
Set specialized for quick resets.
Fixed-size integer array, 0-initialized.
Workspace for sparse automorphisms.
void cycle_completion(markset &scratch_set)
dej_nodiscard int nsupp() const
dej_nodiscard int * p() const
dej_nodiscard int * supp() const
void write_singleton(const std::vector< int > *singletons1, const std::vector< int > *singletons2, const int pos_start, const int pos_end)
bool are_in_same_orbit(const int v1, const int v2)
int orbit_size(const int v)
void initialize(int domain_size)
dej_nodiscard bool represents_orbit(const int v) const
int find_orbit(const int v)
void add_automorphism_to_orbit(const int *p, const int nsupp, const int *supp)
dej_nodiscard int get_position() const
dej_nodiscard unsigned long get_hash() const
void reset_trace_unequal()
void set_position(int new_position)
dej_nodiscard bool trace_equal() const
Depth-first search without backtracking.
dfs_ir(timed_print &printer, groups::automorphism_workspace &automorphism)
double h_recent_cost_snapshot_limit
int do_paired_dfs(dejavu_hook *hook, sgraph *g, ir::controller &state_left, ir::controller &state_right, std::vector< std::pair< int, int > > &computed_orbits, bool prune=true)
termination_reason s_termination
int do_simple_dfs(dejavu_hook *hook, sgraph *g, ir::controller &state_right, std::vector< std::pair< int, int > > &computed_orbits, bool prune=true)
int paired_recurse_to_equal_leaf(sgraph *g, ir::controller &state_left, ir::controller &state_right, bool recurse=false)
Internal graph data structure.
Prints information to the console.
void progress_current_method(const std::string &print) const
Controls movement in IR tree.
std::vector< int > * compare_base_vertex
std::vector< base_info > * compare_base
std::vector< base_info > base
void link_compare(controller *state)
bool update_diff_vertices_last_individualization(const controller &other_state)
std::vector< int > singletons
void move_to_child(sgraph *g, int v)
dej_nodiscard int get_diff_diverge() const
void singleton_automorphism(controller &state, groups::automorphism_workspace &automorphism)
void use_trace_early_out(bool trace_early_out)
std::vector< int > * compare_singletons
std::pair< int, int > diff_pair(const controller &state)
bool certify(sgraph *g, groups::automorphism_workspace &automorphism)
bool there_is_difference_to_base_including_singles(int domain_size)
std::function< void(int, const int *, int, const int *)> dejavu_hook