i am trying to built a time table generator using python and my algorithm is not able to produce a solution with 0 conflicts.
I ends up giving me genome with 1 or 2 conflicts doesn't matter for how many generation i run it for?
i think the issue is with the mutation function can anybody tell me how can i write smart mutation function.
My mutation function looks like this
def multi_point_crossover(a,b):
if len(a) != len(b):
raise ValueError("Genomes a and b are must be of same Lenght")
lenght = len(a)
aaa,bbb = a[:],b[:]
p = randint(1,lenght - 1)
rday = randint(1,lenght-1)
ip = randint(1,len(a[0]))
aaa[rday],bbb[rday] = a[rday][:ip] +b[rday][ip:],b[rday][:ip] +a[rday][ip:]
return aaa[:p]+bbb[p:],bbb[:p]+aaa[p:]
and remember my genome is a 2d list [[day1],[day2],[day3],[day4],[day5]]. and each day looks like this
[1,4,2,None,3,3,None] and then i can map it to the time slots according to the index and i can also get lecture according to the index value.
question from:
https://stackoverflow.com/questions/65920143/genetic-algorithm-is-not-working-properly 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…