-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47c1be2
commit 45d276b
Showing
8 changed files
with
336 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% % This function evaluates the instances created and determine whether % % | ||
% % they are correct or not. For doing so, the function creates a copy % % | ||
% % of the instance and solves it with each heuristic from the % % | ||
% % HEURIDrepository then it follows the fitness function described in % % | ||
% % EvaluateUPSOtoJSSP_Advanced according to the objective given while % % | ||
% % calling the function. % % | ||
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% % The parameters of the function are described as follows: % % | ||
% % % % | ||
% % folder: It is the name in quotes of the folder where the % % | ||
% % instances are located. % % | ||
% % heurID: It is the ID of the heuristic used to improve or % % | ||
% % diminish 1.- LPT 2.- SPT 3.- MPA 4.- LPA % % | ||
% % objective : 1. XvsAll 2. AllvsX % % | ||
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % | ||
% % nbJobs : Number of Jobs of the instance to be checked; % % | ||
% % Set to 3 % % | ||
% % nbMachines: Number of Machines of the instance to be checked % % | ||
% % Set to 4 % % | ||
% % nbRep : Number of instances created for the parcticular % % | ||
% % configuration; set to 30 % % | ||
% % timeRanges: Range in which the operation times are set. % % | ||
% % Set to [0 10] % % | ||
% % % % | ||
% % to change this use varargin(1), varargin(2), varargin(3) and % % | ||
% % varargin(4) respectively. % % % % | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
|
||
function [performanceMatrix] = GeneralCheck_Advanced_noDelta(folder,heurID, objective, varargin) | ||
|
||
folder2 = pwd; | ||
|
||
nbJobs = 3; | ||
nbMachines = 4; | ||
nbRep = 30; | ||
timeRanges = [0 10]; | ||
|
||
if nargin == 4, nbJobs = varargin{1}; end | ||
if nargin == 5, nbMachines = varargin{2}; end | ||
if nargin == 6, nbRep = varargin{3}; end | ||
if nargin == 7, timeRanges = varargin{4}; end | ||
|
||
|
||
%Convert numeric heurID to a three letter heurID | ||
if heurID == 1 | ||
heuristicID = "LPT"; | ||
elseif heurID == 2 | ||
heuristicID = "SPT"; | ||
elseif heurID == 3 | ||
heuristicID = "MPA"; | ||
elseif heurID == 4 | ||
heuristicID = "LPA"; | ||
end | ||
|
||
if objective == 1 | ||
addressID = heuristicID + "vsAll_J" + num2str(nbJobs) + "xM" + num2str(nbMachines); | ||
elseif objective == 2 | ||
addressID = "Allvs" + heuristicID + "_J" + num2str(nbJobs) + "xM" + num2str(nbMachines); | ||
end | ||
|
||
|
||
for NB=1:nbRep; | ||
oldfolder= cd(folder2); | ||
PathAddress = char(folder+"\"+addressID+"\"); | ||
|
||
if objective == 1 | ||
address= char("JSSPInstanceJ"+num2str(nbJobs)+"M"+num2str(nbMachines)+"T1"+num2str(timeRanges(1)) ... | ||
+"T2"+num2str(timeRanges(2))+"Rep"+num2str(NB)+heuristicID+"vsAll.mat"); | ||
elseif objective == 2 | ||
address= char("JSSPInstanceJ"+num2str(nbJobs)+"M"+num2str(nbMachines)+"T1"+num2str(timeRanges(1)) ... | ||
+"T2"+num2str(timeRanges(2))+"Rep"+num2str(NB)+"Allvs"+heuristicID +".mat"); | ||
end | ||
% | ||
JSSPInstance = {}; | ||
% | ||
addpath(genpath(PathAddress)); | ||
load(address) | ||
|
||
|
||
|
||
perfDataMatrix(NB,1) = JSSPInstance{2}; | ||
|
||
|
||
end | ||
filename=(addressID) | ||
|
||
oldfolder= cd(folder2); | ||
save(filename, 'perfDataMatrix'); | ||
performanceMatrix = perfDataMatrix; | ||
end | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function[heurID2]=HeurIDVector(heurID) | ||
|
||
if heurID == 1 | ||
heurID2 = [2 3 4]; | ||
elseif heurID == 2 | ||
heurID2 = [1 3 4]; | ||
elseif heurID == 3 | ||
heurID2 = [1 2 4]; | ||
elseif heurID == 4 | ||
heurID2 = [1 2 3]; | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
x=ans(:,1) | ||
|
||
plot(x, "o") | ||
ylim =([0 100]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
HeurID1=[1 1 1 2 2 2 3 3 3 4 4 4]; | ||
HeurID2=[2 2 2 1 1 1 4 4 4 3 3 3]; | ||
Population= [10 30 50 10 30 50 10 30 50 10 30 50]; | ||
folder="HyperMatrix"; | ||
folder2 = pwd; | ||
for x=1:12 | ||
|
||
oldfolder=cd(folder2); | ||
HeuristicID1=heurIDrepository(HeurID1(x)); | ||
HeuristicID2=heurIDrepository(HeurID2(x)); | ||
|
||
address = char(HeuristicID1+"vs"+HeuristicID2+"_Small_pop"+num2str(Population(x))+".mat"); | ||
|
||
|
||
oldfolder=cd(folder); | ||
hypMatrix=importdata(address); | ||
hypMatrixCompressed=hypMatrix(:,:); | ||
hypMatrixInverted=sort(hypMatrixCompressed.*-1); | ||
hypMatrixInverted2=median(hypMatrixInverted); | ||
hypMatrixInverted3(x,:)=hypMatrixInverted2(1,:); | ||
|
||
end | ||
for y=1:12 | ||
vector=hypMatrixInverted3(y,:); | ||
hypMatrixInverted4(y,:)=tiedrank(vector); | ||
end | ||
|
||
hypMatrixInverted5(1,:)= tiedrank(cat(2,hypMatrixInverted3(1,:),hypMatrixInverted3(2,:),hypMatrixInverted3(3,:))); | ||
hypMatrixInverted5(2,:)= tiedrank(cat(2,hypMatrixInverted3(4,:),hypMatrixInverted3(5,:),hypMatrixInverted3(6,:))); | ||
hypMatrixInverted5(3,:)= tiedrank(cat(2,hypMatrixInverted3(7,:),hypMatrixInverted3(8,:),hypMatrixInverted3(9,:))); | ||
hypMatrixInverted5(4,:)= tiedrank(cat(2,hypMatrixInverted3(10,:),hypMatrixInverted3(11,:),hypMatrixInverted3(12,:))); | ||
|
||
counter=1; | ||
for x=1:9:19 | ||
hypMatrixInverted6(:,counter)=(hypMatrixInverted4(:,x)); | ||
hypMatrixInverted6(:,counter+1)=(hypMatrixInverted4(:,x+1)); | ||
hypMatrixInverted6(:,counter+2)=(hypMatrixInverted4(:,x+2)); | ||
counter=counter+3; | ||
end | ||
counter=10; | ||
for x=4:9:22 | ||
hypMatrixInverted6(:,counter)=(hypMatrixInverted4(:,x)); | ||
hypMatrixInverted6(:,counter+1)=(hypMatrixInverted4(:,x+1)); | ||
hypMatrixInverted6(:,counter+2)=(hypMatrixInverted4(:,x+2)); | ||
counter=counter+3; | ||
end | ||
counter=19; | ||
for x=7:9:25 | ||
hypMatrixInverted6(:,counter)=(hypMatrixInverted4(:,x)); | ||
hypMatrixInverted6(:,counter+1)=(hypMatrixInverted4(:,x+1)); | ||
hypMatrixInverted6(:,counter+2)=(hypMatrixInverted4(:,x+2)); | ||
counter=counter+3; | ||
end | ||
|
||
|
||
|
||
hypMatrixInverted5 = (hypMatrixInverted5 - 82)*-1; | ||
hypMatrixInverted6= (hypMatrixInverted6 - 28)*-1; | ||
hypMatrixInverted4= (hypMatrixInverted4 - 28)*-1; | ||
|
||
a=heatmap(hypMatrixInverted5); | ||
ylabel("Heuristics") | ||
xlabel("Configurations") | ||
|
||
cd(folder2) | ||
%CATEGORYNAMES = {"0.1" "0.5" "0.9" "0.1" "0.5" "0.9" "0.1" "0.5" "0.9" "0.1" "0.5" "0.9" "0.1" "0.5" "0.9" "0.1" "0.5" "0.9" "0.1" "0.5" "0.9" "0.1" "0.5" "0.9" "0.1" "0.5" "0.9" }; | ||
%violinplot(hypMatrixInverted4, CATEGORYNAMES, 'width', 0.1, 'violinalpha', 0.8, 'ShowData', false) | ||
%boxplot(hypMatrix_concat) | ||
%xlabel("Target Delta") | ||
%ylabel("Quotient between obtained delta and target delta") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
|
||
folder = "HyperMatrix_Pre"; | ||
HeurID1 = 1; | ||
HeurID2 = 2; | ||
Population = 10; | ||
|
||
HeuristicID1=heurIDrepository(HeurID1); | ||
HeuristicID2=heurIDrepository(HeurID2); | ||
|
||
address = char(HeuristicID1+"vs"+HeuristicID2+"_Small_pop"+num2str(Population)+".mat"); | ||
address2 = char(HeuristicID2+"vs"+HeuristicID1+"_Small_pop"+num2str(Population)+".mat"); | ||
folder2 = pwd; | ||
|
||
oldfolder=cd(folder); | ||
hypMatrix=importdata(address); | ||
hypMatrix2=importdata(address2); | ||
hypMatrix_T_I=(hypMatrix')*-1; | ||
hypMatrix2_T_I=(hypMatrix2')*-1; | ||
hypMatrix_concatenated(1,:)=hypMatrix_T_I; | ||
hypMatrix_concatenated(2,:)=hypMatrix2_T_I; | ||
|
||
% hypMatrix_T_I=sort(hypMatrix_T_I) | ||
% hypMatrix2_T_I=sort(hypMatrix2_T_I) | ||
%a=heatmap(hypMatrix_concatenated) | ||
% | ||
% plot(hypMatrix_T_I,'--o') | ||
% hold on | ||
% plot(hypMatrix2_T_I, '--o') | ||
|
||
figure | ||
subplot(1,2,1) | ||
histogram(hypMatrix_T_I) | ||
subplot(1,2,2) | ||
histogram(hypMatrix2_T_I,'FaceColor','r') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
heuristicID=["LPT" "LPT" "SPT" "SPT" "MPA" "MPA" "LPA" "LPA"]; | ||
Objective=[1 2 1 2 1 2 1 2]; | ||
nbJobsV=[3]; | ||
nbMachinesV=[4]; | ||
folder="HyperMatrix_Advanced"; | ||
folder2 = pwd; | ||
oldfolder=cd(folder); | ||
for x=1:length(heuristicID) | ||
|
||
if Objective(x) == 1 | ||
address =heuristicID(x) +"vsAll_"+"J"+num2str(nbJobsV(1))+"xM"+num2str(nbMachinesV(1)+".mat"); | ||
elseif Objective(x) == 2 | ||
address ="Allvs"+heuristicID(x)+"_J"+num2str(nbJobsV(1))+"xM"+num2str(nbMachinesV(1)+".mat"); | ||
end | ||
|
||
hypMatrix=importdata(address); | ||
hypMatrix_Inv=(hypMatrix*-1)'; | ||
hypMatrix_concat(:,x)=hypMatrix_Inv(:); | ||
end | ||
oldfolder=cd(folder2); | ||
%a=heatmap(hypMatrix_concat) | ||
CATEGORYNAMES = {"1" "2" "3" "4" "5" "6" "7" "8"}; | ||
violinplot(hypMatrix_concat,CATEGORYNAMES,'ViolinColor',[1,0,0],'width', 0.3, 'violinalpha', 0.3, 'ShowData', false) | ||
hold on | ||
|
||
heuristicID=["LPT" "LPT" "SPT" "SPT" "MPA" "MPA" "LPA" "LPA"]; | ||
Objective=[1 2 1 2 1 2 1 2]; | ||
nbJobsV=[3]; | ||
nbMachinesV=[4]; | ||
folder="HyperMatrix_Advanced2"; | ||
oldfolder=cd(folder2); | ||
oldfolder=cd(folder); | ||
for x=1:length(heuristicID) | ||
|
||
if Objective(x) == 1 | ||
address =heuristicID(x) +"vsAll_"+"J"+num2str(nbJobsV(1))+"xM"+num2str(nbMachinesV(1)+".mat"); | ||
elseif Objective(x) == 2 | ||
address ="Allvs"+heuristicID(x)+"_J"+num2str(nbJobsV(1))+"xM"+num2str(nbMachinesV(1)+".mat"); | ||
end | ||
|
||
hypMatrix=importdata(address); | ||
hypMatrix_Inv=(hypMatrix*-1)'; | ||
hypMatrix_concat(:,x)=hypMatrix_Inv(:); | ||
end | ||
oldfolder=cd(folder2); | ||
%a=heatmap(hypMatrix_concat) | ||
CATEGORYNAMES = {"1" "2" "3" "4" "5" "6" "7" "8"}; | ||
violinplot(hypMatrix_concat, CATEGORYNAMES, 'ViolinColor',[0,0,1],'width', 0.3, 'violinalpha', 0.3, 'ShowData', false) | ||
% hist(hypMatrix_concat(1,:)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
function []= hypMatrixtoViolin_Advanced(folder, HeurID, objective) | ||
global hypMatrix_concat | ||
|
||
nbJobsV = [3]; | ||
nbMachinesV = [4]; | ||
heuristicID=heurIDrepository(HeurID); | ||
heurIDV=HeurIDVector(HeurID); | ||
|
||
if objective == 1 | ||
address =heuristicID(1) +"vsAll_"+"J"+num2str(nbJobsV(1))+"xM"+num2str(nbMachinesV(1)); | ||
elseif objective == 2 | ||
address ="Allvs"+heuristicID(1)+"_J"+num2str(nbJobsV(1))+"xM"+num2str(nbMachinesV(1)); | ||
end | ||
|
||
folder2 = pwd; | ||
oldfolder=cd(folder); | ||
oldfolder=cd(address); | ||
|
||
for x=10:10:50 | ||
delta_code = "_Delta_"+num2str(x); | ||
address2= address+delta_code+".mat"; | ||
hypMatrix=importdata(address2); | ||
HeurID_makespan_matrix = hypMatrix(:,HeurID+2); | ||
if objective == 1 | ||
for r=1:50 | ||
RemVector_makespan_matrix(r,1) = min([hypMatrix(r,heurIDV(1)+2) hypMatrix(r,heurIDV(2)+2) hypMatrix(r,heurIDV(3)+2)]); | ||
end | ||
Matrix1 = HeurID_makespan_matrix./RemVector_makespan_matrix; | ||
Matrix2 = (RemVector_makespan_matrix-HeurID_makespan_matrix)/x; | ||
elseif objective == 2 | ||
for r=1:50 | ||
RemVector_makespan_matrix(r,1) = max([hypMatrix(r,heurIDV(1)+2) hypMatrix(r,heurIDV(2)+2) hypMatrix(r,heurIDV(3)+2)]); | ||
end | ||
Matrix1 =RemVector_makespan_matrix./HeurID_makespan_matrix; | ||
Matrix2 = (HeurID_makespan_matrix-RemVector_makespan_matrix)/x; | ||
end | ||
|
||
|
||
y=x/10; | ||
hypMatrix_concat(:,y)= Matrix2(:,1); | ||
end | ||
disp("Mean") | ||
hypMatrix_mean= mean(hypMatrix_concat) | ||
disp("Median") | ||
hypMatrix_median=median(hypMatrix_concat) | ||
|
||
cd(folder2) | ||
CATEGORYNAMES = {"10" "20" "30" "40" "50"}; | ||
violinplot(hypMatrix_concat, CATEGORYNAMES,'ViolinColor',[0,0,1],'width', 0.3, 'violinalpha', 0.3, 'ShowData', false) | ||
|
||
|
||
%boxplot(hypMatrix_concat) | ||
xlabel("Target Delta") | ||
ylabel("Quotient between obtained delta and target delta") | ||
|
||
end | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function [makespan] = makespan(instance, heurID) | ||
|
||
instance1 = createJSSPInstanceFromInstance(instance); | ||
|
||
makespan = JSSPSolveInstance(instance1, heurID); | ||
|
||
end |