Physics Reproducibility

I’m experimenting with Machine Learning and would like a reset (in this case a cart and pole) so that the physics is reproducible.

On closer inspection the results with the usual way of resetting, e.g.:




Vector3f initCartPos = new Vector3f(0f, 0.1f, 0f);


cartControl.setPhysicsRotation(new Matrix3f());

vary slightly on each reset.

After some investigation, one possible cause is that the random seed is not reset in the constrain solver for collision processing. The Bullet ConstrainSolver class has a method reset() that clears internal cached data and resets the random seed.

Is this accessible in jME3 and if yes, how would I invoke it?

You could in theory do this in the jbullet version though its not recommended. Use physicsRigidBody.getObjectId() to get the actual jbullet object which should give you access to any “native” bullet methods that jbullet exposes. If you find a solution in that please report back so we can work out on how to integrate this in the engine and its accessors for the bullet engine. It would also be great if you could post an accompanying test case for the issue. In native bullet the bullet methods are obviously not accessible and the getObjectId() only returns an address of the native object so we need a solution for this.

The jbullet/bullet libraries do not support reproducibility to begin with so I don’t know how much that will even help.