Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

sorting of products based on requirement

1 Ansicht (letzte 30 Tage)
sampath kumar punna
sampath kumar punna am 10 Okt. 2019
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
i have two set of objectives
actvites resources duration
mode 1 mode 2 mode 1 mode 2
A 5 4 10 6
B 7 3 7 9
C 3 7 5 11
D 8 8 4 7
E 9 6 9 4
if we choose a set randomly A from mode1, B from mode 2, C & D from mode 1 and E from mode 2.
total resources = 5*10+3*9+3*5+8*4+6*4 = 148,
like wise we have to choose a set R where total resource utilization from two modes in decendeing order
set D ( decereasing order of duaration)
how to write program for this in matlab
  2 Kommentare
Walter Roberson
Walter Roberson am 10 Okt. 2019
"like wise we have to choose a set R where total resource utilization from two modes in decendeing order "
Sorry, I do not seem to understand what you are asking there?
It is easy to come up with an algorithm that would find the minimum possibility. If there are no constraints then each row can be considered independently.
sampath kumar punna
sampath kumar punna am 10 Okt. 2019
i have to form a set of activites A-E, where i can choose any mode for each activty,
for suppose i have choosed a set as
A mode 1
B mode 2
C mode 1
D mode 2
E mode 2
average distribution = 5*10+3*9+3*5+8*7+6*4 = 172/35 = 4.91.
if i want to choose a set where it utilises less resources
A mode 2 4 6
B mode 2 3 9
C mode 1 3 5
D mode 2 or 1 8 4
E mode 2 6 4
average distribution of resources in each day = 4*6+3*9+3*5+8*4+6*4 = 122/28 = 4.35.
if i want to choose a set with least duration
A mode 2 4 6
B mode 1 7 7
C mode 1 3 5
D mode 1 8 4
E mode 2 6 4
average distribution of resources in each day = 4*6+ 7*7+ 3*5+ 8*4+ 6*4 = 144/26 = 5.53.
like the same way i need a set R( where the total resources utilized is arranged in decending order )
like the same way i need a set D( where the total duration utilized is arranged in decending order )

Antworten (1)

Ganesh Regoti
Ganesh Regoti am 5 Nov. 2019
Hi,
I presume that you need to pick the activities in descending order of duration and resources (first being the highest)
Here is the code which may help you
activity = 'ABCDE'; %The order of activities given
%Matrax of form NX4 where each column represents as follows:
%Resources,Duration,Mode,Activity Index
Activities = [5 10 1 1;
4 6 2 1;
7 7 1 2
3 9 2 2
3 5 1 3
7 11 2 3
8 4 1 4
8 7 2 4
9 9 1 5
6 4 2 5];
%Sorting based on Duration
[~,inx]=sort(Activities(:,2)); % Change the column number to 1 to get the values in sorted order of resources
out = Activities(inx,:);
num = 0;
den = 0;
str = '';
modes = [];
for i = 10:-1:1 %As we need descending, we need to start from end
if ~contains(str,activity(Activities(i,4)))
num = num + Activities(i,1)*Activities(i,2); % Sum of distribution
den = den + Activities(i,2);% Sum of duration
str = [str activity(Activities(i,4))]; % Final order of activities
modes = [modes, Activities(i,4)]; % Final order modes to respective activities
end
end
average = num/den; % This is average on descending order of duration

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by