Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
matlab code of job shop scheduling
#1

proctimes = [45 20 12 10 17 10 34 28]';

flow = [1 3 0;..
2 1 3;..
3 1 2];

final = [3;3;2];

bigM = sum(sum(proctimes));

disj1 = [1 1 2 4 6 6 7]';
disj2 = [2 3 3 5 7 8 8]';

arc1 = [1 4 2 8 3]';
arc2 = [6 2 7 3 5]';

tasks = 8;

start = tom('start',tasks,1);
y = tom('y',length(disj1),1,'int');
finish = tom('finish',1,1); %Scalar

% All slots are integers
bnds1 = {start >= 0, 0 <= finish <= bigM, 0 <= y <= 1};

% Task constraint
taskcon = {start(1:8) + proctimes(1:8) <= finish};

% Arc constraint
arccon = {};
for i=1:length(arc1)
arccon{i} = {start(arc1(i)) + proctimes(arc1(i)) <= start(arc2(i))};
end

% Disj constraint
disjcon = {};
for i=1:length(disj1)
disjcon{i} = ..
{start(disj1(i)) + proctimes(disj1(i)) <= ..
start(disj2(i)) + bigM*y(i)};
disjcon{i+length(disj1)} = ..
{start(disj2(i)) + proctimes(disj2(i)) <= ..
start(disj1(i)) + bigM*(1-y(i))};
end

constraints = {bnds1, taskcon, arccon, disjcon};
options = struct;
options.solver = 'cplex';
options.name = 'Job Shop Scheduling';
sol = ezsolve(finish,constraints,[],options);

PriLev = 1;
if PriLev > 0
c = 3; % number of colors
p = 3; % number of papers

disp(['all papers are finished after ' num2str(sol.finish) ' minutes'])
disp(' ')
for j = 1:p,
disp(['paper ' num2str(j) ':'])
if j==1
colortimes = sol.start(1:3);
elseif j == 2
colortimes = [0;sol.start(4:5)];
else
colortimes = sol.start(6:8);
end

[time,col] = sort(colortimes);
for i = 1:c,
this_col = col(i);
this_time = time(i);
if this_time == 0
disp([' starts using color ' num2str(this_col) ' after ' ..
num2str(this_time) ' minutes (or not at all)'])
else
disp([' starts using color ' num2str(this_col) ' after ' ..
num2str(this_time) ' minutes'])
end
end
end
end

% MODIFICATION LOG
%
% 060102 med Created
% 060111 per Added documentation
% 060126 per Moved disp to end
% 090308 med Converted to tomSym
Problem type appears to be: mip
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license 999001. Valid to 2010-02-05
=====================================================================================
Problem: -- 1: Job Shop Scheduling f_k 96.999999996000000000
sum( constr ) 0.000000000211653345
f(x_k) + sum( constr ) 96.999999996211656000
f(x_0) 0.000000000000000000

Solver: CPLEX. EXIT=0. INFORM=101.
CPLEX Branch-and-Cut MIP solver
Optimal integer solution found

FuncEv 8
all papers are finished after 97 minutes

paper 1:
starts using color 2 after 10 minutes
starts using color 3 after 30 minutes
starts using color 1 after 42 minutes
paper 2:
starts using color 1 after 0 minutes (or not at all)
starts using color 2 after 0 minutes (or not at all)
starts using color 3 after 42 minutes
paper 3:
starts using color 3 after 0 minutes (or not at all)
starts using color 2 after 30 minutes
starts using color 1 after 87 minutes
Reply

#2
Hi am dalel i would like to get details on matlab code of job shop scheduling ..My friend said matlab code of job shop scheduling will be available here and now i am living at Tunisia and i last studied in the college/school FSEGS and now am doing reasarch .i need help on matlab code of job shop scheduling specialy how compute makespan
Reply



[-]
Quick Reply

Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2024 iAndrew & Melroy van den Berg.