Somewhat sensible default parameters, temperature, amount of maximum anneal iterations and generator accept probability passed to anneal.
This commit is contained in:
parent
991b7f4175
commit
3a7a8ebcbd
2 changed files with 9 additions and 8 deletions
|
@ -4,15 +4,15 @@ from SchedulingAlgorithms.enumerate import enumerate as enum
|
|||
from math import e
|
||||
from random import random
|
||||
|
||||
def anneal(max_temp = 1000, max_steps = 1000):
|
||||
def anneal(max_temp = 300, max_steps = 250, accept_prob=0.01):
|
||||
global problem
|
||||
gen_init(problem)
|
||||
temp = max_temp
|
||||
initial = enum(problem)
|
||||
current = generate(initial, problem.machines * problem.jobs * 10)
|
||||
current = generate(initial, problem.machines * problem.jobs * 10, 0) #Complete the iteration once fully.
|
||||
del initial
|
||||
for step in range(0, max_steps):
|
||||
new = generate(current, problem.machines * problem.jobs)
|
||||
new = generate(current, problem.machines * problem.jobs, accept_prob)
|
||||
new_end = rate(new)
|
||||
curr_end = rate(current)
|
||||
p = 1 / ( 1 + (e ** ((curr_end - new_end)/temp)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue