File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
highs/ipm/hipo/factorhighs Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 11#include " Analyse.h"
22
3+ #include < algorithm>
34#include < fstream>
45#include < iostream>
56#include < limits>
@@ -474,12 +475,17 @@ void Analyse::relaxSn() {
474475 merged_sn_ = 0 ;
475476
476477 for (Int sn = 0 ; sn < sn_count_; ++sn) {
478+ // sort children by increasing size
479+ std::vector<Int> children;
477480 Int child = first_child[sn];
478- Int64 nz_fakenz = int64_limit;
479- Int size_fakenz = 0 ;
480- Int child_fakenz = -1 ;
481-
482481 while (child != -1 ) {
482+ children.push_back (child);
483+ child = next_child[child];
484+ }
485+ std::sort (children.begin (), children.end (),
486+ [&](Int a, Int b) { return sn_size[a] < sn_size[b]; });
487+
488+ for (Int child : children) {
483489 // how many zero rows would become nonzero
484490 const Int rows_filled =
485491 sn_size[sn] + clique_size[sn] - clique_size[child];
@@ -503,15 +509,11 @@ void Analyse::relaxSn() {
503509
504510 if (net_ops < 0 ) {
505511 // merge child with parent
506-
507512 sn_size[sn] += sn_size[child];
508513 fake_nz_[sn] = total_art_nz;
509-
510514 ++merged_sn_;
511515 merged_into_[child] = sn;
512516 }
513-
514- child = next_child[child];
515517 }
516518 }
517519}
You can’t perform that action at this time.
0 commit comments