Counting number of nodes should exclude solution
See original GitHub issueIn Solver
, the extend
case in searchloop()
counts a node even if no extension is done:
case extend:
left = true;
searchMonitors.beforeOpenNode();
mMeasures.incNodeCount();
if (!M.extend(this)) {
action = validate;
} else {
action = propagate;
}
searchMonitors.afterOpenNode();
break;
I suggest to not increment the number of nodes when a solution is found:
case extend:
left = true;
searchMonitors.beforeOpenNode();
if (!M.extend(this)) {
action = validate;
} else {
mMeasures.incNodeCount();
action = propagate;
}
searchMonitors.afterOpenNode();
break;
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Count full nodes in a Binary tree (Iterative and Recursive)
Given A binary Tree, how do you count all the full nodes (Nodes which have both children as not NULL) without using recursion...
Read more >Count Complete Tree Nodes - LeetCode
Given the root of a complete binary tree, return the number of the nodes in the tree. ... It can have between 1...
Read more >Count Complete Tree Nodes | Leetcode #222 - YouTube
This video explains a very important programming interview problem which is to count the number of nodes in a given complete binary tree....
Read more >LeetCode 1782. Count Pairs Of Nodes - YouTube
Your browser can 't play this video. ... Count Pairs Of Nodes ... LeetCode 1329 : C++ Solution | Sort the Matrix Diagonally....
Read more >How to Count Number of Leaf Nodes in a Binary Tree in Java ...
There are two reasons for doing that, the first earlier method expects a starting node, which should be root. It's cleaner for the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think there is no s
Ok, so an alternative would to add a new API like
getDecisionsCount()
which returns the correct number of decisions taken so far, and to patchgetNodeCount()
so it returnsgetDecisionsCount() + getSolutionCount()
.(btw, shouldn’t we add an ‘s’ in ‘getDecisionsCount()’ ?)