|
16 | 16 |
|
17 | 17 | public class CoboltEvaluationExecutor extends AbstractTopologyControlReconfigurationExecutor {
|
18 | 18 |
|
| 19 | + private static final double MOVEMENT_SPEED_PEDESTRIAN = 1.4; |
| 20 | + private static final double MOVEMENT_SPEED_STATIC = 0.0; |
| 21 | + private static final String EXECUTOR_EXTENDED = "extended"; |
| 22 | + private static final String EXECUTOR_DEFAULT = "default"; |
19 | 23 | private static final int WORLD_SIZE_SMALL = 300;
|
20 | 24 | private static final int WORLD_SIZE_MEDIUM = 600;
|
21 | 25 | private static final int WORLD_SIZE_LARGE = 900;
|
@@ -43,28 +47,41 @@ public CoboltEvaluationExecutor() {
|
43 | 47 |
|
44 | 48 | @Override
|
45 | 49 | protected List<String> getSupportedExecutors() {
|
46 |
| - return Arrays.asList("default"); |
| 50 | + return Arrays.asList(EXECUTOR_DEFAULT, EXECUTOR_EXTENDED); |
47 | 51 | }
|
48 | 52 |
|
49 | 53 | @Override
|
50 | 54 | protected List<TopologyControlComponentConfig> generateSimulationConfigurations() {
|
| 55 | + switch (this.getExecutor()) { |
| 56 | + case EXECUTOR_DEFAULT: |
| 57 | + return getDefaultEvaluationConfigurations(); |
| 58 | + case EXECUTOR_EXTENDED: |
| 59 | + return getExtendedEvaluationConfigurations(); |
| 60 | + default: |
| 61 | + throw new IllegalArgumentException("Unsupported executor chosen: " + this.getExecutor()); |
| 62 | + } |
| 63 | + } |
| 64 | + |
| 65 | + private List<TopologyControlComponentConfig> getDefaultEvaluationConfigurations() { |
51 | 66 | final List<TopologyControlComponentConfig> configs = new ArrayList<>();
|
52 | 67 | final List<ScenarioType> scenarioTypes = Arrays.asList(ScenarioType.DATACOLLECTION);
|
53 | 68 | for (final ScenarioType scenario : scenarioTypes) {
|
54 | 69 |
|
55 | 70 | final Object[][] nodeCountsPlusWorldSizesPlusSeeds = { //
|
56 |
| - // { 99, 100, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
57 |
| - // { 99, 200, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) |
| 71 | + // { MOTE_COUNT_FEW, 100, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
| 72 | + // { MOTE_COUNT_FEW, 200, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) |
58 | 73 | // }, //
|
59 | 74 | { MOTE_COUNT_FEW, WORLD_SIZE_SMALL, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, //
|
60 | 75 | { MOTE_COUNT_MANY, WORLD_SIZE_SMALL, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, //
|
61 |
| - // { 99, 400, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
62 |
| - // { 99, 500, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
| 76 | + // { MOTE_COUNT_FEW, 400, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
| 77 | + // { MOTE_COUNT_FEW, 500, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
63 | 78 | { MOTE_COUNT_FEW, WORLD_SIZE_MEDIUM, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, //
|
64 | 79 | { MOTE_COUNT_MANY, WORLD_SIZE_MEDIUM, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, //
|
65 |
| - // { 99, 700, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 15, 16, 17, 18, |
| 80 | + // { MOTE_COUNT_FEW, 700, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 15, |
| 81 | + // 16, 17, 18, |
66 | 82 | // 19, 20) }, //
|
67 |
| - // { 99, 800, Arrays.asList(2, 4, 5, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) |
| 83 | + // { MOTE_COUNT_FEW, 800, Arrays.asList(2, 4, 5, 10, 11, 12, 13, 14, 15, 16, 17, |
| 84 | + // 18, 19, 20) |
68 | 85 | // }, //
|
69 | 86 | { MOTE_COUNT_FEW, WORLD_SIZE_LARGE, Arrays.asList(4, 11, 12, 13, 16, 19, 22, 27, 35, 38) }, //
|
70 | 87 | { MOTE_COUNT_MANY, WORLD_SIZE_LARGE, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, //
|
@@ -154,4 +171,128 @@ protected List<TopologyControlComponentConfig> generateSimulationConfigurations(
|
154 | 171 | return configs;
|
155 | 172 | }
|
156 | 173 |
|
| 174 | + private List<TopologyControlComponentConfig> getExtendedEvaluationConfigurations() { |
| 175 | + final List<TopologyControlComponentConfig> configs = new ArrayList<>(); |
| 176 | + final List<ScenarioType> scenarioTypes = Arrays.asList(ScenarioType.DATACOLLECTION); |
| 177 | + for (final ScenarioType scenario : scenarioTypes) { |
| 178 | + |
| 179 | + final Object[][] nodeCountsPlusWorldSizesPlusSeeds = { // |
| 180 | + { MOTE_COUNT_FEW, 100, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
| 181 | + // Many motes do not make sense here because the area is already crowded |
| 182 | + // { MOTE_COUNT_FEW, 200, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) |
| 183 | + // }, // |
| 184 | + { MOTE_COUNT_FEW, WORLD_SIZE_SMALL, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
| 185 | + { MOTE_COUNT_MANY, WORLD_SIZE_SMALL, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
| 186 | + |
| 187 | + { MOTE_COUNT_FEW, 400, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
| 188 | + { MOTE_COUNT_MANY, 400, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
| 189 | + // { MOTE_COUNT_FEW, 500, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
| 190 | + { MOTE_COUNT_FEW, WORLD_SIZE_MEDIUM, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
| 191 | + { MOTE_COUNT_MANY, WORLD_SIZE_MEDIUM, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
| 192 | + |
| 193 | + { MOTE_COUNT_FEW, 700, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 15, 16, 17, 18, 19, 20) }, // |
| 194 | + { MOTE_COUNT_MANY, 700, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 15, 16, 17, 18, 19, 20) }, // |
| 195 | + // { MOTE_COUNT_FEW, 800, Arrays.asList(2, 4, 5, 10, 11, 12, 13, 14, 15, 16, 17, |
| 196 | + // 18, 19, 20) |
| 197 | + // }, // |
| 198 | + { MOTE_COUNT_FEW, WORLD_SIZE_LARGE, Arrays.asList(4, 11, 12, 13, 16, 19, 22, 27, 35, 38) }, // |
| 199 | + { MOTE_COUNT_MANY, WORLD_SIZE_LARGE, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, // |
| 200 | + }; |
| 201 | + for (final Object[] nodeCountsWithWorldSize : nodeCountsPlusWorldSizesPlusSeeds) { |
| 202 | + final int nodeCount = (int) nodeCountsWithWorldSize[0]; |
| 203 | + final int worldSize = (int) nodeCountsWithWorldSize[1]; |
| 204 | + @SuppressWarnings("unchecked") |
| 205 | + final List<Integer> completeSeedList = (List<Integer>) nodeCountsWithWorldSize[2]; |
| 206 | + final List<Integer> seeds = completeSeedList.subList(0, |
| 207 | + Math.min(numberOfSeeds, completeSeedList.size())); |
| 208 | + final Double[] movementSpeeds = asArray(MOVEMENT_SPEED_STATIC, 0.5, 1.0, MOVEMENT_SPEED_PEDESTRIAN, |
| 209 | + 2.0); |
| 210 | + for (final double movementSpeed : movementSpeeds) { |
| 211 | + |
| 212 | + if (isDefaultEvaluationConfiguration(nodeCount, worldSize, movementSpeed)) { |
| 213 | + continue; |
| 214 | + } |
| 215 | + |
| 216 | + final List<TopologyControlAlgorithmID> algorithms = asModifiableList( // |
| 217 | + // UnderlayTopologyControlAlgorithms.MAXPOWER_TC, |
| 218 | + UnderlayTopologyControlAlgorithms.D_KTC); |
| 219 | + for (final TopologyControlAlgorithmID algorithm : algorithms) { |
| 220 | + |
| 221 | + for (final TopologyControlOperationMode tcOperationMode : Arrays |
| 222 | + .asList(TopologyControlOperationMode.BATCH, TopologyControlOperationMode.INCREMENTAL)) { |
| 223 | + |
| 224 | + final Double[] kParameters = isKTCLikeAlgorithm(algorithm) ? asArray(1.41) |
| 225 | + : TopologyControlComponentConfig.NOT_SET_DOUBLE_ARRAY; |
| 226 | + for (final double tcParamterK : kParameters) { |
| 227 | + |
| 228 | + final TopologyControlFrequencyMode topologyControlFrequencyMode = TopologyControlFrequencyMode.PERIODIC; |
| 229 | + final Double[] topologyControlIntervalInMinutesList = { 1.0 }; |
| 230 | + for (final double topologyControlIntervalInMinutes : topologyControlIntervalInMinutesList) { |
| 231 | + |
| 232 | + for (final int seed : seeds) { |
| 233 | + |
| 234 | + final int batteryCapacitySensor = 130; |
| 235 | + final int batteryCapacityMaster = isScenarioWithBaseStation(scenario) ? 1000000 |
| 236 | + : 130; |
| 237 | + final double requiredTransmissionPowerExponent = 2.0; |
| 238 | + final DistanceEdgeWeightProvider weightProvider = DistanceEdgeWeightProvider |
| 239 | + .getInstance(); |
| 240 | + final String endTime = "1h"; |
| 241 | + final String outputPrefix = "cobolt"; |
| 242 | + final String movementModelId = movementSpeed != 0.0 ? "GaussMarkov" : "None"; |
| 243 | + |
| 244 | + final TopologyControlComponentConfig config = new TopologyControlComponentConfig(); |
| 245 | + config.configurationNumber = configs.size() + 1; |
| 246 | + config.simulationConfigurationFile = simulationConfigurationFile |
| 247 | + .getAbsolutePath(); |
| 248 | + config.seed = seed; |
| 249 | + config.topologyControlAlgorithmID = algorithm; |
| 250 | + config.topologyControlOperationMode = tcOperationMode; |
| 251 | + config.worldSize = worldSize; |
| 252 | + config.nodeCount = nodeCount; |
| 253 | + config.topologyControlAlgorithmParamters |
| 254 | + .put(UnderlayTopologyControlAlgorithms.KTC_PARAM_K, tcParamterK); |
| 255 | + config.topologyControlIntervalInMinutes = topologyControlIntervalInMinutes; |
| 256 | + config.topologyControlFrequencyMode = topologyControlFrequencyMode; |
| 257 | + config.topologyMonitoringLocalViewSize = 2; |
| 258 | + config.batteryCapacitySensor = batteryCapacitySensor; |
| 259 | + config.batteryCapacityMaster = batteryCapacityMaster; |
| 260 | + config.outputFolder = outputFolderForResults; |
| 261 | + config.tracesOutputFolder = outputFolderForResults; |
| 262 | + config.outputFilePrefix = outputPrefix; |
| 263 | + config.requiredTransmissionPowerExponent = requiredTransmissionPowerExponent; |
| 264 | + config.edgeWeightCalculatingFunction = weightProvider; |
| 265 | + config.movementModel = movementModelId; |
| 266 | + config.movementModelMaster = isScenarioWithBaseStation(scenario) ? "None" |
| 267 | + : movementModelId; |
| 268 | + config.movementMaxSpeedInMetersPerSecond = movementSpeed; |
| 269 | + config.movementInterval = topologyControlIntervalInMinutes >= 1.0 |
| 270 | + ? ((int) topologyControlIntervalInMinutes) + "m" |
| 271 | + : ((int) (topologyControlIntervalInMinutes * 60)) + "s"; |
| 272 | + config.minimumDistanceThresholdInMeters = 0.0; |
| 273 | + config.end = endTime; |
| 274 | + config.scenario = scenario; |
| 275 | + config.datacollectionProbability = 1.0; |
| 276 | + config.reconfigurationEnabled = false; |
| 277 | + |
| 278 | + configs.add(config); |
| 279 | + } |
| 280 | + } |
| 281 | + } |
| 282 | + } |
| 283 | + } |
| 284 | + } |
| 285 | + } |
| 286 | + } |
| 287 | + |
| 288 | + return configs; |
| 289 | + } |
| 290 | + |
| 291 | + private boolean isDefaultEvaluationConfiguration(final int nodeCount, final int worldSize, |
| 292 | + final double movementSpeed) { |
| 293 | + return Arrays.asList(MOTE_COUNT_FEW, MOTE_COUNT_MANY).contains(nodeCount) |
| 294 | + && Arrays.asList(WORLD_SIZE_SMALL, WORLD_SIZE_MEDIUM, WORLD_SIZE_LARGE).contains(worldSize) |
| 295 | + && Arrays.asList(MOVEMENT_SPEED_STATIC, MOVEMENT_SPEED_PEDESTRIAN).contains(movementSpeed); |
| 296 | + } |
| 297 | + |
157 | 298 | }
|
0 commit comments