Generating data for a scheduling problem that deals with setup families.
조회 수: 3 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2024년 7월 6일
I need the right generating data code
That sounds more like an algorithm question than a question about MATLAB ?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Live Scripts and Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!