sebashc3712 / genetic_algorithm_for_scheduling_problem

An implementation of genetic algorithm for solving the scheduling problem in flexible job shop
MIT License
22 stars 7 forks source link

Genetic #1

Open dinhngocbao1991 opened 3 years ago

dinhngocbao1991 commented 3 years ago

Hi, i try to run it but when I use 18 machines, it can't run

sebashc3712 commented 3 years ago

Hi, @dinhngocbao1991

Do you get any error or is it taking too long??

dinhngocbao1991 commented 3 years ago

I'm using your program to solve my problem including 15 machine, 23 job from 1 to 8 progress but I couldn't find direct solution. Could you help me solving my problem by your genetic algorithm.

sebashc3712 commented 3 years ago

Could you send your code please??

dinhngocbao1991 commented 3 years ago

T = 23 # number of jobs ni =[6, 8, 5, 3, 5, 5, 7, 3, 8, 7, 5, 5, 6, 8, 6, 3, 4, 4, 3, 6, 2, 5, 3] # number of operations of the job i ma = 15 Mij =[[1,3], [3,5], [1,2,4,5], [2,3,4,5], [4], [4], [4,7,9], [5,6,8], [5,7,9], [6], [4,8], [4,7], [5,8], [4,5,8], [5,7,9,10], [5,6,8,9,10], [6,7,8,9], [8,10], [5,7,11], [15], [2,3,4], [4,5], [14], [15], [11,13], [14], [10], [13,15], [14], [15], [13,14,15], [9], [7,9], [10], [7,9], [13,14,15], [10], [11,12], [3], [14,15], [12,13], [14], [3,5,7], [1,6,8], [2,4,6,7,9], [5,8], [2,5,7,8], [1,4,6,7,9], [2,5,8], [1,3,6,8], [11,14], [9,12], [11,13,14], [9,10,12], [13,14], [9,12], [9,11,13], [10,12,15], [9,10,13], [11,12], [9,11], [10,13,15], [4,5,8], [5,7,15], [4,5], [12,15], [5,7,9], [8,11,14], [9], [8], [10,12,13], [12,14], [9,11], [6,9,11], [5,6,9,11,13], [11,13], [4,8,11,12,13], [6,10,14], [7], [5,9,10,11], [7,14], [14], [5,6], [14,15], [10], [14,15], [11], [2,4,7], [9,10], [2,6], [4,6,7,8], [4,6,8], [3,5,7,8], [3,7,8], [3], [6,7,9,12], [8,9], [6,7,12,15], [13,15], [4,6,13], [5,7,8,10,14], [9,11,12,15], [1,3,14], [12], [5,6], [8,9], [4], [12,15], [3,4], [5,9,11], [15], [9], [4,6,10,12], [4,7,9,14], [6,8,9], [14,15], [6,8,9]] pjk = [[17,1000,13,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,17,1000,10,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [17,17,1000,18,16,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,17,9,17,0,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,13,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,13,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,13,1000,1000,11,1000,12,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,9,10,1000,19,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,14,1000,20,1000,15,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,16,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,17,1000,1000,1000,16,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,12,1000,1000,10,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,11,1000,1000,10,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,9,13,1000,1000,12,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,10,1000,13,1000,12,10,1000,1000,1000,1000,1000], [1000,1000,1000,1000,13,12,1000,10,17,13,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,12,13,17,13,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,10,1000,14,1000,1000,1000,1000,1000], [1000,1000,1000,1000,10,1000,17,1000,1000,1000,9,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,14], [1000,7,14,10,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,12,10,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,11,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,13], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,11,1000,13,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,16,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,10,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,11,1000,9], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,17,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,11], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,12,15,10], [1000,1000,1000,1000,1000,1000,1000,1000,13,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,15,1000,17,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,16,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,12,1000,10,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,10,17,13], [1000,1000,1000,1000,1000,1000,1000,1000,1000,17,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,13,17,1000,1000,1000], [1000,1000,17,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,8,10], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,15,19,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,10,1000], [1000,1000,18,1000,13,1000,12,1000,1000,1000,1000,1000,1000,1000,1000], [11,1000,1000,1000,1000,11,1000,11,1000,1000,1000,1000,1000,1000,1000], [1000,11,1000,11,1000,17,13,1000,17,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,10,1000,1000,17,1000,1000,1000,1000,1000,1000,1000], [1000,10,1000,1000,14,1000,10,16,1000,1000,1000,1000,1000,1000,1000], [13,1000,1000,17,1000,12,20,1000,18,1000,1000,1000,1000,1000,1000], [1000,17,1000,1000,12,1000,1000,20,1000,1000,1000,1000,1000,1000,1000], [11,1000,13,1000,1000,15,1000,16,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,18,1000,1000,13,1000], [1000,1000,1000,1000,1000,1000,1000,1000,13,1000,1000,12,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,12,1000,10,17,1000], [1000,1000,1000,1000,1000,1000,1000,1000,10,17,1000,20,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,17,13,1000], [1000,1000,1000,1000,1000,1000,1000,1000,17,1000,1000,12,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,7,1000,16,1000,20,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,18,1000,13,1000,1000,12], [1000,1000,1000,1000,1000,1000,1000,1000,13,12,1000,1000,10,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,12,14,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,10,1000,17,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,15,1000,1000,10,1000,9], [1000,1000,1000,15,11,1000,1000,9,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,12,1000,20,1000,1000,1000,1000,1000,1000,1000,16], [1000,1000,1000,12,16,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,15,1000,1000,11], [1000,1000,1000,1000,16,1000,19,1000,12,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,12,1000,1000,14,1000,1000,15,1000], [1000,1000,1000,1000,1000,1000,1000,1000,13,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,12,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,14,1000,16,15,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,14,1000,15,1000], [1000,1000,1000,1000,1000,1000,1000,1000,13,1000,10,1000,1000,1000,1000], [1000,1000,1000,1000,1000,17,1000,1000,11,1000,16,1000,1000,1000,1000], [1000,1000,1000,1000,13,12,1000,1000,10,1000,17,1000,13,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,12,1000,10,1000,1000], [1000,1000,1000,10,1000,1000,1000,17,1000,1000,13,17,12,1000,1000], [1000,1000,1000,1000,1000,17,1000,1000,1000,13,1000,1000,1000,17,1000], [1000,1000,1000,1000,1000,1000,10,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,17,1000,1000,1000,12,20,18,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,12,1000,1000,1000,1000,1000,1000,20,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,10,1000], [1000,1000,1000,1000,17,16,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,12,10], [1000,1000,1000,1000,1000,1000,1000,1000,1000,10,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,17,13], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,13,1000,1000,1000,1000], [1000,12,1000,18,1000,1000,10,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,13,12,1000,1000,1000,1000,1000], [1000,12,1000,1000,1000,10,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,18,1000,13,12,10,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,9,1000,17,1000,11,1000,1000,1000,1000,1000,1000,1000], [1000,1000,12,1000,10,1000,17,13,1000,1000,1000,1000,1000,1000,1000], [1000,1000,10,1000,1000,1000,17,13,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,14,16,1000,15,1000,14,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,20,18,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,10,17,1000,1000,1000,13,1000,1000,1000,17], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,12,1000,16], [1000,1000,1000,12,1000,11,1000,1000,1000,1000,1000,1000,9,1000,1000], [1000,1000,1000,1000,12,1000,11,11,1000,15,1000,1000,1000,15,1000], [1000,1000,1000,1000,1000,1000,1000,1000,18,1000,13,12,10,1000,1000], [19,1000,13,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,14,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,12,1000,1000,1000], [1000,1000,1000,1000,16,12,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,16,16,1000,1000,1000,1000,1000,1000], [1000,1000,1000,12,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,14,1000,1000,1000], [1000,1000,12,20,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,12,1000,1000,1000,16,1000,13,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,10], [1000,1000,1000,1000,1000,1000,1000,1000,17,1000,1000,1000,1000,1000,1000], [1000,1000,1000,14,1000,9,1000,1000,1000,10,1000,14,1000,1000,1000], [1000,1000,1000,17,1000,1000,14,1000,10,1000,1000,1000,1000,14,1000], [1000,1000,1000,1000,1000,13,1000,12,10,1000,1000,1000,1000,1000,1000], [1000,1000,1000,1000,1000,1000,1000,1000,13,1000,1000,1000,1000,13,16], [1000,1000,1000,1000,1000,12,1000,10,13,1000,1000,1000,1000,1000,1000]]

