Clarify in mju_boxQP test that for the synthetic test set, the average number of factorizations is expected to be 5 or less, while the worst case is expected to be 6 or less.

PiperOrigin-RevId: 691037804
Change-Id: Id0bc8bedf08d623efcacbe696775f0ef0f6781b9
This commit is contained in:
Yuval Tassa
2024-10-29 08:54:39 -07:00
committed by Copybara-Service
parent 1336e99d88
commit e889cffe23
+14 -1
View File
@@ -16,8 +16,12 @@
#include "src/engine/engine_util_solve.h"
#include <cstddef>
#include <iostream>
#include <random>
#include <iomanip>
#include <string>
#include <vector>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -332,12 +336,21 @@ TEST_F(BoxQPTest, BoundedQPvariations) {
string slog(log);
string factorstr = "factorizations=";
std::size_t index = slog.find(factorstr) + factorstr.length();
factorizations += std::stoi(slog.substr(index, 3));
int num_factor = std::stoi(slog.substr(index, 3));
// never more than 6 factorizations
EXPECT_LE(num_factor, 6);
factorizations += num_factor;
count++;
}
}
}
double meanfactor = ((double)factorizations) / count;
// average of 4.5 factorizations is expected
EXPECT_LE(meanfactor, 5.0);
std::cerr << "n=" << setw(3) << n
<< ": average of " << meanfactor << " factorizations\n";
}