allenai/tuffy — pull request #4 by ericgribkoff (2014-07-17 16:27:14+00:00)
Title: Deterministic

This adds the following command line options to Tuffy:

-seed : sets the seed for Java's random number generator
-pgSeed : sets the seed for Postgres's random number generator (value between 0.0 and 1.0)

It replaces the use of Hashtable and HashMap with LinkedHashMap, and replaces HashSet with LinkedHashSet. It also replaces ConcurrentHashMap with LinkedHashMap.

This removes any non-determinism in Tuffy (except, possibly, as a result of the row ordering returned by Postgres, although this hasn't been observed as an issue yet). Setting the Postgres random seed is only necessary if using Tuffy's partitioning when grounding the MLN.

However, the use of LinkedHashMap means that some of the inference algorithms may no longer be sound when running multiple threads simultaneously. Tuffy has a '-threads 1' option that will limit inference to a single thread.