X-Git-Url: https://gitweb.michael.orlitzky.com/?p=dunshire.git;a=blobdiff_plain;f=dunshire%2Fgames.py;h=f9877b334cfa3bcf2d60c6269ecbf4340de24eb1;hp=0a473915716de7f4be4ce7d99cbc64d87c960795;hb=f5b5ef66e41ae0538eb32e4b8420c36a23b95361;hpb=8371d92c42c7faded26d8ef327129ad6d8c72d73 diff --git a/dunshire/games.py b/dunshire/games.py index 0a47391..f9877b3 100644 --- a/dunshire/games.py +++ b/dunshire/games.py @@ -4,8 +4,6 @@ Symmetric linear games and their solutions. This module contains the main :class:`SymmetricLinearGame` class that knows how to solve a linear game. """ -from math import sqrt - from cvxopt import matrix, printing, solvers from .cones import CartesianProduct, IceCream, NonnegativeOrthant from .errors import GameUnsolvableException, PoorScalingException @@ -833,9 +831,10 @@ class SymmetricLinearGame: # 45-45-90 triangle and the shortest distance to the # outside of the cone should be 1/sqrt(2) of that. # It works in R^2, so it works everywhere, right? + # We use "2" because it's better numerically than sqrt(2). height = self.e1()[0] radius = norm(self.e1()[1:]) - dist = (height - radius) / sqrt(2) + dist = (height - radius) / 2 else: raise NotImplementedError @@ -862,9 +861,10 @@ class SymmetricLinearGame: # 45-45-90 triangle and the shortest distance to the # outside of the cone should be 1/sqrt(2) of that. # It works in R^2, so it works everywhere, right? + # We use "2" because it's better numerically than sqrt(2). height = self.e2()[0] radius = norm(self.e2()[1:]) - dist = (height - radius) / sqrt(2) + dist = (height - radius) / 2 else: raise NotImplementedError