Randomize PGS constraint visitation order.

Total testspeed runtime for `2humanoids100.xml` reduced by 19.6% (49.5 -> 39.8s).

PiperOrigin-RevId: 910608140
Change-Id: Ided0ae5bdb8e4e8196f84e08354a9ae8cfa5b626
This commit is contained in:
Yuval Tassa
2026-05-05 05:08:19 -07:00
committed by Copybara-Service
parent 88bff84cbb
commit 4ed69b5ce7
3 changed files with 65 additions and 9 deletions
+3 -3
View File
@@ -603,7 +603,7 @@ TEST_F(IslandTest, EqualityConstraintOfTendons) {
mj_deleteModel(model);
}
TEST_F(IslandTest, PGSIslandExact) {
TEST_F(IslandTest, PGSIsland) {
const std::string xml_path = GetTestDataFilePath(kIlslandEfcPath);
char error[1024];
mjModel* m = mj_loadXML(xml_path.c_str(), nullptr, error, sizeof(error));
@@ -632,8 +632,8 @@ TEST_F(IslandTest, PGSIslandExact) {
std::vector<mjtNum> qfrc_mono(d->qfrc_constraint,
d->qfrc_constraint + m->nv);
// expect exact match
EXPECT_EQ(qfrc_island, qfrc_mono);
// expect close match (inexact due to randomized constraint visitation order)
EXPECT_THAT(qfrc_island, Pointwise(MjNear(1e-3, 1e-3), qfrc_mono));
mj_deleteData(d);
mj_deleteModel(m);