MHOD: run only if in state n

This commit is contained in:
Anton Beloglazov 2012-12-27 11:23:39 +11:00
parent 094b2aad1e
commit 6f51d51cce
2 changed files with 3 additions and 3 deletions

View File

@ -196,8 +196,8 @@ def mhod(state_config, otf, window_sizes, bruteforce_step, learning_steps,
log.debug('MHOD p[current_state]:' + str(p[current_state]))
if utilization_length >= learning_steps:
# if current_state == state_n and p[state_n][state_n] > 0:
if p[current_state][state_n] > 0:
if current_state == state_n and p[state_n][state_n] > 0:
# if p[current_state][state_n] > 0:
policy = bruteforce.optimize(
bruteforce_step, 1.0, otf, (migration_time / time_step), ls, p,
state_vector, state['time_in_states'], state['time_in_state_n'])

View File

@ -142,7 +142,7 @@ class Core(TestCase):
expect(c).get_current_state.and_return(0).once()
decision, _ = c.mhod(state_config, otf, window_sizes, bruteforce_step,
learning_steps, time_step, migration_time, utilization, state)
self.assertTrue(decision)
self.assertFalse(decision)
with MockTransaction:
state['previous_utilization'] = []