dinhngocbao1991 commented 3 years ago

I ran as your guide, just expand it. However, i couldn't find a appropriate solution.

dinhngocbao1991 commented 3 years ago

Please help me as much as you can

sebashc3712 commented 3 years ago

Are you getting an infeasible solution as final solution??

dinhngocbao1991 commented 3 years ago

Yes, it is not right with scheduling problem

sebashc3712 commented 3 years ago

How many generations do you have?? You could try putting more generations. Your problem is very big and the 500 generations by default maybe is too low. Remember that this algorithm improve with each new generation. It's an intelligent search-algorithm

dinhngocbao1991 commented 3 years ago

I just use 500. As far as you know, how many I should with my problem?

sebashc3712 commented 3 years ago

I don't know you real problem but trying to solve scheduling problem for 15 machines is pretty big. I have only read that in academic researches.

What you can do is to group machines or operations in order to obtain an smaller number in these two variables. It's like you're implementing work-cells in real life. With less machines and operations you are making the problem easier to solve.

If you can't do that, try with AT LEAST 2000 generations. But I would recommend to model the problem better first

dinhngocbao1991 commented 3 years ago

I see your code so pretty smart and i wanna use it your logic in my problem. As you mentioned, your code is not problem. However, i have to rise numbers generation more so that find suitable solutions. It will take time for computer run.

dinhngocbao1991 commented 3 years ago

I have try but i couldn't find a suitable solution