Skip to content

Commit 237e351

Browse files
committed
Add counters for single nodes and subtrees
1 parent b4dba6d commit 237e351

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

highs/ipm/hipo/factorhighs/Analyse.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,7 @@ void Analyse::findTreeSplitting() {
12861286
auto res_insert = tree_splitting_.insert({sn, {}});
12871287
is_in_tree_splitting_[sn] = true;
12881288
res_insert.first->second.type = NodeType::single;
1289+
num_single_++;
12891290

12901291
// The children of this sn are either single nodes or head of subtrees.
12911292
// Divide the head of subtrees in groups, so that each group has 1% to 2%
@@ -1299,6 +1300,8 @@ void Analyse::findTreeSplitting() {
12991300
bool is_small = subtree_ops[child] <= small_thresh;
13001301

13011302
if (is_small) {
1303+
num_subtrees_++;
1304+
13021305
if (!current_nodedata) {
13031306
auto res_insert = tree_splitting_.insert({child, {}});
13041307
is_in_tree_splitting_[child] = true;
@@ -1489,6 +1492,8 @@ Int Analyse::run(Symbolic& S) {
14891492
S.flops_ = dense_ops_;
14901493
S.block_size_ = nb_;
14911494
S.max_stack_size_ = max_stack_size_;
1495+
S.num_single_ = num_single_;
1496+
S.num_subtrees_ = num_subtrees_;
14921497

14931498
// compute largest supernode
14941499
std::vector<Int> sn_size(sn_start_.begin() + 1, sn_start_.end());

highs/ipm/hipo/factorhighs/Analyse.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ class Analyse {
7979

8080
std::map<Int, NodeData> tree_splitting_;
8181
std::vector<bool> is_in_tree_splitting_;
82+
Int num_single_{};
83+
Int num_subtrees_{};
8284

8385
std::vector<int64_t> stack_subtrees_{};
8486
int64_t max_stack_size_{};

highs/ipm/hipo/factorhighs/Symbolic.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ void Symbolic::print(const Log& log, bool verbose) const {
9797
<< '\n';
9898
log_stream << textline("Number of tasks:")
9999
<< integer(tree_splitting_.size()) << '\n';
100+
log_stream << textline("Number of single nodes:") << integer(num_single_)
101+
<< '\n';
102+
log_stream << textline("Number of subtrees:") << integer(num_subtrees_)
103+
<< '\n';
100104
log_stream << textline("Artificial nz:") << sci(artificial_nz_, 0, 1)
101105
<< '\n';
102106
log_stream << textline("Artificial ops:") << sci(artificial_ops_, 0, 1)

highs/ipm/hipo/factorhighs/Symbolic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class Symbolic {
4646
Int sn_size_10_{};
4747
Int sn_size_100_{};
4848
int64_t max_stack_size_{};
49+
Int num_single_, num_subtrees_;
4950

5051
// Inverse permutation
5152
std::vector<Int> iperm_{};

0 commit comments

Comments
 (0)