Skip to content

Commit

Permalink
Tests for Bankruptcy CEA #3
Browse files Browse the repository at this point in the history
  • Loading branch information
alifa98 committed Jul 9, 2022
1 parent b90841f commit 7dda527
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion gamekit/algorithms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


from gamekit.algorithms import *
from gamekit.algorithms.bankruptcy import *


4 changes: 2 additions & 2 deletions gamekit/algorithms/bankruptcy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def constrained_equal_awards(claims: list, asset: float) -> tuple[list, float]:
asset (float): total amount of our assets (non-negative)
Returns:
list: list of allocations
r: the r value in the $a_i = min(r, c_i) $ (if sum of claims become less than asset, then the r-value would be the asset itself.)
r: the r value in the $a_i = min(r, c_i) $ (if sum of claims become less than asset, then the r-value would be the largest claim value.)
"""

# checks
Expand All @@ -30,7 +30,7 @@ def constrained_equal_awards(claims: list, asset: float) -> tuple[list, float]:
raise NegativeNumberException("Asset cannot be a negative number.")

if sum(claims) <= asset:
return claims, asset
return claims, max(claims)
else:

equal_alloc = asset/len(claims)
Expand Down
2 changes: 0 additions & 2 deletions gamekit/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ class NegativeNumberException(Exception):
def __init__(self, message) -> None:
self.message = message

def __init__(self) -> None:
pass

0 comments on commit 7dda527

Please sign in to comment.