why my matlab codes do not give correct answer in genetic algorithm for solving facility problem
8 views (last 30 days)
Show older comments
I study a bacholer thesis about a genetic algorithm for solving facility location problems . I have 4 facility and 20 customer. Products are sent from facility to customer. I have data set about this problem.Objective function is to minimized cost. I calculated optimal value in GAMS software with data set. I wrote a genetic algoritm code in matlab. Matlab result is not similar or close GAMS result. GAMS result is 40437 abou cost.in my opnion I am missing a thing. I attached my documentations and matematical model in here. Can you arrange this codes. Can you help me?

1 Comment
rana singh
on 23 Apr 2019
hello,
in your cities data, matrix size is 5*4, as far i know, 5 is the number of facility but i dont know what are 4 columns.
in supply data too, there are 4 columns for each facility.
can you explain?
thanks
Answers (1)
rewayda mohsin
on 9 Mar 2020
Dear burak karadem,
I read tried to run your code I found that you did not set your popsize, probcross, probmut, and iteration. So i set them like this as trail to get a result. but in every time i got the error down
popsize=10;
probcross=0.4;
probmut=0.2;
iteration=2;
Attempted to access sumfix(10,:); index out of bounds because size(sumfix)=[9,5].
Error in objectivecalc (line 44) cost1(i)=sum(sumfix(i,:));
Error in genetic (line 77) cost = objectivecalc( supply,cities, popsize, population,transcost,fixcost,dist,cusdemand);
you post your problem in 2017 and just read it. I wonder if you fixed your code. If so could you please tell me what is wrong and why i get this error.
Many thanks,
Rewayda Razaq
0 Comments
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!