Skip to content

Commit

Permalink
Merge branch '3563-sassy-preprocessor-red_deg2_trivial_connect-sassy-…
Browse files Browse the repository at this point in the history
…sgraph-int-sassy-sassy_hook-assertion-2' into 'master'

Resolve "sassy::preprocessor::red_deg2_trivial_connect(sassy::sgraph*, int*, sassy::sassy_hook*): Assertion `path_col_sz == (not_unique_analysis[endpoint_col] * color_size)' failed."

Closes #3563

See merge request integer/scip!3081
  • Loading branch information
Mathieu Besançon committed Jul 22, 2023
2 parents e58a523 + 2c98b73 commit 926d31a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/sassy/preprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ namespace sassy {

mark_set path_done(g->v_size);
work_list color_pos(g->v_size);
work_list filter(g->v_size);
//work_list filter(g->v_size);
work_list not_unique(2*g->v_size);
work_list not_unique_analysis(g->v_size);
work_list path_list(g->v_size);
Expand Down Expand Up @@ -986,15 +986,15 @@ namespace sassy {
color_test.set(neighbour_col);
}

filter.reset();
//filter.reset();
not_unique.reset();
// filter to indices with unique colors
for (int j = 0; j < endpoints; ++j) {
const int neighbour = connected_paths[g->v[test_vertex] + j];
const int neighbour_col = col.vertex_to_col[neighbour];
if (!color_unique.get(neighbour_col)) { // if unique
filter.push_back(j); // add index to filter
} else {
//filter.push_back(j); // add index to filter
} else { // if not unique
not_unique.push_back(neighbour);
assert(connected_endpoints[g->v[test_vertex] + j] >= 0);
assert(connected_endpoints[g->v[test_vertex] + j] < g->v_size);
Expand All @@ -1009,23 +1009,29 @@ namespace sassy {
for (int kk = 0; kk < not_unique.cur_pos; kk += 2) {
const int endpoint = not_unique[kk + 1];
const int endpoint_col = col.vertex_to_col[endpoint];
not_unique_analysis[endpoint_col] = 0;
const int neighbour = not_unique[kk];
const int neighbour_col = col.vertex_to_col[neighbour];
not_unique_analysis[endpoint_col] = 0;
not_unique_analysis[neighbour_col] = 0;
}
for (int kk = 0; kk < not_unique.cur_pos; kk += 2) {
const int endpoint = not_unique[kk + 1];
const int endpoint_col = col.vertex_to_col[endpoint];
const int neighbour = not_unique[kk];
const int neighbour_col = col.vertex_to_col[neighbour];
++not_unique_analysis[endpoint_col];
++not_unique_analysis[neighbour_col];
}
for (int kk = 0; kk < not_unique.cur_pos; kk += 2) {
const int neighbour = not_unique[kk];
const int neighbour_col = col.vertex_to_col[neighbour];
const int endpoint = not_unique[kk + 1];
const int endpoint_col = col.vertex_to_col[endpoint];
const int endpoint_col_sz = col.ptn[endpoint_col] + 1;
path.reset();
if (!color_test.get(endpoint_col)) {
color_test.set(endpoint_col);

if (not_unique_analysis[endpoint_col] == col.ptn[endpoint_col] + 1) {
if (not_unique_analysis[endpoint_col] == not_unique_analysis[neighbour_col] && not_unique_analysis[endpoint_col] == col.ptn[endpoint_col] + 1) {
// check that path endpoints dont contain duplicates
bool all_unique = true;
color_unique.reset();
Expand All @@ -1041,12 +1047,12 @@ namespace sassy {
}
}

if (all_unique && col.ptn[endpoint_col] + 1 == not_unique_analysis[endpoint_col] && color < endpoint_col) { // col.ptn[endpoint_col] + 1 == 2 && color_size == 2 && only_once
// TODO: make sure it's not doubly-connected to one of the vertices (need to check this for every vertex, actually)?
// test_vertex connects to all vertices of endpoint_col!
if (all_unique && color < endpoint_col) { // col.ptn[endpoint_col] + 1 == 2 && color_size == 2 && only_once
const int path_col = col.vertex_to_col[neighbour];
const int path_col_sz = col.ptn[path_col] + 1;

assert(path_col_sz == (not_unique_analysis[endpoint_col] * color_size));
const int connects_to = not_unique_analysis[endpoint_col];
assert(path_col_sz == (connects_to * color_size));
assert(endpoint_col_sz == not_unique_analysis[endpoint_col]);


Expand Down Expand Up @@ -4646,6 +4652,9 @@ namespace sassy {
PRINT("____________________________________________________");
PRINT(std::setw(16) << std::left << (std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - std::chrono::high_resolution_clock::now()).count()) / 1000000.0 << std::setw(16) << "start" << std::setw(10) << g->v_size << std::setw(10) << g->e_size );

//SV took this out, as it is only used if the PRINT macro is enabled (and CONFIG_PRINT is enabled)
//SV std::chrono::high_resolution_clock::time_point timer = std::chrono::high_resolution_clock::now();

if(config->CONFIG_TRANSLATE_ONLY) {
translate_layer_fwd.reserve(g->v_size);
backward_translation_layers.emplace_back(std::vector<int>());
Expand Down
20 changes: 20 additions & 0 deletions src/symmetry/compute_symmetry_sassy_bliss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,35 @@
#include <bliss/graph.hh>

/* include sassy */
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif

#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4189) // local variable is initialized but not referenced
# pragma warning(disable: 4388) // compare signed and unsigned expression
# pragma warning(disable: 4456) // shadowed variable
# pragma warning(disable: 4430) // missing type specifier
#endif

/* the actual include */
#include <sassy/preprocessor.h>

#ifdef __GNUC__
#pragma GCC diagnostic warning "-Wunused-but-set-variable"
#pragma GCC diagnostic warning "-Wsign-compare"
#pragma GCC diagnostic warning "-Wunused-variable"
#pragma GCC diagnostic warning "-Wshadow"
#endif

#ifdef _MSC_VER
# pragma warning(pop)
#endif

#include <sassy/tools/bliss_converter.h>

#include "scip/expr_var.h"
Expand Down

0 comments on commit 926d31a

Please sign in to comment.