Make PGS solver constraint visitation order time-independent.

PiperOrigin-RevId: 914741347
Change-Id: I7889a42543e9a9f3ff883e25ee9eafaceedc29e1
This commit is contained in:
Yuval Tassa
2026-05-13 02:33:50 -07:00
committed by Copybara-Service
parent 99e626096f
commit 7bfdbad80b
2 changed files with 7 additions and 6 deletions
+6
View File
@@ -5,6 +5,12 @@ Changelog
Upcoming version (not yet released)
-----------------------------------
General
^^^^^^^
- The pseudo-random constraint visitation order in the :ref:`PGS solver<soAlgorithms>`, introduced in the previous
release, now uses a fixed seed. The previous implementation seeded with ``mjData.time``, which introduced subtle yet
undesirable time dependence.
.. admonition:: Breaking API changes
:class: attention
+1 -6
View File
@@ -444,15 +444,10 @@ static void solPGS(const mjModel* m, mjData* d, int island,
}
}
// seed PCG32 RNG from simulation time
// seed PCG32 RNG with a fixed seed
pcg32_state rng;
uint64_t seed = 0;
memcpy(&seed, &d->time, sizeof(d->time));
rng.state = 0;
rng.inc = 1;
rng.state = seed;
pcg32_next(&rng);
rng.state += seed;
pcg32_next(&rng);
// main iteration