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:
committed by
Copybara-Service
parent
1336e99d88
commit
e889cffe23
@@ -16,8 +16,12 @@
|
|||||||
|
|
||||||
#include "src/engine/engine_util_solve.h"
|
#include "src/engine/engine_util_solve.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <iostream>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
@@ -332,12 +336,21 @@ TEST_F(BoxQPTest, BoundedQPvariations) {
|
|||||||
string slog(log);
|
string slog(log);
|
||||||
string factorstr = "factorizations=";
|
string factorstr = "factorizations=";
|
||||||
std::size_t index = slog.find(factorstr) + factorstr.length();
|
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++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double meanfactor = ((double)factorizations) / count;
|
double meanfactor = ((double)factorizations) / count;
|
||||||
|
|
||||||
|
// average of 4.5 factorizations is expected
|
||||||
|
EXPECT_LE(meanfactor, 5.0);
|
||||||
|
|
||||||
std::cerr << "n=" << setw(3) << n
|
std::cerr << "n=" << setw(3) << n
|
||||||
<< ": average of " << meanfactor << " factorizations\n";
|
<< ": average of " << meanfactor << " factorizations\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user