Skip to content

Commit

Permalink
It's called real time dynamic programming, I think.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkel committed Apr 29, 2024
1 parent 37a7543 commit f7dbf28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion mdp/monte_carlo_value_iteration.py → mdp/rtdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self):
self._honest = None # honest action id


class MCVI:
class RTDP:
def __init__(
self,
model: Model,
Expand Down
16 changes: 8 additions & 8 deletions mdp/mcvi_test.py → mdp/rtdp_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import aft20barzur
from monte_carlo_value_iteration import MCVI
from rtdp import RTDP
import pprint
import psutil
import sys
Expand All @@ -10,7 +10,7 @@
pp = pprint.PrettyPrinter(indent=2)


def mcvi(
def rtdp(
model,
*args,
horizon=100,
Expand All @@ -22,9 +22,9 @@ def mcvi(
**kwargs
):
if honest_warmup_steps > 0:
agent = MCVI(model, eps=0, eps_honest=1, horizon=horizon, **kwargs)
agent = RTDP(model, eps=0, eps_honest=1, horizon=horizon, **kwargs)
else:
agent = MCVI(model, eps=eps, eps_honest=eps_honest, horizon=horizon, **kwargs)
agent = RTDP(model, eps=eps, eps_honest=eps_honest, horizon=horizon, **kwargs)

max_start_value = 0

Expand Down Expand Up @@ -69,9 +69,9 @@ def mcvi(
pp.pprint(info)


def test_mcvi(*args, **kwargs):
def test_rtdp(*args, **kwargs):
model = aft20barzur.BitcoinSM(alpha=0.42, gamma=0.84, maximum_fork_length=10000)
mcvi(model, *args, **kwargs)
rtdp(model, *args, **kwargs)


if __name__ == "__main__":
Expand All @@ -81,7 +81,7 @@ def test_mcvi(*args, **kwargs):
model_a = SelfishMining(
Bitcoin(), **problem, maximum_size=10000, merge_isomorphic=False
)
mcvi(
rtdp(
model_a,
steps=10000000,
report_steps=1000,
Expand All @@ -92,7 +92,7 @@ def test_mcvi(*args, **kwargs):
)
else:
model_b = aft20barzur.BitcoinSM(**problem, maximum_fork_length=10000)
mcvi(
rtdp(
model_b,
steps=1000000,
report_steps=10000,
Expand Down

0 comments on commit f7dbf28

Please sign in to comment.