Fixed contracts for migration_time in time steps

This commit is contained in:
Anton Beloglazov 2012-10-25 15:37:47 +11:00
parent 5ddd59948e
commit 3f8ba60b04
3 changed files with 12 additions and 12 deletions

View File

@ -85,10 +85,10 @@ def optimize(step, limit, otf, migration_time, ls, p, state_vector,
:param state_vector: A state vector.
:type state_vector: list(int)
:param time_in_states: The total time in all the states so far.
:param time_in_states: The total time in all the states in time steps.
:type time_in_states: number,>=0
:param time_in_state_n: The total time in the state N so far.
:param time_in_state_n: The total time in the state N in time steps.
:type time_in_state_n: number,>=0
:return: The solution of the problem.

View File

@ -53,8 +53,8 @@ def build_constraint(otf, migration_time, ls, state_vector,
:param otf: The OTF parameter.
:type otf: float
:param migration_time: The VM migration time in seconds.
:type migration_time: int
:param migration_time: The VM migration time in time steps.
:type migration_time: float,>=0
:param ls: A list of L functions.
:type ls: list(function)
@ -65,11 +65,11 @@ def build_constraint(otf, migration_time, ls, state_vector,
:param p: A matrix of transition probabilities.
:type p: list(list(number))
:param time_in_states: The total time on all the states in seconds.
:type time_in_states: int
:param time_in_states: The total time in all the states in time steps.
:type time_in_states: number,>=0
:param time_in_state_n: The total time in the state N in seconds.
:type time_in_state_n: int
:param time_in_state_n: The total time in the state N in time steps.
:type time_in_state_n: number,>=0
:return: The created constraint.
:rtype: tuple(function, function, number)

View File

@ -46,7 +46,7 @@ class Nlp(TestCase):
def test_build_constraint(self):
with MockTransaction:
otf = 0.05
migration_time = 20
migration_time = 20.
state_vector = [1, 0]
p = [[-0.1, 0.1],
[0.3, -0.3]]
@ -54,9 +54,9 @@ class Nlp(TestCase):
m2 = mock('m2')
m = (m1, m2)
container = mock('function container')
when(container).l0(state_vector, p, m).and_return(2)#.once()
when(container).l1(state_vector, p, m). \
and_return(3)#.exactly(2).times()
expect(container).l0(state_vector, p, m).and_return(2).once()
expect(container).l1(state_vector, p, m). \
and_return(3).exactly(2).times()
ls = [container.l0, container.l1]
constraint = nlp.build_constraint(otf, migration_time,