why my matlab codes do not give correct answer in genetic algorithm for solving facility problem

10 ビュー (過去 30 日間)
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 件のコメント
rana singh
rana singh 2019 年 4 月 23 日
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

サインインしてコメントする。

回答 (1 件)

rewayda mohsin
rewayda mohsin 2020 年 3 月 9 日
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

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by