# objective function in genetic algorithm to minimize movements

2 views (last 30 days)
summyia qamar on 7 Jan 2017
Commented: summyia qamar on 8 Jan 2017
how to define this function in matlab where t=number of parts, gamma =cost, g=number of groups,
o=operation of part, *Y(o,t,g)*= 1 if operation o of part t is processed in cell c
here is a set of data first a population is created representing the machines in group using code:
Operation_time={[10,0,0,10,0,20,15] [0,10,10,15,0,0,20]} %operation time of parts on machines
t=2
g=3
Types_Machines=7
Vmin=1;
Vmax=3;
nVar=Types_Machine
VarSize=[1 nVar]
%initial Population
for i=1:10
pop(i).Position=randi([Vmin,Vmax],VarSize);
end
now this population is to be evaluated on the above mentioned function to minimize the cost(gamma). basically the equation is showing a sum of all movements of parts between machine groups.. for example I define a pop(i).Position= [1 1 2 3 1 2 1] it is interpolated as machine (1,2,5,7) are placed in group 1, machine(3,6) are in group 2 and machine 4 in group 3..now to check this chromosome fitness, the criteria is set which is the minimum flow of parts between groups..parts data is given in operation_time cell array showing that part 1 uses machine (1,4,6,7) according to non zero entities of this array.now according to the pop(i).Position
• part 1 goes to machine 1 which is assigned group 1*,
• then it goes to machine 4 which is in group 3 so there is a movement of part from one group to the other group
• then again part goes to machine 6 which is assigned group 2 and part moves to another group and
• then next non zero value of Operation_time is at place 7 and chromosome value at 7 position is different from the previous therefore another movement is made.thus the value of Y(o,t,p) becomes 4..now how to make this into fitness function so that each chromosome is checked for minimum movements made
can anyone please guide me how to code this objective function?
##### 2 CommentsShowHide 1 older comment
summyia qamar on 8 Jan 2017