MHOD: disabled handling skipped steps as a special case
This commit is contained in:
parent
283c4a9638
commit
094b2aad1e
@ -123,14 +123,14 @@ def mhod(state_config, otf, window_sizes, bruteforce_step, learning_steps,
|
||||
:rtype: tuple(bool, dict)
|
||||
"""
|
||||
utilization_length = len(utilization)
|
||||
if utilization_length == state['time_in_states'] and \
|
||||
utilization == state['previous_utilization']:
|
||||
# No new utilization values
|
||||
return False, state
|
||||
# if utilization_length == state['time_in_states'] and \
|
||||
# utilization == state['previous_utilization']:
|
||||
# # No new utilization values
|
||||
# return False, state
|
||||
|
||||
number_of_states = len(state_config) + 1
|
||||
previous_state = 0
|
||||
state['previous_utilization'] = utilization
|
||||
# state['previous_utilization'] = utilization
|
||||
state['request_windows'] = estimation.init_request_windows(
|
||||
number_of_states, max(window_sizes))
|
||||
state['estimate_windows'] = estimation.init_deque_structure(
|
||||
@ -175,17 +175,17 @@ def mhod(state_config, otf, window_sizes, bruteforce_step, learning_steps,
|
||||
state['previous_state'] = current_state
|
||||
|
||||
state_n = len(state_config)
|
||||
if utilization_length > state['time_in_states'] + 1:
|
||||
for s in utilization_to_states(
|
||||
state_config,
|
||||
utilization[-(utilization_length - state['time_in_states']):]):
|
||||
state['time_in_states'] += 1
|
||||
if s == state_n:
|
||||
state['time_in_state_n'] += 1
|
||||
else:
|
||||
state['time_in_states'] += 1
|
||||
if current_state == state_n:
|
||||
state['time_in_state_n'] += 1
|
||||
# if utilization_length > state['time_in_states'] + 1:
|
||||
# for s in utilization_to_states(
|
||||
# state_config,
|
||||
# utilization[-(utilization_length - state['time_in_states']):]):
|
||||
# state['time_in_states'] += 1
|
||||
# if s == state_n:
|
||||
# state['time_in_state_n'] += 1
|
||||
# else:
|
||||
state['time_in_states'] += 1
|
||||
if current_state == state_n:
|
||||
state['time_in_state_n'] += 1
|
||||
|
||||
if log.isEnabledFor(logging.DEBUG):
|
||||
log.debug('MHOD utilization:' + str(utilization))
|
||||
|
@ -152,14 +152,14 @@ class Core(TestCase):
|
||||
learning_steps, time_step, migration_time, utilization, state)
|
||||
self.assertTrue(decision)
|
||||
|
||||
with MockTransaction:
|
||||
utilization = [1.0, 1.0]
|
||||
state['previous_utilization'] = [1.0, 1.0]
|
||||
state['time_in_states'] = 2
|
||||
expect(estimation).select_best_estimates.never()
|
||||
decision, _ = c.mhod(state_config, otf, window_sizes, bruteforce_step,
|
||||
learning_steps, time_step, migration_time, utilization, state)
|
||||
self.assertFalse(decision)
|
||||
# with MockTransaction:
|
||||
# utilization = [1.0, 1.0]
|
||||
# state['previous_utilization'] = [1.0, 1.0]
|
||||
# state['time_in_states'] = 2
|
||||
# expect(estimation).select_best_estimates.never()
|
||||
# decision, _ = c.mhod(state_config, otf, window_sizes, bruteforce_step,
|
||||
# learning_steps, time_step, migration_time, utilization, state)
|
||||
# self.assertFalse(decision)
|
||||
|
||||
|
||||
def deque_maxlen(coll):
|
||||
|
Loading…
Reference in New Issue
Block a user