Nc=size(Dc,2) ;
DEc(:,:,1)=[0 1 2
1 0 1
2 1 0] ;
DEc(:,:,2)=[0 1 2
1 0 1
2 1 0] ;
DEc(:,:,3)=[0 1 2
1 0 1
2 1 0] ;
DEc(:,:,4)=[0 1 2
1 0 1
2 1 0] ;
Problem.P=ProccesingTime ;
Problem.Np=Np;
Problem.S=SequenceOfMachine ;
Problem.Nm=Nmachine ;
Problem.Lm=Lm;
Problem.Um=Um;
Problem.Ta=Ta;
Problem.Te=Te;
Problem.Dc=Dc;
Problem.Nc=Nc ;
Problem.DEc=DEc;
end
GA :
clc;
clear;
%% problem definition
Problem=CMS();
CostFunction=@(q) costNew(q,Problem);
%% GA parameters
Maxgen=50;
npop=20; %20;
pc=0.8;
nc=2*round(pc*npop/2);
pm=0.4; %0.3;
nm=round(pm*npop);
TourSize=4;
%% Initialization
empty_individual.position=[];
empty_individual.cost=[];
empty_individual.sol=[];
pop=repmat(empty_individual,npop,1);
for i=1:npop
pop(i).position=RandomSolution(Problem);
[pop(i).cost,pop(i).sol]=CostFunction(pop(i).position);
end
%sort population
costs=[pop.cost];
[sortcosts,sortorder]=sort(costs);
pop=pop(sortorder);
%store best solution
bestsol=pop(1);
% array to hold best cost values
Bestcost=zeros(Maxgen,1);
%% Main Loop
for gen=1:Maxgen
%crossover
popc=repmat(empty_individual,nc/2,2);
for k=1:nc/2
i1=TournamentSelection(pop,TourSize);
i2=TournamentSelection(pop,TourSize);
%Select Parents
p1=pop(i1);
p2=pop(i2);
% apply crossover
[popc(k,1).position,popc(k,2).position]=Crossover(p1.position,p2.position,Problem);
% Evaluate offsprings
[popc(k,1).cost,popc(k,1).sol]=CostFunction(popc(k,1).position);
[popc(k,2).cost,popc(k,2).sol]=CostFunction(popc(k,2).position);
end
popc=popc(:);
% Mutation
popm=repmat(empty_individual,nm,1);
for k=1:nm
%select parent
i=randi([1 npop]);
p=pop(i);
%apply mutate
popm(k).position=Mutate(p.position,Problem);
% Evaluate offspring
[popm(k).cost,popm(k).sol]=CostFunction(popm(k).position);
end
% merg
pop=[pop
popc
popm];
%sort
costs=[pop.cost];
[sortcosts,sortorder]=sort(costs);
pop=pop(sortorder);
%truncate
pop=pop(1:npop);
% Store Best Solution Ever Found
bestsol=pop(1);
% Store Best Cost Ever Found
Bestcost(gen)=bestsol.cost;
% Show Iteration Information
disp([‘Generation (‘ num2str(gen) ‘) Best Cost = ‘ num2str(Bestcost(gen))]);
end
%% Results
figure;
plot(Bestcost,’LineWidth’,2);
xlabel(‘Generation’);
ylabel(‘cost’);
Crossover :
function [y1,y2]=Crossover(x1,x2,Problem)
nVar=length(x1);
c=randi([1 nVar-1]);
Nm=Problem.Nm;
if c==Nm
y1=[x1(:,1:c) x2(:,c+1:end)];
y2=[x2(:,1:c) x1(:,c+1:end)];
else
p1=x1(1,:);
p2=x2(1,:);
y1(1,:)=[p1(1:c) p2(c+1:end)];
y2(1,:)=[p2(1:c) p1(c+1:end)];
if cNm
q1=x1(2,1:Nm);
q2=x2(2,1:Nm);
x11=q1(1:c);
x12=q1(c+1:end);
x21=q2(1:c);
x22=q2(c+1:end);
r1=intersect(x11,x22);
r2=intersect(x21,x12);
x11(ismember(x11,r1))=r2;
x21(ismember(x21,r2))=r1;
y1(2,:)=[x11 x22 x1(2,Nm+1:end)];
y2(2,:)=[x21 x12 x2(2,Nm+1:end)];
else
c=c-Nm;
q1=x1(2,Nm+1:end);
q2=x2(2,Nm+1:end);
x11=q1(1:c);
x12=q1(c+1:end);
x21=q2(1:c);
x22=q2(c+1:end);
r1=intersect(x11,x22);
r2=intersect(x21,x12);
x11(ismember(x11,r1))=r2;
x21(ismember(x21,r2))=r1;
y1(2,:)=[x1(2,1:Nm) x11 x22 ];
y2(2,:)=[x2(2,1:Nm) x21 x12 ];
end
end
end
Mutation :
function y=Mutate(x,Problem)
Nm=Problem.Nm;
p1=x(1,1:Nm);
p2=x(1,Nm+1:end);
p3=x(2,1:Nm);
p4=x(2,Nm+1:end);
nvar1=numel(p1);
j1=randi([1 nvar1]);
i1=randi([1 nvar1]);
p11=p1;
p11(j1)=p1(i1);
p11(i1)=p1(j1);
nvar2=numel(p2);
j2=randi([1 nvar2]);
i2=randi([1 nvar2]);
p22=p2;
p22(j2)=p2(i2);
p22(i2)=p2(j2);
nvar3=numel(p3);
j3=randi([1 nvar3]);
i3=randi([1 nvar3]);
p33=p3;
p33(j3)=p3(i3);
p33(i3)=p3(j3);
nvar4=numel(p4);
j4=randi([1 nvar4]);
i4=randi([1 nvar4]);
p44=p4;
p44(j4)=p4(i4);
p44(i4)=p4(j4);
y(1,:)=[p11 p22];
y(2,:)=[p33 p44];
end
Random solution :
function q=RandomSolution(Problem)
Np=Problem.Np;
Nm=Problem.Nm;
Nc=Problem.Nc;
q=zeros(2,Np+Nm);
q(1,1:Nm)=randi([1 Nc],[1,Nm]);
q(1,Nm+1:end)=randi([1 Nc],[1,Np]);
q(2,1:Nm)=randperm(Nm);
q(2,Nm+1:end)=randperm(Np);
end
Tournament Selection :
function i=TournamentSelection(pop,m)
nPop=numel(pop);
S=randsample(nPop,m);
spop=pop(S);
scosts=[spop.cost];
[~, j]=min(scosts);
i=S(j);
end
منابع و مراجع
Wu X, Chu CH, Wang Y, Yue D.Genetic algorithms for integrating cell formation with machine layout and scheduling. Comput Ind Eng 53:277–289.(2007)
Arkat J, Hosseinabadi M, Hosseini L.Integrating cell formation with cellular layout and operations scheduling. Manufact Technol , 61:637-647.(2012)
Heragu, S. S., & Kusiak, A.Machine layout problem in flexible manufacturing systems. Operations Research, 36, 258–268.(1988)
Chin-Chih Chang, Tai-Hsi Wu, Chien-Wei Wu.An efficient approach to determine cell formation, cell layout and intracellular machine sequence in cellular manufacturing systems. Computers & Industrial Engineering 66 438–450.(2013)
Burbide, J.L., The Introduction Of Group Technology. Heinemann, London, U-K, (1975).
Ben-Arieh, David. Analysis of a distributed group technology methodology. Computers and Industrial Engeneering, Vol 35 PP. 69-72, (1998)
Frazier. Greogory V, Spriggs. Mark T. Achieving competitive advantage through group technology, Business Horizons, Vol 39, P83, May/July (1996).
Jensen, John B., Malhotra, Manojk, Philipoom, Patrick R. Machine dedication and process flexibility in a group technology environment. Journal Of Operation Management, Vol 14, PP 19-39, (1995).
Black, J. The Design of the Factory with a Future. McGraw-Hill, Inc, New York, 1991.
Askin, R. and Standridge, C. Modeling and Analysis of Manufacturing Systems. John Wiley & Sons, New York, (1993).
Selim, H., Askin, R. and Vakharia, A. Cell Formation in Group Technology: Review, Evaluation and Directions for Future Research. Computers and Industrial Engineering, 34(1):3-20, (1998).
Groover, M. Automation, Production Systems, and Computer Integrated Manufacturing. Prentice Hall, Englewood, NJ, (1987).
Wemmerlov, U. and John, D. Cellular Manufacturing at 46 User Plants: Implementation experiences and Performance Improvements. International Journal of Production Research, 35(1):29-49, (1997).
Stalk, N. and Hout, T. Competing Against Time. Free Press, New York, (1990).
Fry, T., Breen, M. and Wilson, M. A Successful Implementation of Group Technology and Cell Manufacturing. Production and Inventory Management Journal, 28(3):4-6,(1987).
Choi, M. Manufacturing Cell Design. Production and Inventory Management Journal, 33(2):66-69, (1992).
Askin, R. and Standridge, C. Modeling and Analysis of Manufacturing Systems. John Wiley & Sons, New York, (1993).
Burbidge, J. and Dale, B. Planning the Introduction and Predicting the Benefits of Group Technology. Engineering Costs and Production Economics, 8, 117-128, (1984).
Collet, S. and Spicer, R. Improving Productivity through Cellular Manufacturing. Production and Inventory Management Journal, 36(1):71-75, (1995)
Collet, S. and Spicer, R. Improving Productivity through Cellular Manufacturing. Production and Inventory Management Journal, 36(1):71-75, (1995).
Hyer, N. L. and Wemmerlov, U., Group technology and productivity, Harvard business review, 62, No. 4., 140-149, (1984).
Hyer, N. The Potential of Group Technology for U.S. Manufacturing. Journal of Operations Management, 4(3):183-202, (1984).
Levasseur, G., Helms, M. and Zink, A. A Conversion from a Functional to a Cellular Manufacturing

مطلب مرتبط :   تحقیق رایگان دربارهقابلیت اطمینان، سنجش عملکرد، کوتاه مدت

Written by 

دیدگاهتان را بنویسید