def test_calculate_progress_factor(self):
   reward.g_last_progress_value = 20.0
   reward.g_last_progress_time = time.time() - 0.067 # 1 frame @ 15fps
   # For 20s lap, 20*15 frames = 300 frames => progress 100/300 = 0.33
   params = self.default_params()
   params['progress'] = 20.3
   progress = reward.calculate_progress_factor(params)
   # expect (21 - 20) / 0.067
   self.assertTrue(math.isclose(progress, 4.4771, abs_tol=1e-2))
 def test_calculate_progress_factor(self):
     self.assertEqual(reward.calculate_progress_factor({}), 1.0)
Example #3
0
 def test_calculate_progress_factor(self):
     params = self.default_params()
     self.assertEqual(reward.calculate_progress_factor(params), 1.0)
 def test_calculate_progress_factor(self):
     self.assertEqual(
         reward.calculate_progress_factor(self.default_params()), 0.0)