Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

objective function - genetic algorithm - fitness

keeyarashkeeyarash Posts: 2Member
I'm going to optimal under function with algorithm genetic in matlab

tc =p.*u.*q*0.5 + A.*D./Q +yy.*b.*b*0.5/Q

I wrote a function for objective function.
my fun have three unknown and some known parameters.

how do I write function for matlab genetic tool objective function that gatools do optimal my fun.

function TC = TC_fitness(Q,b,q)

m=5; %number of item;
Q=zeros(1,m); %unknown ;
q=zeros(1,m); %unknown ;
b=zeros(1,m); %unknown ;
u=zeros(1,m); %variable ;
A=zeros(1,m); %variable ;
D=zeros(1,m); %variable ;

yy=zeros(1,m); %variable ;
p=zeros(1,m); %variable ;
tc=zeros(1,m); %cost per item ;
TC=zeros(1,1); %total cost ;
p=[0.3 0.3 0.3 0.3 0.3]; %variable ;
A=[3 4 5 3 3]; %value parameter;
D=[420 360 540 390 480]; %value parameter;

u=[13 30 23 6 13]; %value parameter;

tc =p.*u.*q*0.5 + A.*D./Q +yy.*b.*b*0.5/Q
TC= sum(tc);


thanks a lot
Sign In or Register to comment.