question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Counting number of nodes should exclude solution

See original GitHub issue

In 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:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jgFagescommented, Dec 2, 2016

I think there is no s

1reaction
cprudhomcommented, Dec 2, 2016

Ok, so an alternative would to add a new API like getDecisionsCount() which returns the correct number of decisions taken so far, and to patch getNodeCount() so it returns getDecisionsCount() + getSolutionCount().

(btw, shouldn’t we add an ‘s’ in ‘getDecisionsCount()’ ?)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found