From: Michael Orlitzky Date: Thu, 3 Nov 2016 12:06:45 +0000 (-0400) Subject: Change EPSILON to something more conservative in the test suite. X-Git-Tag: 0.1.0~77 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=c07958ae171cbe3a5dbbb72118cd7c7df3c42770;p=dunshire.git Change EPSILON to something more conservative in the test suite. 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. --- diff --git a/test/symmetric_linear_game_test.py b/test/symmetric_linear_game_test.py index 470cf6a..da72fd0 100644 --- a/test/symmetric_linear_game_test.py +++ b/test/symmetric_linear_game_test.py @@ -13,18 +13,22 @@ from .randomgen import (RANDOM_MAX, random_icecream_game, 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. -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.