Generating data for a scheduling problem that deals with setup families.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clc
%clear all
x1 = 1:30;
x11 = 1:10;
x2 = 0.2:0.2:1;
x12 = 0.2:0.2:4;
%a = 6:100;%b = 125:25:1000;%c = 1050:50:2500;%cc = 3000:500:10000;%cc1 = 15000:5000:30000;%xx = [a b c cc cc1];%[A, B] = size(xx);%mx = max(xx);
n=input('n=');
data = cell(n, 10, 3);
%families = 1:6;
familiesNumber = [2, 4, 6];
familiesSetup = 1:6;
for F = 1:3
% for j = 1:B
% n = xx(j);
% for ex = 1:10
releaseDate = randsrc(1, n, x1);
processingTime = randsrc(1, n, x11);
tf = randsrc(1, 1, x12);
ddr = randsrc(1, 1, x2);
g = sum(releaseDate);
min_due = tf * (1 - g - ddr / 2);
max_due = tf * (1 - g + ddr / 2);
if min_due < 1, min_due = 1; end % Ensure minimum due date is at least 1
if max_due < min_due, max_due = min_due + 1; end % Ensure range is valid
x = min_due:max_due;%linspace(min_due, max_due, n); % Create a range with n points
dueDate = randsrc(1, n, x); % Generate dueDate within the range
% Ensure dueDate is valid
for i = 1:n
if dueDate(i) < processingTime(i)
dueDate(i) = processingTime(i) + 1;
end
end
f = familiesNumber(F); disp(f);
m = mod(n, f);
nn = n - m;
setupTime = zeros(1, f);
for s = 1:f
setupTime = familiesSetup;
end
disp(setupTime);
nf = zeros(1, f);
if m == 0
for i = 1:f
nf(i) = n / f;
end
else
for i = 1:m
nf(i) = (nn / f) + 1;
end
for ii = m+1:f
nf(ii) = (nn / f);
end
end
disp(nf);
da = [releaseDate; processingTime; dueDate]; %disp(da);
data{n, ex, f} = da;
% end
% end
end
savefile = 'a_data.mat';
save(savefile, 'data');
3 commentaires
Walter Roberson
le 6 Juil 2024
I need the right generating data code
That sounds more like an algorithm question than a question about MATLAB ?
Réponses (0)
Voir également
Catégories
En savoir plus sur Live Scripts and Functions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!