Largest Candidate Rule
1 view (last 30 days)
Show older comments
I have to write a program for assembly line balancing utilizing the Largest Candidate rule. Basically that is taking a series of elements with an associated time, then reordering the elements in descending order by time, ie the longest time first. Then I must group the elements into work stations by observing other constraints. Any suggestions. I am still pretty new to Matlab so my knowledge is still pretty basic.
I am having a hard time visualizing how to group the elements into work stations. There is a time cycle which the sum of the time of the grouped elements cannot exceed. There are also precedence factors which dictate which station certain elements can be in. I just cannot figure out how to account for all of it. It seems to me there would be an overwhelming amount of "if" statements in this code.
0 Comments
Accepted Answer
UJJWAL
on 27 Sep 2011
Hi Jason,
Ok. I am assuming some things. I assume that you are a very basic and new user of MATLAB. So The code which I am giving is an extremely basic code just to give you a feel of the steps. There can be more optimized and complicated and slick codes but I have made this basic code for you for your understanding.
a(:,1) = randi(1000,[1,100]); % Suppose it denotes the time taken
a(:,2) = randi(5000,[1,100]); % Suppose it denotes constraint A
a(:,3)= randi(20000,[1,100]); % Suppose it denotes constraint B
[p,q] = sort(a(:,1),'descend'); % Please look the syntax up in the help file
a(:,[1:end]) = a(q,[1:end]); % What I have done is that I have just arranged the observations in the order of their decreasing time
work1 = []; % Suppose I have 3 workstations and I have declared three vectors to store the elements to work on them
work2=[];
work3=[];
for i = 1: size(a,1)
if a(i,2)+a(i,3)>2000; % IF the sum of constraints A and B is more than 2000 then work at workstation 1
work1= horzcat(work1,a(i,1));
else
if a(i,2)+a(i,3)<2000 && a(i,2)+a(i,3)>1000 % Similarly the two conditions
work2 = horzcat(work2,a(i,1));
else
work3=horzcat(work3,a(i,1));
end
end
end
Of Course the number of if statements involved would be large depending upon the constraints and their inter-relationships. In Pattern Recognition also we work on large number of constraints and in many cases it is impossible to escape the if-else statements. Dont be afraid of them. In some cases you may reduce the number of if-else statements but it takes luck and conditions. I hope this code would give you an idea of the problem. I hope I have captured ur problem and given u an apt reply. If you need more help, mail back
Happy to Help
UJJWAL
3 Comments
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!