Skip to content

Commit

Permalink
#5 better test
Browse files Browse the repository at this point in the history
  • Loading branch information
ingambe committed Mar 1, 2021
1 parent 518125c commit db67e53
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/flexible/test_fexible_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ def test_random(self):
env = gym.make('JSSEnv:flexible-jss-v1', env_config={'instance_path': '../../JSSEnv/envs/instances/flexible/mt10c1.fjs'})

average = 0
for _ in range(1):
for _ in range(100):
state = env.reset()
self.assertEqual(env.current_time_step, 0)
self.assertNotEqual(env.todo_time_step_job.all(), env.nb_op_job.all())
self.assertEqual(env.todo_time_step_job.all(), 0)
done = False
while not done:
legal_actions = env.get_legal_actions()
first_legal_action = np.where(legal_actions)[0][0]
#print(first_legal_action)
state, reward, done, _ = env.step(first_legal_action)
actions = np.random.choice(len(legal_actions), 1, p=(legal_actions / legal_actions.sum()))[0]
state, reward, done, _ = env.step(actions)
print(env.current_time_step)
self.assertEqual(env.todo_time_step_job.all(), env.nb_op_job.all())
'''
average = 0
for _ in range(100):
Expand Down

0 comments on commit db67e53

Please sign in to comment.