verbal-autopsy-software / InSilicoVA

R package for InSilicoVA framework
3 stars 6 forks source link

While loop off by one #4

Closed mjutras-mitre closed 5 years ago

mjutras-mitre commented 5 years ago

While loop at line 1493 is preceded by a comment that the max number of runs=3. If that is the desired behavior then the loop termination condition should be while(!conv && add<=3) rather than while(!conv && add<3)

https://github.com/verbal-autopsy-software/InSilicoVA/blob/9b17c383fe726cda8f54ee3a4b44de372bd74644/InSilicoVA/R/insilico_core.r#L1491-L1493

richardli commented 5 years ago

Thanks. The code is correct. The comment is a little misleading - it counts the original run as run 1, and at most two additional runs are added here.

pkmitre commented 5 years ago

Is the original run occurring above the loop, on line 1454?

https://github.com/verbal-autopsy-software/InSilicoVA/blob/9b17c383fe726cda8f54ee3a4b44de372bd74644/InSilicoVA/R/insilico_core.r#L1454

richardli commented 5 years ago

yes that's right