├── AMRPP-DT ├── AStarST.m ├── FlowNetwork.m ├── MILPModel.m ├── MRPP.m ├── MyGraph.m ├── generateInstances.m ├── instances20x20x0%.mat ├── instances20x20x10%.mat ├── instances20x20x20%.mat ├── main.m ├── main_evaluation_lateness.m ├── main_evaluation_tardiness.m ├── main_evaluation_up.m ├── map18x24x0%.mat ├── map18x24x10%.mat ├── map18x24x20%.mat ├── map20x20x0%.mat ├── map20x20x10%.mat ├── map20x20x20%.mat ├── map2x3.mat ├── plotAll.m └── results&analysis │ ├── AMRPP-DT-Results20x20x0-lateness.mat │ ├── AMRPP-DT-Results20x20x0-tardiness.mat │ ├── AMRPP-DT-Results20x20x0-up.mat │ ├── AMRPP-DT-Results20x20x10-lateness.mat │ ├── AMRPP-DT-Results20x20x10-tardiness.mat │ ├── AMRPP-DT-Results20x20x10-up.mat │ ├── AMRPP-DT-Results20x20x20-lateness.mat │ ├── AMRPP-DT-Results20x20x20-tardiness.mat │ ├── AMRPP-DT-Results20x20x20-up.mat │ ├── plotLateness.m │ ├── plotTardiness.m │ ├── plotUP.m │ └── statistics.m ├── LICENSE ├── MRPP-DT ├── AStarST.m ├── FlowNetwork.m ├── MILPModel.m ├── MRPP.m ├── MyGraph.m ├── generateInstances.m ├── instances20x20x0%.mat ├── instances20x20x10%.mat ├── instances20x20x20%.mat ├── main.m ├── main_evaluation_UP.m ├── main_evaluation_lateness.m ├── main_evaluation_makespan.m ├── main_evaluation_tardiness.m ├── map18x24x0%.mat ├── map18x24x10%.mat ├── map18x24x20%.mat ├── map20x20x0%.mat ├── map20x20x10%.mat ├── map20x20x20%.mat ├── map2x3.mat ├── plotAll.m └── results&analysis │ ├── Results20x20x0-lateness.mat │ ├── Results20x20x0-makespan.mat │ ├── Results20x20x0-tardiness.mat │ ├── Results20x20x0-up.mat │ ├── Results20x20x10-lateness.mat │ ├── Results20x20x10-makespan.mat │ ├── Results20x20x10-tardiness.mat │ ├── Results20x20x10-up.mat │ ├── Results20x20x20-lateness.mat │ ├── Results20x20x20-makespan.mat │ ├── Results20x20x20-tardiness.mat │ ├── Results20x20x20-up.mat │ ├── plotLateness.m │ ├── plotTardiness.m │ ├── plotUP.m │ └── statistics.m └── README.md /AMRPP-DT/AStarST.m: -------------------------------------------------------------------------------- 1 | function OptimalPath=AStarST(MapMat,startState,goalState,constraints) 2 | %Algorithm: space-time A* 3 | %Author: Hanfucius 4 | %Input: Occupancy Map matrix (zero position:upper left), start and goal row-colum 5 | %actions: 1=right,2=up,3=left,4=down,0=wait 6 | [height,width] = size(MapMat); 7 | Actions = [0 1 1;-1 0 1;0 -1 1;1 0 1;0 0 1]; %right,up,left,down,pause,five actions 8 | %pre-assign memory 9 | OPEN_COUNT=1; 10 | MAX_OPEN_SIZE=200; 11 | OPEN=zeros(MAX_OPEN_SIZE,11); 12 | 13 | CLOSED_COUNT=1; 14 | MAX_CLOSED_SIZE=200; 15 | CLOSED=zeros(MAX_CLOSED_SIZE,11); 16 | 17 | %Initialize start node with FValue and open first node. 18 | dist=pdist2(startState,goalState,'cityblock'); 19 | Root(1,1:11)=[startState(1,1) startState(1,2) 0 0 0 0 dist 0 dist 0 1]; %current ST node,parent ST node, F,G,H values,actions,checkedFlag (1=unchecked,0=checked) 20 | OPEN(1,:)=Root; 21 | 22 | while ~isempty(find(OPEN(:,11)==1, 1)) 23 | %best-first search and tie-breaking policy 24 | TEMPOPEN = OPEN(OPEN(:,11)==1,:); 25 | minFScore=min(TEMPOPEN(:,7)); 26 | index = find(TEMPOPEN(:,7)==minFScore); 27 | energy=TEMPOPEN(index,10); 28 | [~,index2] = min(energy,[],1); 29 | currentNodeIndex=index(index2); 30 | currentNode=TEMPOPEN(currentNodeIndex,:); 31 | if all(currentNode(1,1:2)==goalState) 32 | break; 33 | end 34 | 35 | %Removing node from OpenList to ClosedList 36 | [~,temp]=ismember(currentNode,OPEN,'rows'); 37 | OPEN(temp,11) = 0; 38 | CLOSED(CLOSED_COUNT,:) = currentNode; 39 | CLOSED_COUNT=CLOSED_COUNT+1; 40 | for i=1:5 41 | newNode=zeros(1,11); 42 | newNode(1,1:3)=currentNode(1,1:3)+Actions(i,:); 43 | %Ignore the out of borders and obstacles. 44 | if newNode(1,1)<1||newNode(1,1)>height||newNode(1,2)<1||newNode(1,2)>width||MapMat(newNode(1,1),newNode(1,2))==1 45 | continue; 46 | end 47 | 48 | %Ignore the nodes in CLOSED lists. 49 | if ismember(newNode(1,1:3),CLOSED(:,1:3),'rows') 50 | continue; 51 | end 52 | 53 | %Ignore the nodes in constraints lists.including vertex and edge 54 | %conflicts. 55 | currentST(1,1:3)=currentNode(1,1:3); 56 | nextST(1,1:3)=newNode(1,1:3); 57 | edgeConflict1=currentST; 58 | edgeConflict2=nextST; 59 | edgeConflict1(1,3)=nextST(1,3); 60 | edgeConflict2(1,3)=currentST(1,3); 61 | 62 | if ~isempty(constraints) 63 | if ismember(nextST,constraints,'rows') ||(ismember(edgeConflict1,constraints,'rows') && ismember(edgeConflict2,constraints,'rows')) 64 | continue; 65 | end 66 | end 67 | 68 | %Discover a new node and update its tentative F,G,H values 69 | newNode(1,4:6)=currentNode(1,1:3); 70 | dist=pdist2(newNode(1,1:2),goalState,'cityblock'); 71 | newNode(1,7:9)=[dist+currentNode(1,8)+1 currentNode(1,8)+1 dist]; 72 | if i==5 73 | newNode(1,10)=currentNode(1,10); 74 | else 75 | newNode(1,10)=currentNode(1,10)+1; 76 | end 77 | newNode(1,11)=1; 78 | [flag,index]=ismember(newNode(1,1:3),OPEN(:,1:3),'rows'); 79 | if flag==1 % if this node is already in the OPEN list 80 | if newNode(1,7)>OPEN(index,7) 81 | continue; 82 | else 83 | OPEN(index,:)=newNode; 84 | end 85 | else % if this node is not in the OPEN list 86 | OPEN_COUNT=OPEN_COUNT+1; 87 | OPEN(OPEN_COUNT,:)=newNode; 88 | end 89 | end 90 | end 91 | 92 | %backward reconstruct path 93 | k=1; 94 | OptimalPath=zeros(200,3); 95 | while ~all(Root==currentNode) 96 | OptimalPath(k,:)=currentNode(1,1:3); 97 | [~,parentIndex]=ismember(currentNode(1,4:6),CLOSED(:,1:3),'rows'); 98 | currentNode = CLOSED(parentIndex,:); 99 | k=k+1; 100 | end 101 | OptimalPath=OptimalPath(all(OptimalPath,2),:); 102 | OptimalPath=[OptimalPath;Root(1,1:3)]; 103 | OptimalPath=flipud(OptimalPath); 104 | end -------------------------------------------------------------------------------- /AMRPP-DT/FlowNetwork.m: -------------------------------------------------------------------------------- 1 | classdef FlowNetwork= 1 && newI <= map.Height && newJ >= 1 && newJ <= map.Width && structure(newI,newJ,newT) ~= 0 63 | newNodeID = structure(newI,newJ,newT); 64 | arcID = arcID + 1; 65 | arcs(arcID,:) = [structure(i,j,t) newNodeID]; 66 | outArcCell{i,j,t} = [outArcCell{i,j,t},arcID]; 67 | inArcCell{newI,newJ,newT} = [inArcCell{newI,newJ,newT},arcID]; 68 | end 69 | end 70 | end 71 | end 72 | end 73 | end 74 | arcs(arcID+1:end,:) = []; 75 | 76 | robotNum = size(startRCT,1); 77 | sourceIDs = zeros(robotNum,1); 78 | sinkIDs = zeros(robotNum,1); 79 | for i=1:robotNum 80 | sourceIDs(i,1) = structure(startRCT(i,1),startRCT(i,2),startRCT(i,3)); 81 | sinkIDs(i,1) = structure(goalRCT(i,1),goalRCT(i,2),T); %notice! 82 | end 83 | 84 | obj.Structure = structure; 85 | obj.Nodes = nodes; 86 | obj.Arcs = arcs; 87 | obj.NodeNum = nodeID; 88 | obj.ArcNum = arcID; 89 | 90 | obj.SourceVec = sourceIDs; 91 | obj.SinkVec = sinkIDs; 92 | 93 | obj.InArcCell = inArcCell; 94 | obj.OutArcCell = outArcCell; 95 | 96 | obj.StartRCT = startRCT; 97 | obj.GoalRCT = goalRCT; 98 | obj.getConflictArcs(); 99 | end 100 | 101 | function getConflictArcs(obj) 102 | conflictArcPair = zeros(obj.ArcNum,2); 103 | conflictNum = 0; 104 | flagVec = zeros(obj.ArcNum,1); 105 | for i=1:obj.ArcNum 106 | if flagVec(i,1) == 1 107 | continue; 108 | end 109 | 110 | %(u_t,v_{t+1}),(v_t,u_{t+1}) pair 111 | arc = obj.Arcs(i,:); 112 | nodeU = obj.Nodes(arc(1,1),:); 113 | nodeV = obj.Nodes(arc(1,2),:); 114 | 115 | if nodeU(1,1)==nodeV(1,1) && nodeU(1,2)==nodeV(1,2) 116 | flagVec(i,1) = 1; 117 | continue; 118 | end 119 | 120 | newNodeU = [nodeU(1,1:2),nodeV(1,3)]; 121 | newNodeV = [nodeV(1,1:2),nodeU(1,3)]; 122 | newIDU = obj.Structure(newNodeU(1,1),newNodeU(1,2),newNodeU(1,3)); 123 | newIDV = obj.Structure(newNodeV(1,1),newNodeV(1,2),newNodeV(1,3)); 124 | if newIDU==0 || newIDV==0 125 | flagVec(i,1) = 1; 126 | continue; 127 | end 128 | 129 | newArcIndices = obj.OutArcCell{newNodeV(1,1),newNodeV(1,2),newNodeV(1,3)}; 130 | if ~isempty(newArcIndices) 131 | for j = newArcIndices 132 | arc2 = obj.Arcs(j,:); 133 | if arc2(1,2) == newIDU 134 | conflictNum = conflictNum + 1; 135 | conflictArcPair(conflictNum,:) = [i j]; 136 | flagVec(i,1) = 1; 137 | flagVec(j,1) = 1; 138 | break; 139 | end 140 | end 141 | else 142 | flagVec(i,1) = 1; 143 | end 144 | end 145 | conflictArcPair(conflictNum+1:end,:)=[]; 146 | obj.ConflictArcPair = conflictArcPair; 147 | obj.ConflictNum = conflictNum; 148 | end 149 | 150 | end 151 | end 152 | 153 | -------------------------------------------------------------------------------- /AMRPP-DT/MILPModel.m: -------------------------------------------------------------------------------- 1 | classdef MILPModelsimTime 107 | NextRobotStates(i,:)=path(simTime+1,1:3); 108 | end 109 | for j=1:robotNum 110 | if NextRobotStates(i,1)==GoalRobotStates(j,1) && NextRobotStates(i,2)==GoalRobotStates(j,2) 111 | TaskStatus(j,1) = 0; 112 | end 113 | end 114 | end 115 | %continuous simulation 116 | for i=0:intepolate-1 117 | tempRobotStates=CurrentRobotStates+i*(NextRobotStates-CurrentRobotStates)/intepolate; 118 | plotAll(map,simTime,tempRobotStates,GoalRobotStates,ArrivalTime,ColorMat,objectiveSelect); 119 | frame = getframe; 120 | writeVideo(video,frame); 121 | cla; 122 | end 123 | CurrentRobotStates=NextRobotStates; 124 | simTime = simTime+1; 125 | end 126 | 127 | for i = 1:intepolate+10 128 | plotAll(map,simTime,CurrentRobotStates,GoalRobotStates,ArrivalTime,ColorMat,objectiveSelect); 129 | pause(0.1); 130 | frame = getframe; 131 | writeVideo(video,frame); 132 | cla; 133 | end 134 | 135 | close(video); -------------------------------------------------------------------------------- /AMRPP-DT/main_evaluation_lateness.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | objectiveSelect = 5; 4 | printInfo = false; 5 | 6 | load('instances20x20x0%.mat'); 7 | typeNum = size(InstanceSet,1); 8 | instanceNum = size(InstanceSet,2); 9 | Results = cell(typeNum,instanceNum); 10 | 11 | for typeID = 1:typeNum 12 | for instanceID = 1:instanceNum 13 | instance = InstanceSet{typeID,instanceID}; 14 | fprintf("Solving instance20x20x0-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 15 | mat = instance.GoalRCT; 16 | mat(:,3) = 5; 17 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,mat,objectiveSelect,printInfo,0); 18 | save('AMRPP-DT-Results20x20x0-lateness','Results'); 19 | end 20 | end 21 | 22 | load('instances20x20x10%.mat'); 23 | typeNum = size(InstanceSet,1); 24 | instanceNum = size(InstanceSet,2); 25 | Results = cell(typeNum,instanceNum); 26 | 27 | for typeID = 1:typeNum 28 | for instanceID = 1:instanceNum 29 | instance = InstanceSet{typeID,instanceID}; 30 | fprintf("Solving instance20x20x10-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 31 | mat = instance.GoalRCT; 32 | mat(:,3) = 5; 33 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,mat,objectiveSelect,printInfo,0); 34 | save('AMRPP-DT-Results20x20x10-lateness','Results'); 35 | end 36 | end 37 | 38 | load('instances20x20x20%.mat'); 39 | typeNum = size(InstanceSet,1); 40 | instanceNum = size(InstanceSet,2); 41 | Results = cell(typeNum,instanceNum); 42 | 43 | for typeID = 1:typeNum 44 | for instanceID = 1:instanceNum 45 | instance = InstanceSet{typeID,instanceID}; 46 | fprintf("Solving instance20x20x20-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 47 | mat = instance.GoalRCT; 48 | mat(:,3) = 5; 49 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,mat,objectiveSelect,printInfo,0); 50 | save('AMRPP-DT-Results20x20x20-lateness','Results'); 51 | end 52 | end 53 | 54 | -------------------------------------------------------------------------------- /AMRPP-DT/main_evaluation_tardiness.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | objectiveSelect = 6; 4 | printInfo = false; 5 | 6 | load('instances20x20x0%.mat'); 7 | typeNum = size(InstanceSet,1); 8 | instanceNum = size(InstanceSet,2); 9 | Results = cell(typeNum,instanceNum); 10 | 11 | for typeID = 1:typeNum 12 | for instanceID = 1:instanceNum 13 | instance = InstanceSet{typeID,instanceID}; 14 | fprintf("Solving instance20x20x0-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 15 | mat = instance.GoalRCT; 16 | mat(:,3) = 5; 17 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,mat,objectiveSelect,printInfo,0); 18 | save('AMRPP-DT-Results20x20x0-tardiness','Results'); 19 | end 20 | end 21 | 22 | load('instances20x20x10%.mat'); 23 | typeNum = size(InstanceSet,1); 24 | instanceNum = size(InstanceSet,2); 25 | Results = cell(typeNum,instanceNum); 26 | 27 | for typeID = 1:typeNum 28 | for instanceID = 1:instanceNum 29 | instance = InstanceSet{typeID,instanceID}; 30 | fprintf("Solving instance20x20x10-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 31 | mat = instance.GoalRCT; 32 | mat(:,3) = 5; 33 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,mat,objectiveSelect,printInfo,0); 34 | save('AMRPP-DT-Results20x20x10-tardiness','Results'); 35 | end 36 | end 37 | 38 | load('instances20x20x20%.mat'); 39 | typeNum = size(InstanceSet,1); 40 | instanceNum = size(InstanceSet,2); 41 | Results = cell(typeNum,instanceNum); 42 | 43 | for typeID = 1:typeNum 44 | for instanceID = 1:instanceNum 45 | instance = InstanceSet{typeID,instanceID}; 46 | fprintf("Solving instance20x20x20-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 47 | mat = instance.GoalRCT; 48 | mat(:,3) = 5; 49 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,mat,objectiveSelect,printInfo,0); 50 | save('AMRPP-DT-Results20x20x20-tardiness','Results'); 51 | end 52 | end 53 | 54 | -------------------------------------------------------------------------------- /AMRPP-DT/main_evaluation_up.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | objectiveSelect = 7; 4 | printInfo = false; 5 | 6 | load('instances20x20x0%.mat'); 7 | typeNum = size(InstanceSet,1); 8 | instanceNum = size(InstanceSet,2); 9 | Results = cell(typeNum,instanceNum); 10 | 11 | for typeID = 1:typeNum 12 | for instanceID = 1:instanceNum 13 | instance = InstanceSet{typeID,instanceID}; 14 | fprintf("Solving instance20x20x0-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 15 | mat = instance.GoalRCT; 16 | mat(:,3) = 5; 17 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,mat,objectiveSelect,printInfo,0); 18 | save('AMRPP-DT-Results20x20x0-up','Results'); 19 | end 20 | end 21 | 22 | load('instances20x20x10%.mat'); 23 | typeNum = size(InstanceSet,1); 24 | instanceNum = size(InstanceSet,2); 25 | Results = cell(typeNum,instanceNum); 26 | 27 | for typeID = 1:typeNum 28 | for instanceID = 1:instanceNum 29 | instance = InstanceSet{typeID,instanceID}; 30 | fprintf("Solving instance20x20x10-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 31 | mat = instance.GoalRCT; 32 | mat(:,3) = 5; 33 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,mat,objectiveSelect,printInfo,0); 34 | save('AMRPP-DT-Results20x20x10-up','Results'); 35 | end 36 | end 37 | 38 | load('instances20x20x20%.mat'); 39 | typeNum = size(InstanceSet,1); 40 | instanceNum = size(InstanceSet,2); 41 | Results = cell(typeNum,instanceNum); 42 | 43 | for typeID = 1:typeNum 44 | for instanceID = 1:instanceNum 45 | instance = InstanceSet{typeID,instanceID}; 46 | fprintf("Solving instance20x20x20-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 47 | mat = instance.GoalRCT; 48 | mat(:,3) = 5; 49 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,mat,objectiveSelect,printInfo,0); 50 | save('AMRPP-DT-Results20x20x20-up','Results'); 51 | end 52 | end 53 | 54 | -------------------------------------------------------------------------------- /AMRPP-DT/map18x24x0%.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/map18x24x0%.mat -------------------------------------------------------------------------------- /AMRPP-DT/map18x24x10%.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/map18x24x10%.mat -------------------------------------------------------------------------------- /AMRPP-DT/map18x24x20%.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/map18x24x20%.mat -------------------------------------------------------------------------------- /AMRPP-DT/map20x20x0%.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/map20x20x0%.mat -------------------------------------------------------------------------------- /AMRPP-DT/map20x20x10%.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/map20x20x10%.mat -------------------------------------------------------------------------------- /AMRPP-DT/map20x20x20%.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/map20x20x20%.mat -------------------------------------------------------------------------------- /AMRPP-DT/map2x3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/map2x3.mat -------------------------------------------------------------------------------- /AMRPP-DT/plotAll.m: -------------------------------------------------------------------------------- 1 | function plotAll(map,simT,RobotStates,GoalStates,ArrivalTime,ColorMat,objectiveSelect) 2 | robotMarkerSize = 18; 3 | obstacleMarkerSize = 36; 4 | fontSize = 13; 5 | 6 | height = map.Height; 7 | width = map.Width; 8 | robotNum=size(RobotStates,1); 9 | 10 | rectangle('Position', [0,0,width,height],'lineWidth',5); 11 | hold on; 12 | [I,J] = find(map.MapGrid==1); 13 | tempMat = [I J]; 14 | obstacles = tempMat; 15 | obstacles(:,1) = tempMat(:,2)-0.5; 16 | obstacles(:,2) = height+1-tempMat(:,1)-0.5; 17 | 18 | robotXY = RobotStates; 19 | robotXY(:,1) = RobotStates(:,2)-0.5; 20 | robotXY(:,2) = height+1-RobotStates(:,1)-0.5; 21 | 22 | goalXY = GoalStates; 23 | goalXY(:,1) = GoalStates(:,2)-0.5; 24 | goalXY(:,2) = height+1-GoalStates(:,1)-0.5; 25 | 26 | plot(obstacles(:,1),obstacles(:,2),'square','MarkerEdgeColor','k','MarkerFaceColor',[0 0 0],'MarkerSize',obstacleMarkerSize); 27 | hold on; 28 | 29 | 30 | for i=1:robotNum 31 | plot(goalXY(i,1),goalXY(i,2),'o','MarkerEdgeColor',[0 0 0],'MarkerFaceColor',[1 1 1],'MarkerSize',robotMarkerSize,'LineWidth',2); 32 | %txt=sprintf('d_{%d}=%d',i,goalXY(i,3)-1); 33 | %text(goalXY(i,1),goalXY(i,2)+0.6,txt,'FontWeight','Bold','FontSize',fontSize-4,'HorizontalAlignment','center','Color',[0 0 0]); 34 | hold on; 35 | end 36 | 37 | for i=1:robotNum 38 | plot(robotXY(i,1),robotXY(i,2),'o','MarkerEdgeColor',ColorMat(i,:),'MarkerFaceColor',ColorMat(i,:),'MarkerSize',robotMarkerSize,'LineWidth',2); 39 | if ArrivalTime(i,1)<=simT 40 | 41 | switch objectiveSelect 42 | case 0 43 | txt=sprintf('τ_{%d}=%d',i,ArrivalTime(i,1)-1); 44 | case 1 45 | txt=sprintf('τ_{%d}=%d',i,ArrivalTime(i,1)-1); 46 | case 2 47 | txt=sprintf('τ_{%d}=%d',i,ArrivalTime(i,1)-1); 48 | case 5 49 | txt=sprintf('L_{%d}=%d',i,ArrivalTime(i,1)-goalXY(i,3)); 50 | case 6 51 | txt=sprintf('T_{%d}=%d',i,abs(ArrivalTime(i,1)-goalXY(i,3))); 52 | case 7 53 | if ArrivalTime(i,1)==goalXY(i,3)+1 54 | temp = 1; 55 | else 56 | temp = 0; 57 | end 58 | txt=sprintf('U_{%d}=%d',i,temp); 59 | end 60 | %text(goalXY(i,1),goalXY(i,2)-0.6,txt,'FontWeight','Bold','FontSize',fontSize-4,'HorizontalAlignment','center','Color',ColorMat(i,:)); 61 | end 62 | txt=sprintf('%d',i); 63 | text(robotXY(i,1),robotXY(i,2),txt,'FontWeight','Bold','FontSize',fontSize,'HorizontalAlignment','center','Color',[1 1 1]); 64 | hold on; 65 | end 66 | 67 | end 68 | 69 | -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x0-lateness.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x0-lateness.mat -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x0-tardiness.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x0-tardiness.mat -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x0-up.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x0-up.mat -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x10-lateness.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x10-lateness.mat -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x10-tardiness.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x10-tardiness.mat -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x10-up.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x10-up.mat -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x20-lateness.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x20-lateness.mat -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x20-tardiness.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x20-tardiness.mat -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x20-up.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/AMRPP-DT/results&analysis/AMRPP-DT-Results20x20x20-up.mat -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/plotLateness.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | %% makespan 4 | largeNumber = 10000000; 5 | load('AMRPP-DT-Results20x20x0-lateness.mat'); 6 | [valueMat,timeMat] = statistics(Results); 7 | y = zeros(1,9); 8 | for i=1:9 9 | vec = valueMat(i,:); 10 | vec(vec==largeNumber)=[]; 11 | if ~isempty(vec) && length(vec)>=15 12 | y(1,i) = mean(vec); 13 | elseif length(vec)<15 14 | disp("cannot solve 3/4 instances"); 15 | y(1,i) = largeNumber; 16 | elseif isempty(vec) 17 | disp("empty value"); 18 | y(1,i) = largeNumber; 19 | end 20 | end 21 | y1 = y; 22 | 23 | timeMat = timeMat'; 24 | t1 = mean(timeMat); 25 | 26 | load('AMRPP-DT-Results20x20x10-lateness.mat'); 27 | [valueMat,timeMat] = statistics(Results); 28 | y = zeros(1,9); 29 | for i=1:9 30 | vec = valueMat(i,:); 31 | vec(vec==largeNumber)=[]; 32 | if ~isempty(vec) && length(vec)>=15 33 | y(1,i) = mean(vec); 34 | elseif length(vec)<15 35 | disp("cannot solve 3/4 instances"); 36 | y(1,i) = largeNumber; 37 | elseif isempty(vec) 38 | disp("empty value"); 39 | y(1,i) = largeNumber; 40 | end 41 | end 42 | y2 = y; 43 | 44 | timeMat = timeMat'; 45 | t2 = mean(timeMat); 46 | 47 | load('AMRPP-DT-Results20x20x20-lateness.mat'); 48 | [valueMat,timeMat] = statistics(Results); 49 | y = zeros(1,9); 50 | for i=1:9 51 | vec = valueMat(i,:); 52 | vec(vec==largeNumber)=[]; 53 | if ~isempty(vec) && length(vec)>=15 54 | y(1,i) = mean(vec); 55 | elseif length(vec)<15 56 | disp("cannot solve 3/4 instances"); 57 | y(1,i) = largeNumber; 58 | elseif isempty(vec) 59 | disp("empty value"); 60 | y(1,i) = largeNumber; 61 | end 62 | end 63 | y3 = y; 64 | 65 | timeMat = timeMat'; 66 | t3 = mean(timeMat); 67 | 68 | figure(1); 69 | set(gca,'xtick',0:10:90); 70 | x=10:10:90; 71 | plot(x,y1,'-ro','MarkerFaceColor','red'); 72 | %errorbar(x,y1,z,'-ro','MarkerFaceColor','red'); 73 | hold on; 74 | plot(x,y2,'-gd','MarkerFaceColor','green'); 75 | %errorbar(x,y2,z,'-gd','MarkerFaceColor','green'); 76 | hold on; 77 | plot(x,y3,'-bs','MarkerFaceColor','blue'); 78 | %errorbar(x,y3,z,'-bs','MarkerFaceColor','blue'); 79 | grid on; 80 | legend('0','10%','20%','Location','northeast','FontSize',12); 81 | 82 | figure(2); 83 | set(gca,'xtick',0:10:90); 84 | x=10:10:90; 85 | plot(x,t1,'-ro','MarkerFaceColor','red'); 86 | %errorbar(x,y1,z,'-ro','MarkerFaceColor','red'); 87 | hold on; 88 | plot(x,t2,'-gd','MarkerFaceColor','green'); 89 | %errorbar(x,y2,z,'-gd','MarkerFaceColor','green'); 90 | hold on; 91 | plot(x,t3,'-bs','MarkerFaceColor','blue'); 92 | %errorbar(x,y3,z,'-bs','MarkerFaceColor','blue'); 93 | grid on; 94 | legend('0','10%','20%','Location','northwest','FontSize',12); -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/plotTardiness.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | %% makespan 4 | largeNumber = 10000000; 5 | load('AMRPP-DT-Results20x20x0-tardiness.mat'); 6 | [valueMat,timeMat] = statistics(Results); 7 | y = zeros(1,9); 8 | for i=1:9 9 | vec = valueMat(i,:); 10 | vec(vec==largeNumber)=[]; 11 | if ~isempty(vec) && length(vec)>=15 12 | y(1,i) = mean(vec); 13 | elseif length(vec)<15 14 | disp("cannot solve 3/4 instances"); 15 | y(1,i) = largeNumber; 16 | elseif isempty(vec) 17 | disp("empty value"); 18 | y(1,i) = largeNumber; 19 | end 20 | end 21 | y1 = y; 22 | 23 | timeMat = timeMat'; 24 | t1 = mean(timeMat); 25 | 26 | load('AMRPP-DT-Results20x20x10-tardiness.mat'); 27 | [valueMat,timeMat] = statistics(Results); 28 | y = zeros(1,9); 29 | for i=1:9 30 | vec = valueMat(i,:); 31 | vec(vec==largeNumber)=[]; 32 | if ~isempty(vec) && length(vec)>=15 33 | y(1,i) = mean(vec); 34 | elseif length(vec)<15 35 | disp("cannot solve 3/4 instances"); 36 | y(1,i) = largeNumber; 37 | elseif isempty(vec) 38 | disp("empty value"); 39 | y(1,i) = largeNumber; 40 | end 41 | end 42 | y2 = y; 43 | 44 | timeMat = timeMat'; 45 | t2 = mean(timeMat); 46 | 47 | load('AMRPP-DT-Results20x20x20-tardiness.mat'); 48 | [valueMat,timeMat] = statistics(Results); 49 | y = zeros(1,9); 50 | for i=1:9 51 | vec = valueMat(i,:); 52 | vec(vec==largeNumber)=[]; 53 | if ~isempty(vec) && length(vec)>=15 54 | y(1,i) = mean(vec); 55 | elseif length(vec)<15 56 | disp("cannot solve 3/4 instances"); 57 | y(1,i) = largeNumber; 58 | elseif isempty(vec) 59 | disp("empty value"); 60 | y(1,i) = largeNumber; 61 | end 62 | end 63 | y3 = y; 64 | 65 | timeMat = timeMat'; 66 | t3 = mean(timeMat); 67 | 68 | figure(1); 69 | set(gca,'xtick',0:10:90); 70 | x=10:10:90; 71 | plot(x,y1,'-ro','MarkerFaceColor','red'); 72 | %errorbar(x,y1,z,'-ro','MarkerFaceColor','red'); 73 | hold on; 74 | plot(x,y2,'-gd','MarkerFaceColor','green'); 75 | %errorbar(x,y2,z,'-gd','MarkerFaceColor','green'); 76 | hold on; 77 | plot(x,y3,'-bs','MarkerFaceColor','blue'); 78 | %errorbar(x,y3,z,'-bs','MarkerFaceColor','blue'); 79 | grid on; 80 | legend('0','10%','20%','Location','northeast','FontSize',12); 81 | 82 | figure(2); 83 | set(gca,'xtick',0:10:90); 84 | x=10:10:90; 85 | plot(x,t1,'-ro','MarkerFaceColor','red'); 86 | %errorbar(x,y1,z,'-ro','MarkerFaceColor','red'); 87 | hold on; 88 | plot(x,t2,'-gd','MarkerFaceColor','green'); 89 | %errorbar(x,y2,z,'-gd','MarkerFaceColor','green'); 90 | hold on; 91 | plot(x,t3,'-bs','MarkerFaceColor','blue'); 92 | %errorbar(x,y3,z,'-bs','MarkerFaceColor','blue'); 93 | grid on; 94 | legend('0','10%','20%','Location','northwest','FontSize',12); -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/plotUP.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | %% makespan 4 | largeNumber = 10000000; 5 | load('AMRPP-DT-Results20x20x0-up.mat'); 6 | [valueMat,timeMat] = statistics(Results); 7 | y = zeros(1,9); 8 | for i=1:9 9 | vec = valueMat(i,:); 10 | vec(vec==largeNumber)=[]; 11 | if ~isempty(vec) && length(vec)>=15 12 | y(1,i) = mean(vec); 13 | elseif length(vec)<15 14 | disp("cannot solve 3/4 instances"); 15 | y(1,i) = largeNumber; 16 | elseif isempty(vec) 17 | disp("empty value"); 18 | y(1,i) = largeNumber; 19 | end 20 | end 21 | y1 = y; 22 | 23 | timeMat = timeMat'; 24 | t1 = mean(timeMat); 25 | 26 | load('AMRPP-DT-Results20x20x10-up.mat'); 27 | [valueMat,timeMat] = statistics(Results); 28 | y = zeros(1,9); 29 | for i=1:9 30 | vec = valueMat(i,:); 31 | vec(vec==largeNumber)=[]; 32 | if ~isempty(vec) && length(vec)>=15 33 | y(1,i) = mean(vec); 34 | elseif length(vec)<15 35 | disp("cannot solve 3/4 instances"); 36 | y(1,i) = largeNumber; 37 | elseif isempty(vec) 38 | disp("empty value"); 39 | y(1,i) = largeNumber; 40 | end 41 | end 42 | y2 = y; 43 | 44 | timeMat = timeMat'; 45 | t2 = mean(timeMat); 46 | 47 | load('AMRPP-DT-Results20x20x20-up.mat'); 48 | [valueMat,timeMat] = statistics(Results); 49 | y = zeros(1,9); 50 | for i=1:9 51 | vec = valueMat(i,:); 52 | vec(vec==largeNumber)=[]; 53 | if ~isempty(vec) && length(vec)>=15 54 | y(1,i) = mean(vec); 55 | elseif length(vec)<15 56 | disp("cannot solve 3/4 instances"); 57 | y(1,i) = largeNumber; 58 | elseif isempty(vec) 59 | disp("empty value"); 60 | y(1,i) = largeNumber; 61 | end 62 | end 63 | y3 = y; 64 | 65 | timeMat = timeMat'; 66 | t3 = mean(timeMat); 67 | 68 | figure(1); 69 | set(gca,'xtick',0:10:90); 70 | x=10:10:90; 71 | plot(x,y1,'-ro','MarkerFaceColor','red'); 72 | %errorbar(x,y1,z,'-ro','MarkerFaceColor','red'); 73 | hold on; 74 | plot(x,y2,'-gd','MarkerFaceColor','green'); 75 | %errorbar(x,y2,z,'-gd','MarkerFaceColor','green'); 76 | hold on; 77 | plot(x,y3,'-bs','MarkerFaceColor','blue'); 78 | %errorbar(x,y3,z,'-bs','MarkerFaceColor','blue'); 79 | grid on; 80 | legend('0','10%','20%','Location','northeast','FontSize',12); 81 | 82 | figure(2); 83 | set(gca,'xtick',0:10:90); 84 | x=10:10:90; 85 | plot(x,t1,'-ro','MarkerFaceColor','red'); 86 | %errorbar(x,y1,z,'-ro','MarkerFaceColor','red'); 87 | hold on; 88 | plot(x,t2,'-gd','MarkerFaceColor','green'); 89 | %errorbar(x,y2,z,'-gd','MarkerFaceColor','green'); 90 | hold on; 91 | plot(x,t3,'-bs','MarkerFaceColor','blue'); 92 | %errorbar(x,y3,z,'-bs','MarkerFaceColor','blue'); 93 | grid on; 94 | legend('0','10%','20%','Location','northwest','FontSize',12); -------------------------------------------------------------------------------- /AMRPP-DT/results&analysis/statistics.m: -------------------------------------------------------------------------------- 1 | function [valueMat,timeMat] = statistics(results) 2 | largeNumber = 10000000; 3 | typeSize = size(results,1); 4 | instanceSize = size(results,2); 5 | valueMat = zeros(typeSize,instanceSize); 6 | timeMat = zeros(typeSize,instanceSize); 7 | for i=1:typeSize 8 | for j=1:instanceSize 9 | result = results{i,j}; 10 | vecLen = size(result,1); 11 | valueVec = zeros(vecLen,1); 12 | timeVec = zeros(vecLen,1); 13 | for k=1:vecLen 14 | temp = result{k,1}; 15 | timeVec(k,1)=temp.ComputeTime; 16 | if ~isempty(temp.ObjectiveValue) 17 | valueVec(k,1)=temp.ObjectiveValue; 18 | else 19 | valueVec(k,1)=largeNumber; 20 | end 21 | end 22 | valueVec(valueVec==largeNumber)=[]; 23 | if ~isempty(valueVec) 24 | valueMat(i,j) = min(valueVec); 25 | else 26 | valueMat(i,j) = largeNumber; 27 | end 28 | timeMat(i,j) = sum(timeVec); 29 | end 30 | end 31 | 32 | end 33 | 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /MRPP-DT/AStarST.m: -------------------------------------------------------------------------------- 1 | function OptimalPath=AStarST(MapMat,startState,goalState,constraints) 2 | %Algorithm: space-time A* 3 | %Author: Hanfucius 4 | %Input: Occupancy Map matrix (zero position:upper left), start and goal row-colum 5 | %actions: 1=right,2=up,3=left,4=down,0=wait 6 | [height,width] = size(MapMat); 7 | Actions = [0 1 1;-1 0 1;0 -1 1;1 0 1;0 0 1]; %right,up,left,down,pause,five actions 8 | %pre-assign memory 9 | OPEN_COUNT=1; 10 | MAX_OPEN_SIZE=200; 11 | OPEN=zeros(MAX_OPEN_SIZE,11); 12 | 13 | CLOSED_COUNT=1; 14 | MAX_CLOSED_SIZE=200; 15 | CLOSED=zeros(MAX_CLOSED_SIZE,11); 16 | 17 | %Initialize start node with FValue and open first node. 18 | dist=pdist2(startState,goalState,'cityblock'); 19 | Root(1,1:11)=[startState(1,1) startState(1,2) 0 0 0 0 dist 0 dist 0 1]; %current ST node,parent ST node, F,G,H values,actions,checkedFlag (1=unchecked,0=checked) 20 | OPEN(1,:)=Root; 21 | 22 | while ~isempty(find(OPEN(:,11)==1, 1)) 23 | %best-first search and tie-breaking policy 24 | TEMPOPEN = OPEN(OPEN(:,11)==1,:); 25 | minFScore=min(TEMPOPEN(:,7)); 26 | index = find(TEMPOPEN(:,7)==minFScore); 27 | energy=TEMPOPEN(index,10); 28 | [~,index2] = min(energy,[],1); 29 | currentNodeIndex=index(index2); 30 | currentNode=TEMPOPEN(currentNodeIndex,:); 31 | if all(currentNode(1,1:2)==goalState) 32 | break; 33 | end 34 | 35 | %Removing node from OpenList to ClosedList 36 | [~,temp]=ismember(currentNode,OPEN,'rows'); 37 | OPEN(temp,11) = 0; 38 | CLOSED(CLOSED_COUNT,:) = currentNode; 39 | CLOSED_COUNT=CLOSED_COUNT+1; 40 | for i=1:5 41 | newNode=zeros(1,11); 42 | newNode(1,1:3)=currentNode(1,1:3)+Actions(i,:); 43 | %Ignore the out of borders and obstacles. 44 | if newNode(1,1)<1||newNode(1,1)>height||newNode(1,2)<1||newNode(1,2)>width||MapMat(newNode(1,1),newNode(1,2))==1 45 | continue; 46 | end 47 | 48 | %Ignore the nodes in CLOSED lists. 49 | if ismember(newNode(1,1:3),CLOSED(:,1:3),'rows') 50 | continue; 51 | end 52 | 53 | %Ignore the nodes in constraints lists.including vertex and edge 54 | %conflicts. 55 | currentST(1,1:3)=currentNode(1,1:3); 56 | nextST(1,1:3)=newNode(1,1:3); 57 | edgeConflict1=currentST; 58 | edgeConflict2=nextST; 59 | edgeConflict1(1,3)=nextST(1,3); 60 | edgeConflict2(1,3)=currentST(1,3); 61 | 62 | if ~isempty(constraints) 63 | if ismember(nextST,constraints,'rows') ||(ismember(edgeConflict1,constraints,'rows') && ismember(edgeConflict2,constraints,'rows')) 64 | continue; 65 | end 66 | end 67 | 68 | %Discover a new node and update its tentative F,G,H values 69 | newNode(1,4:6)=currentNode(1,1:3); 70 | dist=pdist2(newNode(1,1:2),goalState,'cityblock'); 71 | newNode(1,7:9)=[dist+currentNode(1,8)+1 currentNode(1,8)+1 dist]; 72 | if i==5 73 | newNode(1,10)=currentNode(1,10); 74 | else 75 | newNode(1,10)=currentNode(1,10)+1; 76 | end 77 | newNode(1,11)=1; 78 | [flag,index]=ismember(newNode(1,1:3),OPEN(:,1:3),'rows'); 79 | if flag==1 % if this node is already in the OPEN list 80 | if newNode(1,7)>OPEN(index,7) 81 | continue; 82 | else 83 | OPEN(index,:)=newNode; 84 | end 85 | else % if this node is not in the OPEN list 86 | OPEN_COUNT=OPEN_COUNT+1; 87 | OPEN(OPEN_COUNT,:)=newNode; 88 | end 89 | end 90 | end 91 | 92 | %backward reconstruct path 93 | k=1; 94 | OptimalPath=zeros(200,3); 95 | while ~all(Root==currentNode) 96 | OptimalPath(k,:)=currentNode(1,1:3); 97 | [~,parentIndex]=ismember(currentNode(1,4:6),CLOSED(:,1:3),'rows'); 98 | currentNode = CLOSED(parentIndex,:); 99 | k=k+1; 100 | end 101 | OptimalPath=OptimalPath(all(OptimalPath,2),:); 102 | OptimalPath=[OptimalPath;Root(1,1:3)]; 103 | OptimalPath=flipud(OptimalPath); 104 | end -------------------------------------------------------------------------------- /MRPP-DT/FlowNetwork.m: -------------------------------------------------------------------------------- 1 | classdef FlowNetwork= 1 && newI <= map.Height && newJ >= 1 && newJ <= map.Width && structure(newI,newJ,newT) ~= 0 75 | newNodeID = structure(newI,newJ,newT); 76 | arcID = arcID + 1; 77 | arcs(arcID,:) = [structure(i,j,t) newNodeID]; 78 | outArcCell{i,j,t} = [outArcCell{i,j,t},arcID]; 79 | inArcCell{newI,newJ,newT} = [inArcCell{newI,newJ,newT},arcID]; 80 | end 81 | end 82 | end 83 | end 84 | end 85 | end 86 | arcs(arcID+1:end,:) = []; 87 | 88 | robotNum = size(startRCT,1); 89 | sourceIDs = zeros(robotNum,1); 90 | sinkIDs = zeros(robotNum,1); 91 | for i=1:robotNum 92 | sourceIDs(i,1) = structure(startRCT(i,1),startRCT(i,2),startRCT(i,3)); 93 | sinkIDs(i,1) = structure(goalRCT(i,1),goalRCT(i,2),T); %notice! 94 | end 95 | 96 | obj.Structure = structure; 97 | obj.Nodes = nodes; 98 | obj.Arcs = arcs; 99 | obj.NodeNum = nodeID; 100 | obj.ArcNum = arcID; 101 | 102 | obj.SourceVec = sourceIDs; 103 | obj.SinkVec = sinkIDs; 104 | 105 | obj.InArcCell = inArcCell; 106 | obj.OutArcCell = outArcCell; 107 | 108 | obj.StartRCT = startRCT; 109 | obj.GoalRCT = goalRCT; 110 | 111 | %% reachability analysis 112 | reachableNodeBoolMat = false(obj.NodeNum,robotNum); % bool matrix 113 | reachableArcBoolMat = false(obj.ArcNum,robotNum); % bool matrix 114 | 115 | for i=1:robotNum 116 | startNode = startRCT(i,:); 117 | goalNode = goalRCT(i,:); 118 | startVertexID = map.VertexIDMat(startNode(1,1),startNode(1,2)); 119 | goalVertexID = map.VertexIDMat(goalNode(1,1),goalNode(1,2)); 120 | for j=1:obj.ArcNum 121 | arc = arcs(j,:); 122 | headNode = nodes(arc(1,1),:); 123 | tailNode = nodes(arc(1,2),:); 124 | headVertexID = map.VertexIDMat(headNode(1,1),headNode(1,2)); 125 | tailVertexID = map.VertexIDMat(tailNode(1,1),tailNode(1,2)); 126 | if ( map.DistMat(headVertexID,startVertexID) <= headNode(1,3)-1 ) && ( map.DistMat(headVertexID,goalVertexID) <= T-headNode(1,3) ) 127 | if ( map.DistMat(tailVertexID,startVertexID) <= tailNode(1,3)-1 ) && ( map.DistMat(tailVertexID,goalVertexID) <= T-tailNode(1,3) ) 128 | reachableArcBoolMat(j,i) = true; 129 | reachableNodeBoolMat(arc(1,1),i) = true; 130 | reachableNodeBoolMat(arc(1,2),i) = true; 131 | end 132 | end 133 | end 134 | end 135 | 136 | [rows,cols] = find(reachableArcBoolMat == true); 137 | obj.ArcRobotPair = [rows,cols]; 138 | obj.ArcRobotPairNum = size(rows,1); 139 | 140 | [C,~,ic] = unique(rows); 141 | obj.UsedArcIDs = C; 142 | obj.UsedArcNum = size(obj.UsedArcIDs,1); 143 | obj.ArcRobotPairinUsedArcs = ic; 144 | 145 | reachableArcMat2 = zeros(arcID,robotNum); 146 | for k=1:obj.ArcRobotPairNum 147 | reachableArcMat2(rows(k,1),cols(k,1)) = k; 148 | end 149 | obj.ReachableArcMat = reachableArcMat2; 150 | obj.ReachableArcBoolMat = reachableArcBoolMat; 151 | obj.ReachableNodeBoolMat = reachableNodeBoolMat; 152 | 153 | obj.getConflictArcsReduced(); 154 | end 155 | 156 | function getConflictArcs(obj) 157 | conflictArcPair = zeros(obj.ArcNum,2); 158 | conflictNum = 0; 159 | flagVec = zeros(obj.ArcNum,1); 160 | for i=1:obj.ArcNum 161 | if flagVec(i,1) == 1 162 | continue; 163 | end 164 | 165 | %(u_t,v_{t+1}),(v_t,u_{t+1}) pair 166 | arc = obj.Arcs(i,:); 167 | nodeU = obj.Nodes(arc(1,1),:); 168 | nodeV = obj.Nodes(arc(1,2),:); 169 | 170 | if nodeU(1,1)==nodeV(1,1) && nodeU(1,2)==nodeV(1,2) 171 | flagVec(i,1) = 1; 172 | continue; 173 | end 174 | 175 | newNodeU = [nodeU(1,1:2),nodeV(1,3)]; 176 | newNodeV = [nodeV(1,1:2),nodeU(1,3)]; 177 | newIDU = obj.Structure(newNodeU(1,1),newNodeU(1,2),newNodeU(1,3)); 178 | newIDV = obj.Structure(newNodeV(1,1),newNodeV(1,2),newNodeV(1,3)); 179 | if newIDU==0 || newIDV==0 180 | flagVec(i,1) = 1; 181 | continue; 182 | end 183 | 184 | newArcIndices = obj.OutArcCell{newNodeV(1,1),newNodeV(1,2),newNodeV(1,3)}; 185 | if ~isempty(newArcIndices) 186 | for j = newArcIndices 187 | arc2 = obj.Arcs(j,:); 188 | if arc2(1,2) == newIDU 189 | conflictNum = conflictNum + 1; 190 | conflictArcPair(conflictNum,:) = [i j]; 191 | flagVec(i,1) = 1; 192 | flagVec(j,1) = 1; 193 | break; 194 | end 195 | end 196 | else 197 | flagVec(i,1) = 1; 198 | end 199 | end 200 | conflictArcPair(conflictNum+1:end,:)=[]; 201 | obj.ConflictArcPair = conflictArcPair; 202 | obj.ConflictNum = conflictNum; 203 | end 204 | 205 | function getConflictArcsReduced(obj) 206 | conflictArcPair = zeros(obj.UsedArcNum,2); 207 | conflictNum = 0; 208 | flagVec = zeros(obj.UsedArcNum,1); 209 | for i=1:obj.UsedArcNum 210 | if flagVec(i,1) == 1 211 | continue; 212 | end 213 | 214 | %(u_t,v_{t+1}),(v_t,u_{t+1}) pair 215 | arcID = obj.UsedArcIDs(i,1); 216 | arc = obj.Arcs(arcID,:); 217 | nodeU = obj.Nodes(arc(1,1),:); 218 | nodeV = obj.Nodes(arc(1,2),:); 219 | 220 | if nodeU(1,1)==nodeV(1,1) && nodeU(1,2)==nodeV(1,2) 221 | flagVec(i,1) = 1; 222 | continue; 223 | end 224 | 225 | newNodeU = [nodeU(1,1:2),nodeV(1,3)]; 226 | newNodeV = [nodeV(1,1:2),nodeU(1,3)]; 227 | newIDU = obj.Structure(newNodeU(1,1),newNodeU(1,2),newNodeU(1,3)); 228 | newIDV = obj.Structure(newNodeV(1,1),newNodeV(1,2),newNodeV(1,3)); 229 | if newIDU==0 || newIDV==0 230 | flagVec(i,1) = 1; 231 | continue; 232 | end 233 | 234 | newArcIndices = obj.OutArcCell{newNodeV(1,1),newNodeV(1,2),newNodeV(1,3)}; 235 | if ~isempty(newArcIndices) 236 | for newArcID = newArcIndices 237 | if ~any(obj.ReachableArcBoolMat(newArcID,:)) 238 | continue; 239 | end 240 | arc2 = obj.Arcs(newArcID,:); 241 | if arc2(1,2) == newIDU 242 | conflictNum = conflictNum + 1; 243 | conflictArcPair(conflictNum,:) = [arcID newArcID]; 244 | flagVec(i,1) = 1; 245 | flagVec(obj.UsedArcIDs == newArcID) = 1; 246 | break; 247 | end 248 | end 249 | else 250 | flagVec(i,1) = 1; 251 | end 252 | end 253 | conflictArcPair(conflictNum+1:end,:)=[]; 254 | obj.ConflictArcPair = conflictArcPair; 255 | obj.ConflictNum = conflictNum; 256 | end 257 | end 258 | end 259 | 260 | -------------------------------------------------------------------------------- /MRPP-DT/MILPModel.m: -------------------------------------------------------------------------------- 1 | classdef MILPModelsimTime 105 | NextRobotStates(i,:)=path(simTime+1,1:3); 106 | end 107 | if NextRobotStates(i,1)==GoalRobotStates(i,1) && NextRobotStates(i,2)==GoalRobotStates(i,2) 108 | TaskStatus(i,1) = 0; 109 | end 110 | end 111 | %continuous simulation 112 | for i=0:intepolate-1 113 | tempRobotStates=CurrentRobotStates+i*(NextRobotStates-CurrentRobotStates)/intepolate; 114 | plotAll(map,simTime,tempRobotStates,GoalRobotStates,ArrivalTime,ColorMat,objectiveSelect); 115 | frame = getframe; 116 | writeVideo(video,frame); 117 | cla; 118 | end 119 | CurrentRobotStates=NextRobotStates; 120 | simTime = simTime+1; 121 | end 122 | 123 | for i = 1:intepolate+10 124 | plotAll(map,simTime,GoalRobotStates,GoalRobotStates,ArrivalTime,ColorMat,objectiveSelect); 125 | pause(0.1); 126 | frame = getframe; 127 | writeVideo(video,frame); 128 | cla; 129 | end 130 | 131 | close(video); -------------------------------------------------------------------------------- /MRPP-DT/main_evaluation_UP.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | objectiveSelect = 7; 4 | printInfo = true; 5 | 6 | load('instances20x20x0%.mat'); 7 | typeNum = 6; 8 | instanceNum = size(InstanceSet,2); 9 | load('Results20x20x0-makespan.mat'); 10 | ResultsMS=Results; 11 | 12 | Results = cell(typeNum,instanceNum); 13 | for typeID = 1:typeNum 14 | for instanceID = 1:instanceNum 15 | instance = InstanceSet{typeID,instanceID}; 16 | fprintf("Solving instance20x20x0-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 17 | msResult = ResultsMS{typeID,instanceID}.Solutions; 18 | result = msResult{1,1}; 19 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,instance.GoalRCT,objectiveSelect,printInfo,result.T); 20 | save('Results20x20x0-up','Results'); 21 | end 22 | end 23 | 24 | load('instances20x20x10%.mat'); 25 | typeNum = 6; 26 | instanceNum = size(InstanceSet,2); 27 | load('Results20x20x10-makespan.mat'); 28 | ResultsMS=Results; 29 | 30 | Results = cell(typeNum,instanceNum); 31 | for typeID = 1:typeNum 32 | for instanceID = 1:instanceNum 33 | instance = InstanceSet{typeID,instanceID}; 34 | fprintf("Solving instance20x20x10-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 35 | msResult = ResultsMS{typeID,instanceID}.Solutions; 36 | result = msResult{1,1}; 37 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,instance.GoalRCT,objectiveSelect,printInfo,result.T); 38 | save('Results20x20x10-up','Results'); 39 | end 40 | end 41 | 42 | load('instances20x20x20%.mat'); 43 | typeNum = 6; 44 | instanceNum = size(InstanceSet,2); 45 | load('Results20x20x20-makespan.mat'); 46 | ResultsMS=Results; 47 | 48 | Results = cell(typeNum,instanceNum); 49 | for typeID = 1:typeNum 50 | for instanceID = 1:instanceNum 51 | instance = InstanceSet{typeID,instanceID}; 52 | fprintf("Solving instance20x20x20-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 53 | msResult = ResultsMS{typeID,instanceID}.Solutions; 54 | result = msResult{1,1}; 55 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,instance.GoalRCT,objectiveSelect,printInfo,result.T); 56 | save('Results20x20x20-up','Results'); 57 | end 58 | end -------------------------------------------------------------------------------- /MRPP-DT/main_evaluation_lateness.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | objectiveSelect = 5; 4 | printInfo = true; 5 | 6 | load('instances20x20x0%.mat'); 7 | typeNum = 6; 8 | instanceNum = size(InstanceSet,2); 9 | load('Results20x20x0-makespan.mat'); 10 | ResultsMS=Results; 11 | 12 | Results = cell(typeNum,instanceNum); 13 | for typeID = 1:typeNum 14 | for instanceID = 1:instanceNum 15 | instance = InstanceSet{typeID,instanceID}; 16 | fprintf("Solving instance20x20x0-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 17 | msResult = ResultsMS{typeID,instanceID}.Solutions; 18 | result = msResult{1,1}; 19 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,instance.GoalRCT,objectiveSelect,printInfo,result.T); 20 | save('Results20x20x0-lateness','Results'); 21 | end 22 | end 23 | 24 | load('instances20x20x10%.mat'); 25 | typeNum = 6; 26 | instanceNum = size(InstanceSet,2); 27 | load('Results20x20x10-makespan.mat'); 28 | ResultsMS=Results; 29 | 30 | Results = cell(typeNum,instanceNum); 31 | for typeID = 1:typeNum 32 | for instanceID = 1:instanceNum 33 | instance = InstanceSet{typeID,instanceID}; 34 | fprintf("Solving instance20x20x10-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 35 | msResult = ResultsMS{typeID,instanceID}.Solutions; 36 | result = msResult{1,1}; 37 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,instance.GoalRCT,objectiveSelect,printInfo,result.T); 38 | save('Results20x20x10-lateness','Results'); 39 | end 40 | end 41 | 42 | load('instances20x20x20%.mat'); 43 | typeNum = 6; 44 | instanceNum = size(InstanceSet,2); 45 | load('Results20x20x20-makespan.mat'); 46 | ResultsMS=Results; 47 | 48 | Results = cell(typeNum,instanceNum); 49 | for typeID = 1:typeNum 50 | for instanceID = 1:instanceNum 51 | instance = InstanceSet{typeID,instanceID}; 52 | fprintf("Solving instance20x20x20-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 53 | msResult = ResultsMS{typeID,instanceID}.Solutions; 54 | result = msResult{1,1}; 55 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,instance.GoalRCT,objectiveSelect,printInfo,result.T); 56 | save('Results20x20x20-lateness','Results'); 57 | end 58 | end -------------------------------------------------------------------------------- /MRPP-DT/main_evaluation_makespan.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | objectiveSelect = 0; 4 | printInfo = true; 5 | 6 | load('instances20x20x0%.mat'); 7 | typeNum = size(InstanceSet,1); 8 | typeNum = 6; 9 | instanceNum = size(InstanceSet,2); 10 | Results = cell(typeNum,instanceNum); 11 | for typeID = 1:typeNum 12 | for instanceID = 1:instanceNum 13 | instance = InstanceSet{typeID,instanceID}; 14 | fprintf("Solving instance20x20x0-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 15 | tic; 16 | result.Solutions = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,instance.GoalRCT,objectiveSelect,printInfo,0); 17 | result.ComputeTime = toc; 18 | Results{typeID,instanceID} = result; 19 | fprintf("Compute Time is %f\n",result.ComputeTime); 20 | save('Results20x20x0-makespan','Results'); 21 | end 22 | end 23 | 24 | load('instances20x20x10%.mat'); 25 | typeNum = size(InstanceSet,1); 26 | typeNum = 6; 27 | instanceNum = size(InstanceSet,2); 28 | Results = cell(typeNum,instanceNum); 29 | for typeID = 1:typeNum 30 | for instanceID = 1:instanceNum 31 | instance = InstanceSet{typeID,instanceID}; 32 | fprintf("Solving instance20x20x10-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 33 | tic; 34 | result.Solutions = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,instance.GoalRCT,objectiveSelect,printInfo,0); 35 | result.ComputeTime = toc; 36 | Results{typeID,instanceID} = result; 37 | fprintf("Compute Time is %f\n",result.ComputeTime); 38 | save('Results20x20x10-makespan','Results'); 39 | end 40 | end 41 | 42 | load('instances20x20x20%.mat'); 43 | typeNum = size(InstanceSet,1); 44 | typeNum = 6; 45 | instanceNum = size(InstanceSet,2); 46 | Results = cell(typeNum,instanceNum); 47 | for typeID = 1:typeNum 48 | for instanceID = 1:instanceNum 49 | instance = InstanceSet{typeID,instanceID}; 50 | fprintf("Solving instance20x20x20-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 51 | tic; 52 | result.Solutions = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,instance.GoalRCT,objectiveSelect,printInfo,0); 53 | result.ComputeTime = toc; 54 | Results{typeID,instanceID} = result; 55 | fprintf("Compute Time is %f\n",result.ComputeTime); 56 | save('Results20x20x20-makespan','Results'); 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /MRPP-DT/main_evaluation_tardiness.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | objectiveSelect = 6; 4 | printInfo = true; 5 | 6 | load('instances20x20x0%.mat'); 7 | typeNum = 6; 8 | instanceNum = size(InstanceSet,2); 9 | load('Results20x20x0-makespan.mat'); 10 | ResultsMS=Results; 11 | 12 | Results = cell(typeNum,instanceNum); 13 | for typeID = 1:typeNum 14 | for instanceID = 1:instanceNum 15 | instance = InstanceSet{typeID,instanceID}; 16 | fprintf("Solving instance20x20x0-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 17 | msResult = ResultsMS{typeID,instanceID}.Solutions; 18 | result = msResult{1,1}; 19 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,instance.GoalRCT,objectiveSelect,printInfo,result.T); 20 | save('Results20x20x0-tardiness','Results'); 21 | end 22 | end 23 | 24 | load('instances20x20x10%.mat'); 25 | typeNum = 6; 26 | instanceNum = size(InstanceSet,2); 27 | load('Results20x20x10-makespan.mat'); 28 | ResultsMS=Results; 29 | 30 | Results = cell(typeNum,instanceNum); 31 | for typeID = 1:typeNum 32 | for instanceID = 1:instanceNum 33 | instance = InstanceSet{typeID,instanceID}; 34 | fprintf("Solving instance20x20x10-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 35 | msResult = ResultsMS{typeID,instanceID}.Solutions; 36 | result = msResult{1,1}; 37 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,instance.GoalRCT,objectiveSelect,printInfo,result.T); 38 | save('Results20x20x10-tardiness','Results'); 39 | end 40 | end 41 | 42 | load('instances20x20x20%.mat'); 43 | typeNum = 6; 44 | instanceNum = size(InstanceSet,2); 45 | load('Results20x20x20-makespan.mat'); 46 | ResultsMS=Results; 47 | 48 | Results = cell(typeNum,instanceNum); 49 | for typeID = 1:typeNum 50 | for instanceID = 1:instanceNum 51 | instance = InstanceSet{typeID,instanceID}; 52 | fprintf("Solving instance20x20x20-%d-%d with robot number %d\n",typeID,instanceID,instance.RobotNum); 53 | msResult = ResultsMS{typeID,instanceID}.Solutions; 54 | result = msResult{1,1}; 55 | Results{typeID,instanceID} = MRPP(instance.RobotNum,instance.Map,instance.StartRCT,instance.GoalRCT,objectiveSelect,printInfo,result.T); 56 | save('Results20x20x20-tardiness','Results'); 57 | end 58 | end -------------------------------------------------------------------------------- /MRPP-DT/map18x24x0%.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/map18x24x0%.mat -------------------------------------------------------------------------------- /MRPP-DT/map18x24x10%.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/map18x24x10%.mat -------------------------------------------------------------------------------- /MRPP-DT/map18x24x20%.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/map18x24x20%.mat -------------------------------------------------------------------------------- /MRPP-DT/map20x20x0%.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/map20x20x0%.mat -------------------------------------------------------------------------------- /MRPP-DT/map20x20x10%.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/map20x20x10%.mat -------------------------------------------------------------------------------- /MRPP-DT/map20x20x20%.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/map20x20x20%.mat -------------------------------------------------------------------------------- /MRPP-DT/map2x3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/map2x3.mat -------------------------------------------------------------------------------- /MRPP-DT/plotAll.m: -------------------------------------------------------------------------------- 1 | function plotAll(map,simT,RobotStates,GoalStates,ArrivalTime,ColorMat,objectiveSelect) 2 | robotMarkerSize = 18; 3 | obstacleMarkerSize = 36; 4 | fontSize = 13; 5 | 6 | height = map.Height; 7 | width = map.Width; 8 | robotNum=size(RobotStates,1); 9 | 10 | rectangle('Position', [0,0,width,height],'lineWidth',5); 11 | hold on; 12 | [I,J] = find(map.MapGrid==1); 13 | tempMat = [I J]; 14 | obstacles = tempMat; 15 | obstacles(:,1) = tempMat(:,2)-0.5; 16 | obstacles(:,2) = height+1-tempMat(:,1)-0.5; 17 | 18 | robotXY = RobotStates; 19 | robotXY(:,1) = RobotStates(:,2)-0.5; 20 | robotXY(:,2) = height+1-RobotStates(:,1)-0.5; 21 | 22 | goalXY = GoalStates; 23 | goalXY(:,1) = GoalStates(:,2)-0.5; 24 | goalXY(:,2) = height+1-GoalStates(:,1)-0.5; 25 | 26 | plot(obstacles(:,1),obstacles(:,2),'square','MarkerEdgeColor','k','MarkerFaceColor',[0 0 0],'MarkerSize',obstacleMarkerSize); 27 | hold on; 28 | 29 | % to avoid overlap 30 | for i=1:robotNum 31 | plot(goalXY(i,1),goalXY(i,2),'o','MarkerEdgeColor',ColorMat(i,:),'MarkerFaceColor',[1 1 1],'MarkerSize',robotMarkerSize,'LineWidth',2); 32 | txt=sprintf('d_{%d}=%d',i,goalXY(i,3)-1); 33 | text(goalXY(i,1),goalXY(i,2)+0.6,txt,'FontWeight','Bold','FontSize',fontSize-4,'HorizontalAlignment','center','Color',ColorMat(i,:)); 34 | txt=sprintf('%d',i); 35 | text(goalXY(i,1),goalXY(i,2),txt,'FontWeight','Bold','FontSize',fontSize,'HorizontalAlignment','center','Color',ColorMat(i,:)); 36 | hold on; 37 | end 38 | 39 | % for i=1:robotNum 40 | % plot(goalXY(i,1),goalXY(i,2),'o','MarkerEdgeColor',[0 0 0],'MarkerFaceColor',[1 1 1],'MarkerSize',robotMarkerSize,'LineWidth',2); 41 | % txt=sprintf('d_{%d}=%d',i,goalXY(i,3)-1); 42 | % text(goalXY(i,1),goalXY(i,2)+0.6,txt,'FontWeight','Bold','FontSize',fontSize-4,'HorizontalAlignment','center','Color',[0 0 0]); 43 | % hold on; 44 | % end 45 | 46 | for i=1:robotNum 47 | plot(robotXY(i,1),robotXY(i,2),'o','MarkerEdgeColor',ColorMat(i,:),'MarkerFaceColor',ColorMat(i,:),'MarkerSize',robotMarkerSize,'LineWidth',2); 48 | if ArrivalTime(i,1)<=simT 49 | 50 | switch objectiveSelect 51 | case 0 52 | txt=sprintf('τ_{%d}=%d',i,ArrivalTime(i,1)-1); 53 | case 1 54 | txt=sprintf('τ_{%d}=%d',i,ArrivalTime(i,1)-1); 55 | case 2 56 | txt=sprintf('τ_{%d}=%d',i,ArrivalTime(i,1)-1); 57 | case 5 58 | txt=sprintf('L_{%d}=%d',i,ArrivalTime(i,1)-goalXY(i,3)); 59 | case 6 60 | txt=sprintf('H_{%d}=%d',i,abs(ArrivalTime(i,1)-goalXY(i,3))); 61 | case 7 62 | if ArrivalTime(i,1)==goalXY(i,3)+1 63 | temp = 1; 64 | else 65 | temp = 0; 66 | end 67 | txt=sprintf('U_{%d}=%d',i,temp); 68 | end 69 | text(goalXY(i,1),goalXY(i,2)-0.6,txt,'FontWeight','Bold','FontSize',fontSize-4,'HorizontalAlignment','center','Color',ColorMat(i,:)); 70 | end 71 | txt=sprintf('%d',i); 72 | text(robotXY(i,1),robotXY(i,2),txt,'FontWeight','Bold','FontSize',fontSize,'HorizontalAlignment','center','Color',[1 1 1]); 73 | hold on; 74 | end 75 | 76 | end 77 | 78 | -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/Results20x20x0-lateness.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/results&analysis/Results20x20x0-lateness.mat -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/Results20x20x0-makespan.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/results&analysis/Results20x20x0-makespan.mat -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/Results20x20x0-tardiness.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/results&analysis/Results20x20x0-tardiness.mat -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/Results20x20x0-up.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/results&analysis/Results20x20x0-up.mat -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/Results20x20x10-lateness.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/results&analysis/Results20x20x10-lateness.mat -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/Results20x20x10-makespan.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/results&analysis/Results20x20x10-makespan.mat -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/Results20x20x10-tardiness.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/results&analysis/Results20x20x10-tardiness.mat -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/Results20x20x10-up.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/results&analysis/Results20x20x10-up.mat -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/Results20x20x20-lateness.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/results&analysis/Results20x20x20-lateness.mat -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/Results20x20x20-makespan.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/results&analysis/Results20x20x20-makespan.mat -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/Results20x20x20-tardiness.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/results&analysis/Results20x20x20-tardiness.mat -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/Results20x20x20-up.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangHanfu/Multi-Robot-Path-Planning-with-Due-Times/83c3763c596bd561769ac206c9e28740c87d85ab/MRPP-DT/results&analysis/Results20x20x20-up.mat -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/plotLateness.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | %% makespan 4 | largeNumber = 10000000; 5 | load('Results20x20x0-lateness.mat'); 6 | [valueMat,timeMat] = statistics(Results); 7 | y = zeros(1,6); 8 | for i=1:6 9 | vec = valueMat(i,:); 10 | vec(vec==largeNumber)=[]; 11 | if ~isempty(vec) && length(vec)>=15 12 | y(1,i) = mean(vec); 13 | elseif length(vec)<15 14 | disp("cannot solve 3/4 instances"); 15 | y(1,i) = largeNumber; 16 | elseif isempty(vec) 17 | disp("empty value"); 18 | y(1,i) = largeNumber; 19 | end 20 | end 21 | y1 = y; 22 | 23 | timeMat = timeMat'; 24 | t1 = mean(timeMat); 25 | 26 | load('Results20x20x10-lateness.mat'); 27 | [valueMat,timeMat] = statistics(Results); 28 | y = zeros(1,6); 29 | for i=1:6 30 | vec = valueMat(i,:); 31 | vec(vec==largeNumber)=[]; 32 | if ~isempty(vec) && length(vec)>=15 33 | y(1,i) = mean(vec); 34 | elseif length(vec)<15 35 | disp("cannot solve 3/4 instances"); 36 | y(1,i) = largeNumber; 37 | elseif isempty(vec) 38 | disp("empty value"); 39 | y(1,i) = largeNumber; 40 | end 41 | end 42 | y2 = y; 43 | 44 | timeMat = timeMat'; 45 | t2 = mean(timeMat); 46 | 47 | load('Results20x20x20-lateness.mat'); 48 | [valueMat,timeMat] = statistics(Results); 49 | y = zeros(1,6); 50 | for i=1:6 51 | vec = valueMat(i,:); 52 | vec(vec==largeNumber)=[]; 53 | if ~isempty(vec) && length(vec)>=15 54 | y(1,i) = mean(vec); 55 | elseif length(vec)<15 56 | disp("cannot solve 3/4 instances"); 57 | y(1,i) = largeNumber; 58 | elseif isempty(vec) 59 | disp("empty value"); 60 | y(1,i) = largeNumber; 61 | end 62 | end 63 | y3 = y; 64 | 65 | timeMat = timeMat'; 66 | t3 = mean(timeMat); 67 | 68 | 69 | figure(1); 70 | set(gca,'xtick',0:10:60); 71 | x=10:10:60; 72 | span = 6; 73 | plot(x(1,1:span),y1(1,1:span),'-ro','MarkerFaceColor','red'); 74 | hold on; 75 | span = 5; 76 | plot(x(1,1:span),y2(1,1:span),'-gd','MarkerFaceColor','green'); 77 | hold on; 78 | span = 5; 79 | plot(x(1,1:span),y3(1,1:span),'-bs','MarkerFaceColor','blue'); 80 | grid on; 81 | set(gca,'xtick',0:10:60); 82 | legend('0','10%','20%','Location','northwest','FontSize',12); 83 | 84 | figure(2); 85 | set(gca,'xtick',0:10:60); 86 | x=10:10:60; 87 | span = 6; 88 | semilogy(x(1,1:span),t1(1,1:span),'-ro','MarkerFaceColor','red'); 89 | %plot(x(1,1:span),t1(1,1:span),'-ro','MarkerFaceColor','red'); 90 | hold on; 91 | span = 5; 92 | semilogy(x(1,1:span),t2(1,1:span),'-gd','MarkerFaceColor','green'); 93 | %plot(x(1,1:span),t2(1,1:span),'-gd','MarkerFaceColor','green'); 94 | hold on; 95 | span = 5; 96 | semilogy(x(1,1:span),t3(1,1:span),'-bs','MarkerFaceColor','blue'); 97 | %plot(x(1,1:span),t3(1,1:span),'-bs','MarkerFaceColor','blue'); 98 | grid on; 99 | set(gca,'xtick',0:10:60); 100 | legend('0','10%','20%','Location','northwest','FontSize',12); -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/plotTardiness.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | %% makespan 4 | largeNumber = 10000000; 5 | load('Results20x20x0-tardiness.mat'); 6 | [valueMat,timeMat] = statistics(Results); 7 | y = zeros(1,6); 8 | for i=1:6 9 | vec = valueMat(i,:); 10 | vec(vec==largeNumber)=[]; 11 | if ~isempty(vec) && length(vec)>=15 12 | y(1,i) = mean(vec); 13 | elseif length(vec)<15 14 | disp("cannot solve 3/4 instances"); 15 | y(1,i) = largeNumber; 16 | elseif isempty(vec) 17 | disp("empty value"); 18 | y(1,i) = largeNumber; 19 | end 20 | end 21 | y1 = y; 22 | 23 | timeMat = timeMat'; 24 | t1 = mean(timeMat); 25 | 26 | load('Results20x20x10-tardiness.mat'); 27 | [valueMat,timeMat] = statistics(Results); 28 | y = zeros(1,6); 29 | for i=1:6 30 | vec = valueMat(i,:); 31 | vec(vec==largeNumber)=[]; 32 | if ~isempty(vec) && length(vec)>=15 33 | y(1,i) = mean(vec); 34 | elseif length(vec)<15 35 | disp("cannot solve 3/4 instances"); 36 | y(1,i) = largeNumber; 37 | elseif isempty(vec) 38 | disp("empty value"); 39 | y(1,i) = largeNumber; 40 | end 41 | end 42 | y2 = y; 43 | 44 | timeMat = timeMat'; 45 | t2 = mean(timeMat); 46 | 47 | load('Results20x20x20-tardiness.mat'); 48 | [valueMat,timeMat] = statistics(Results); 49 | y = zeros(1,6); 50 | for i=1:6 51 | vec = valueMat(i,:); 52 | vec(vec==largeNumber)=[]; 53 | if ~isempty(vec) && length(vec)>=15 54 | y(1,i) = mean(vec); 55 | elseif length(vec)<15 56 | disp("cannot solve 3/4 instances"); 57 | y(1,i) = largeNumber; 58 | elseif isempty(vec) 59 | disp("empty value"); 60 | y(1,i) = largeNumber; 61 | end 62 | end 63 | y3 = y; 64 | 65 | timeMat = timeMat'; 66 | t3 = mean(timeMat); 67 | 68 | 69 | figure(1); 70 | set(gca,'xtick',0:10:60); 71 | x=10:10:60; 72 | span = 6; 73 | plot(x(1,1:span),y1(1,1:span),'-ro','MarkerFaceColor','red'); 74 | hold on; 75 | span = 6; 76 | plot(x(1,1:span),y2(1,1:span),'-gd','MarkerFaceColor','green'); 77 | hold on; 78 | span = 6; 79 | plot(x(1,1:span),y3(1,1:span),'-bs','MarkerFaceColor','blue'); 80 | grid on; 81 | set(gca,'xtick',0:10:60); 82 | legend('0','10%','20%','Location','northwest','FontSize',12); 83 | 84 | figure(2); 85 | set(gca,'xtick',0:10:60); 86 | x=10:10:60; 87 | span = 6; 88 | semilogy(x(1,1:span),t1(1,1:span),'-ro','MarkerFaceColor','red'); 89 | %plot(x(1,1:span),t1(1,1:span),'-ro','MarkerFaceColor','red'); 90 | hold on; 91 | span = 6; 92 | semilogy(x(1,1:span),t2(1,1:span),'-gd','MarkerFaceColor','green'); 93 | %plot(x(1,1:span),t2(1,1:span),'-gd','MarkerFaceColor','green'); 94 | hold on; 95 | span = 6; 96 | semilogy(x(1,1:span),t3(1,1:span),'-bs','MarkerFaceColor','blue'); 97 | %plot(x(1,1:span),t3(1,1:span),'-bs','MarkerFaceColor','blue'); 98 | grid on; 99 | set(gca,'xtick',0:10:60); 100 | legend('0','10%','20%','Location','northwest','FontSize',12); -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/plotUP.m: -------------------------------------------------------------------------------- 1 | clear; 2 | clc; 3 | %% makespan 4 | largeNumber = 10000000; 5 | load('Results20x20x0-up.mat'); 6 | [valueMat,timeMat] = statistics(Results); 7 | y = zeros(1,6); 8 | for i=1:6 9 | vec = valueMat(i,:); 10 | vec(vec==largeNumber)=[]; 11 | if ~isempty(vec) && length(vec)>=15 12 | y(1,i) = mean(vec); 13 | elseif length(vec)<15 14 | disp("cannot solve 3/4 instances"); 15 | y(1,i) = largeNumber; 16 | elseif isempty(vec) 17 | disp("empty value"); 18 | y(1,i) = largeNumber; 19 | end 20 | end 21 | y1 = y; 22 | 23 | timeMat = timeMat'; 24 | t1 = mean(timeMat); 25 | 26 | load('Results20x20x10-up.mat'); 27 | [valueMat,timeMat] = statistics(Results); 28 | y = zeros(1,6); 29 | for i=1:6 30 | vec = valueMat(i,:); 31 | vec(vec==largeNumber)=[]; 32 | if ~isempty(vec) && length(vec)>=15 33 | y(1,i) = mean(vec); 34 | elseif length(vec)<15 35 | disp("cannot solve 3/4 instances"); 36 | y(1,i) = largeNumber; 37 | elseif isempty(vec) 38 | disp("empty value"); 39 | y(1,i) = largeNumber; 40 | end 41 | end 42 | y2 = y; 43 | 44 | timeMat = timeMat'; 45 | t2 = mean(timeMat); 46 | 47 | load('Results20x20x20-up.mat'); 48 | [valueMat,timeMat] = statistics(Results); 49 | y = zeros(1,6); 50 | for i=1:6 51 | vec = valueMat(i,:); 52 | vec(vec==largeNumber)=[]; 53 | if ~isempty(vec) && length(vec)>=15 54 | y(1,i) = mean(vec); 55 | elseif length(vec)<15 56 | disp("cannot solve 3/4 instances"); 57 | y(1,i) = largeNumber; 58 | elseif isempty(vec) 59 | disp("empty value"); 60 | y(1,i) = largeNumber; 61 | end 62 | end 63 | y3 = y; 64 | 65 | timeMat = timeMat'; 66 | t3 = mean(timeMat); 67 | 68 | 69 | figure(1); 70 | set(gca,'xtick',0:10:60); 71 | x=10:10:60; 72 | span = 5; 73 | plot(x(1,1:span),y1(1,1:span),'-ro','MarkerFaceColor','red'); 74 | hold on; 75 | span = 5; 76 | plot(x(1,1:span),y2(1,1:span),'-gd','MarkerFaceColor','green'); 77 | hold on; 78 | span = 6; 79 | plot(x(1,1:span),y3(1,1:span),'-bs','MarkerFaceColor','blue'); 80 | grid on; 81 | set(gca,'xtick',0:10:60); 82 | legend('0','10%','20%','Location','northwest','FontSize',12); 83 | 84 | figure(2); 85 | set(gca,'xtick',0:10:60); 86 | x=10:10:60; 87 | span = 5; 88 | semilogy(x(1,1:span),t1(1,1:span),'-ro','MarkerFaceColor','red'); 89 | %plot(x(1,1:span),t1(1,1:span),'-ro','MarkerFaceColor','red'); 90 | hold on; 91 | span = 5; 92 | semilogy(x(1,1:span),t2(1,1:span),'-gd','MarkerFaceColor','green'); 93 | %plot(x(1,1:span),t2(1,1:span),'-gd','MarkerFaceColor','green'); 94 | hold on; 95 | span = 6; 96 | semilogy(x(1,1:span),t3(1,1:span),'-bs','MarkerFaceColor','blue'); 97 | %plot(x(1,1:span),t3(1,1:span),'-bs','MarkerFaceColor','blue'); 98 | grid on; 99 | set(gca,'xtick',0:10:60); 100 | legend('0','10%','20%','Location','northwest','FontSize',12); -------------------------------------------------------------------------------- /MRPP-DT/results&analysis/statistics.m: -------------------------------------------------------------------------------- 1 | function [valueMat,timeMat] = statistics(results) 2 | largeNumber = 10000000; 3 | typeSize = size(results,1); 4 | instanceSize = size(results,2); 5 | valueMat = zeros(typeSize,instanceSize); 6 | timeMat = zeros(typeSize,instanceSize); 7 | for i=1:typeSize 8 | for j=1:instanceSize 9 | result = results{i,j}; 10 | vecLen = size(result,1); 11 | valueVec = zeros(vecLen,1); 12 | timeVec = zeros(vecLen,1); 13 | for k=1:vecLen 14 | temp = result{k,1}; 15 | timeVec(k,1)=temp.ComputeTime; 16 | if ~isempty(temp.ObjectiveValue) 17 | valueVec(k,1)=temp.ObjectiveValue; 18 | else 19 | valueVec(k,1)=largeNumber; 20 | end 21 | end 22 | valueVec(valueVec==largeNumber)=[]; 23 | if ~isempty(valueVec) 24 | valueMat(i,j) = min(valueVec); 25 | else 26 | valueMat(i,j) = largeNumber; 27 | end 28 | timeMat(i,j) = sum(timeVec); 29 | end 30 | end 31 | 32 | end 33 | 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Multi-Robot-Path-Planning-with-Due-Times 2 | MATLAB source codes, dataset and raw data for IEEE RA-L paper "Multi-Robot Path Planning with Due Times" [1]. 3 | 4 | In this paper, the problem of multi-robot path planning with due times is proposed, and solved completely using reduction-based methods. This reduction-based methdology is firstly proposed in [2]. The problem of anonymous multi-robot path planning with due times is also studied. 5 | 6 | 7 | Interested readers could do the following. 8 | 9 | 1. The default ILP solver is Gurobi. Other solvers are also possible with some minor modifications, including the MATLAB self-contained linear programming solvers. 10 | 11 | 2. For multi-robot path planning on graph problems, Yu [2] provides a Java realization of the reduction-based algorithms. In contrast, my Matlab realization is easily understood. I have leave some space for expansion to makespan, total travel time, maximum distance and total distance objectives. 12 | 13 | 3. Interested readers can also try to use my source codes using the open source Octave instead with minor changes. 14 | 15 | 16 | 17 | 18 | ************************************************************************************************************************************************ 19 | 20 | [1] Wang Hanfu and Chen Weidong, "Multi-Robot Path Planning with Due Times." IEEE Robotics and Automation Letters. 21 | 22 | [2] Yu, Jingjin, and Steven M. LaValle. "Optimal multirobot path planning on graphs: Complete algorithms and effective heuristics." IEEE Transactions on Robotics 32.5 (2016): 1163-1177. 23 | --------------------------------------------------------------------------------