-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgenerateInstances.m
56 lines (44 loc) · 1.55 KB
/
generateInstances.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
clear;
clc;
robotNum=13;
instanceNumber = 50;
% StartRobotStates,GoalRobotStates,idealTotalTime
InstanceSet = cell(instanceNumber,3);
%% map parameters and create map
height=7;
width=14;
rackLength = 10;
rackNumVec = [3 1];
aisleWidth = 2;
crossAisleWidth = 1;
topLeftRC = [1 3];
[mapGrid,PodStates,PickupStationStates,DeliveryStationStates,StartStates] = createMap(width,height,rackLength,rackNumVec,aisleWidth,crossAisleWidth,topLeftRC);
%% generate instance set
for instanceCount=1:instanceNumber
vec = randperm(size(PickupStationStates,1));
TaskSet = zeros(size(PickupStationStates,1),3);
for i=1:size(PickupStationStates,1)
TaskSet(i,1:3)=PickupStationStates(vec(i),:);
end
taskIndex = 1;
StartRobotStates = zeros(robotNum,3);
for i=1:robotNum
StartRobotStates(i,:)=TaskSet(taskIndex,1:3);
taskIndex = taskIndex+1;
end
GoalRobotStates = zeros(robotNum,3);
for i=1:robotNum
GoalRobotStates(i,:)=TaskSet(taskIndex,1:3);
taskIndex = taskIndex+1;
end
idealTotalTime = 0;
for i=1:robotNum
path = singlePlanner(mapGrid,StartRobotStates(i,:),GoalRobotStates(i,:),1,[]);
idealTotalTime = idealTotalTime + size(path,1);
end
InstanceSet{instanceCount,1}=StartRobotStates;
InstanceSet{instanceCount,2}=GoalRobotStates;
InstanceSet{instanceCount,3}=idealTotalTime;
end
ColorMat=rand(robotNum,3);
save('instance-small-13.mat','robotNum','ColorMat','InstanceSet','mapGrid');