Skip to content

Commit

Permalink
Fixed time scale
Browse files Browse the repository at this point in the history
  • Loading branch information
tand00 committed Aug 15, 2024
1 parent a07df2f commit 483cd64
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ void ProbabilityEstimation::printStats() {
SMCVerification::printStats();
std::cout << " valid runs:\t" << validRuns << std::endl;
if(validRuns > 0) printValidRunsStats();
if(!options.mustPrintCumulative()) return;
printCumulativeStats();
if(options.mustPrintCumulative()) printCumulativeStats();

}

void ProbabilityEstimation::printValidRunsStats() {
Expand Down Expand Up @@ -106,23 +106,24 @@ void ProbabilityEstimation::printCumulativeStats() {
std::cout << (validPerStep.size() - 1) << ":" << getEstimation() << ";" << std::endl;
std::cout << " cumulative probability / delay :" << std::endl;
acc = 0;
binSize = timeScale == 0 ? 1 : maxValidDuration / (double) timeScale;
std::vector<double> bins(round(maxValidDuration / binSize), 0);
binSize = timeScale == 0 ? 1 : (maxValidDuration / (double) timeScale);
std::vector<double> bins((size_t) round(maxValidDuration / binSize) + 1, 0.0f);
lastAcc = -1;
for(int i = 0 ; i < validPerDelay.size() ; i++) {
double delay = validPerDelay[i];
int binIndex = (int) round(delay / binSize);
bins[binIndex] += 1;
}
for(int i = 0 ; i < bins.size() ; i++) {
for(int i = 0 ; i < bins.size() - 1 ; i++) {
acc += bins[i] / (double) numberOfRuns;
double toPrint = round(acc * mult) / mult;
if(toPrint != lastAcc) {
std::cout << ((i + 1) * binSize) << ":" << toPrint << ";";
double binIndex = std::min(((i + 1) * binSize), (double) maxValidDuration);
std::cout << binIndex << ":" << toPrint << ";";
lastAcc = toPrint;
}
}
std::cout << maxValidDuration << ":" << getEstimation() << ";" << std::endl;
std::cout << std::endl;
}

void ProbabilityEstimation::printResult() {
Expand Down

0 comments on commit 483cd64

Please sign in to comment.