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 CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by