Make PGS solver constraint visitation order time-independent.
PiperOrigin-RevId: 914741347 Change-Id: I7889a42543e9a9f3ff883e25ee9eafaceedc29e1
This commit is contained in:
committed by
Copybara-Service
parent
99e626096f
commit
7bfdbad80b
@@ -5,6 +5,12 @@ Changelog
|
|||||||
Upcoming version (not yet released)
|
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
|
.. admonition:: Breaking API changes
|
||||||
:class: attention
|
:class: attention
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
pcg32_state rng;
|
||||||
uint64_t seed = 0;
|
|
||||||
memcpy(&seed, &d->time, sizeof(d->time));
|
|
||||||
rng.state = 0;
|
rng.state = 0;
|
||||||
rng.inc = 1;
|
rng.inc = 1;
|
||||||
rng.state = seed;
|
|
||||||
pcg32_next(&rng);
|
|
||||||
rng.state += seed;
|
|
||||||
pcg32_next(&rng);
|
pcg32_next(&rng);
|
||||||
|
|
||||||
// main iteration
|
// main iteration
|
||||||
|
|||||||
Reference in New Issue
Block a user