Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
yq committed Jun 15, 2019
1 parent 63547e9 commit 536d661
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion include/KM.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class KM {
public:
KM(const vector< vector<double> > & _edges);
vector<int> solve();
vector<int> cut_loops();
vector< vector<int> > cut_loops();

void print_edges();
void print_matches();
Expand Down
13 changes: 3 additions & 10 deletions src/solver/KM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ vector<int> KM::solve() {

}

vector<int> KM::cut_loops() {
vector< vector<int> > KM::cut_loops() {

vector<int> arr;
vector<bool> visited(nodes_n, false);
Expand Down Expand Up @@ -83,19 +83,12 @@ vector<int> KM::cut_loops() {
p = match_x[p];
} while (p != match_x[st_idx]);

reverse(group.begin(), group.end());
groups.push_back(group);
}

for (int i = 0; i < groups.size(); i++) {

for (int j = 0; j < groups.size(); j++) {
if (i == j) continue;

}
}

reverse(arr.begin(), arr.end());
return arr;
return groups;

}

Expand Down
21 changes: 17 additions & 4 deletions src/solver/stripes_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,9 @@ void StripesSolver::m_metric() {

vector< vector<int> > StripesSolver::reassemble_greedy() {

random_device rand_device;
default_random_engine rand_engine(rand_device());
uniform_real_distribution<double> uniform_unit_dist(0, 1);
// random_device rand_device;
// default_random_engine rand_engine(rand_device());
// uniform_real_distribution<double> uniform_unit_dist(0, 1);

vector<int> stripe_left(stripes_n, -1);
vector<int> stripe_right(stripes_n, -1);
Expand Down Expand Up @@ -862,13 +862,26 @@ void StripesSolver::optimal_match(vector< vector<int> > & fragments) {

KM KM_solver(bigraph_w);
KM_solver.solve();
vector<int> arr = KM_solver.cut_loops();
vector< vector<int> > groups = KM_solver.cut_loops();

#ifdef DEBUG
KM_solver.print_edges();
KM_solver.print_matches();
#endif

int groups_n = groups.size();
for (int i = 0; i < groups_n; i++) {
for (int j = 0; j < groups_n; j++) {
if (i == j) continue;
if (bigraph_w[i][j])
group_pairs.push_back(StripePair(i, j, bigraph_w[i][j]));
}
}

sort(group_pairs.begin(), group_pairs.end());



composition_order.clear();
for (int frag_idx: arr) {
composition_order.insert(
Expand Down

0 comments on commit 536d661

Please sign in to comment.