Skip to content

Commit

Permalink
add reversed time as seed if seed is none at first
Browse files Browse the repository at this point in the history
  • Loading branch information
Felixvillas committed Sep 25, 2022
1 parent 9677b43 commit eb2439a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from utils.sc_wrapper import single_net_sc2env
from smac.env import StarCraft2Env
from model import QMIX_agent
import time, datetime

def qmix_learning(
args=None
Expand All @@ -19,6 +20,9 @@ def qmix_learning(
'''
assert args.save_model_freq % args.target_update_freq == 0
last_test_t, num_test = -args.test_freq - 1, 0
if args.seed == None:
time.sleep(3)
args.seed = int(''.join(reversed(datetime.datetime.now().strftime("%m%d%H%M%S"))))
np.random.seed(args.seed)
torch.manual_seed(args.seed)
# Initialize Env
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get_args():
parser.add_argument('--learning-rate', type=float, default=5e-4)
parser.add_argument('--grad-norm-clip', type=float, default=10)
# seed
parser.add_argument('--seed', type=int, default=0)
parser.add_argument('--seed', type=int, default=None)
# ddqn
parser.add_argument('--is-ddqn', type=int, default=True)
# per
Expand Down

0 comments on commit eb2439a

Please sign in to comment.