-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateBaseStationSimple.m
More file actions
39 lines (33 loc) · 1015 Bytes
/
createBaseStationSimple.m
File metadata and controls
39 lines (33 loc) · 1015 Bytes
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
% createBaseStation
% creates the start and end point for the tour (the base station) with edge
% cost close to zero
% INPUTS
% v_Cluster = v_Cluster for GTSP solver without base station
% v_Adj = v_Adj for GTSP solver without base station
% alpha = allows for correct cost for base station
% beta = allows for correct cost for base station
% numPoints = number of nodes in a graph
% numLevels = number of battery levels in a graph
% OUTPUTS
% v_Cluster = v_Cluster for GTSP solver with base station
% v_Adj = v_Adj for GTSP solver with base station
function [v_Adj] = createBaseStationSimple(v_Adj, numPoints, numLevels)
numInV_Adj = numel(v_Adj);
for i = 1:numInV_Adj
if v_Adj(i) == 0;
v_Adj(i) = -1;
end
end
v_Adj(:, end+1) = 0;
totalPoints = numPoints*numLevels;
tempCostArray = [];
for i = 1:totalPoints
if mod(i, numLevels) == 1
tempCostArray(end+1) = 0;
else
tempCostArray(end+1) = -1;
end
end
tempCostArray(end+1) = -1;
v_Adj(end+1, :) = tempCostArray';
end