]> gitweb.michael.orlitzky.com - dunshire.git/commitdiff
Change EPSILON to something more conservative in the test suite.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 3 Nov 2016 12:06:45 +0000 (08:06 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 3 Nov 2016 12:06:45 +0000 (08:06 -0400)
The old value of EPSILON was more lenient, but the new one can
actually be justified. The tests are currently pretty reliable, but
some tolerance > EPSILON failures are still occurring so this will
probably need to be massaged some more.

test/symmetric_linear_game_test.py

index 470cf6a116aeb578a89450671abfbb6f73f1e9de..da72fd03cca7215602ff81174a906795ffc189a9 100644 (file)
@@ -13,18 +13,22 @@ from .randomgen import (RANDOM_MAX, random_icecream_game,
                         random_nn_scaling, random_orthant_game,
                         random_positive_orthant_game, random_translation)
 
                         random_nn_scaling, random_orthant_game,
                         random_positive_orthant_game, random_translation)
 
-EPSILON = 2*2*RANDOM_MAX*options.ABS_TOL
+EPSILON = (1 + RANDOM_MAX)*options.ABS_TOL
 """
 This is the tolerance constant including fudge factors that we use to
 determine whether or not two numbers are equal in tests.
 
 """
 This is the tolerance constant including fudge factors that we use to
 determine whether or not two numbers are equal in tests.
 
-The factor of two is because if we compare two solutions, both
-of which may be off by ``ABS_TOL``, then the result could be off
-by ``2*ABS_TOL``. The factor of ``RANDOM_MAX`` allows for
-scaling a result (by ``RANDOM_MAX``) that may be off by
-``ABS_TOL``. The final factor of two is to allow for the edge
-cases where we get an "unknown" result and need to lower the
-CVXOPT tolerance by a factor of two.
+Often we will want to compare two solutions, say for games that are
+equivalent. If the first game value is low by ``ABS_TOL`` and the second
+is high by ``ABS_TOL``, then the total could be off by ``2*ABS_TOL``. We
+also subject solutions to translations and scalings, which adds to or
+scales their error. If the first game is low by ``ABS_TOL`` and the
+second is high by ``ABS_TOL`` before scaling, then after scaling, the
+second could be high by ``RANDOM_MAX*ABS_TOL``. That is the rationale
+for the factor of ``1 + RANDOM_MAX`` in ``EPSILON``. Since ``1 +
+RANDOM_MAX`` is greater than ``2*ABS_TOL``, we don't need to handle the
+first issue mentioned (both solutions off by the same amount in opposite
+directions).
 """
 
 # Tell pylint to shut up about the large number of methods.
 """
 
 # Tell pylint to shut up about the large number of methods.