Skip to content

Commit 3bc58bf

Browse files
committed
Create extended evaluation runner
1 parent d156609 commit 3bc58bf

File tree

4 files changed

+184
-24
lines changed

4 files changed

+184
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
3+
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
4+
<listEntry value="/simonstrator-simrunner/src/de/tudarmstadt/maki/simonstrator/peerfact/application/sensor/cobolt/CoboltEvaluationExecutor.java"/>
5+
</listAttribute>
6+
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
7+
<listEntry value="1"/>
8+
</listAttribute>
9+
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
10+
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
11+
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="de.tudarmstadt.maki.simonstrator.peerfact.application.sensor.cobolt.CoboltEvaluationExecutor"/>
12+
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-e extended --numThreads 1 --numSeeds 10 --javaXmx 2000"/>
13+
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="simonstrator-simrunner"/>
14+
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
15+
</launchConfiguration>

simonstrator-simrunner/src/de/tudarmstadt/maki/simonstrator/peerfact/application/sensor/AbstractTopologyControlReconfigurationExecutor.java

+3
Original file line numberDiff line numberDiff line change
@@ -616,4 +616,7 @@ public void actionPerformed(final ActionEvent e) {
616616
}
617617
}
618618

619+
public String getExecutor() {
620+
return executor;
621+
}
619622
}

simonstrator-simrunner/src/de/tudarmstadt/maki/simonstrator/peerfact/application/sensor/cobolt/CoboltEvaluationExecutor.java

+148-7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
public class CoboltEvaluationExecutor extends AbstractTopologyControlReconfigurationExecutor {
1818

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";
1923
private static final int WORLD_SIZE_SMALL = 300;
2024
private static final int WORLD_SIZE_MEDIUM = 600;
2125
private static final int WORLD_SIZE_LARGE = 900;
@@ -43,28 +47,41 @@ public CoboltEvaluationExecutor() {
4347

4448
@Override
4549
protected List<String> getSupportedExecutors() {
46-
return Arrays.asList("default");
50+
return Arrays.asList(EXECUTOR_DEFAULT, EXECUTOR_EXTENDED);
4751
}
4852

4953
@Override
5054
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() {
5166
final List<TopologyControlComponentConfig> configs = new ArrayList<>();
5267
final List<ScenarioType> scenarioTypes = Arrays.asList(ScenarioType.DATACOLLECTION);
5368
for (final ScenarioType scenario : scenarioTypes) {
5469

5570
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)
5873
// }, //
5974
{ MOTE_COUNT_FEW, WORLD_SIZE_SMALL, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, //
6075
{ 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) }, //
6378
{ MOTE_COUNT_FEW, WORLD_SIZE_MEDIUM, Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) }, //
6479
{ 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,
6682
// 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)
6885
// }, //
6986
{ MOTE_COUNT_FEW, WORLD_SIZE_LARGE, Arrays.asList(4, 11, 12, 13, 16, 19, 22, 27, 35, 38) }, //
7087
{ 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(
154171
return configs;
155172
}
156173

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+
157298
}

simonstrator-topology-control/src/de/tudarmstadt/maki/simonstrator/tc/component/TopologyControlComponent.java

+18-17
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ void executeTopologyControlIteration() {
204204
}
205205

206206
private String getIterationPrefix() {
207-
return String.format("iter#%03d ", this.statisticsHelper.getIterationCounter());
207+
return String.format("[%03d]iter#%03d ", this.configuration.configurationNumber,
208+
this.statisticsHelper.getIterationCounter());
208209
}
209210

210211
/**
@@ -454,7 +455,8 @@ private TopologyControlAlgorithmParamters getTopologyControlAlgorithmParameters(
454455
private void invokeContextEventHandlers() {
455456
final Graph inputTopology = getInputTopology();
456457

457-
Monitor.log(getClass(), Level.INFO, "iter#%03d CEH...", this.statisticsHelper.getIterationCounter());
458+
Monitor.log(getClass(), Level.INFO, "%sCEH...", getIterationPrefix(),
459+
this.statisticsHelper.getIterationCounter());
458460

459461
final CountingLinkStateListener ceLSMListener = new CountingLinkStateListener(this.eventRecordingFacade);
460462
final CountingContextEventListener intraCEExecutionCountingContextEventListener = new CountingContextEventListener();
@@ -563,15 +565,14 @@ private void invokeContextEventHandlers() {
563565
statisticsHelper.recordPostContextEventStatistics(this, ceLSMListener,
564566
intraCEExecutionCountingContextEventListener, contextEventDuration, contextEventCheckTime);
565567

566-
Monitor.log(getClass(), Level.INFO,
567-
"iter#%03d CEH Done (t=%.0fms, t_check=%.0fms, numCEs=%s, allLSMs=%d [%s])",
568-
this.statisticsHelper.getIterationCounter(), this.getStatisticsDTO().ceTimeInMillis,
569-
getStatisticsDTO().ceCheckTimeInMillis, intraCEExecutionCountingContextEventListener.format(),
570-
getStatisticsDTO().ceLSMCountTotal, ceLSMListener.format());
568+
Monitor.log(getClass(), Level.INFO, "%sCEH Done (t=%.0fms, t_check=%.0fms, numCEs=%s, allLSMs=%d [%s])",
569+
getIterationPrefix(), this.getStatisticsDTO().ceTimeInMillis, getStatisticsDTO().ceCheckTimeInMillis,
570+
intraCEExecutionCountingContextEventListener.format(), getStatisticsDTO().ceLSMCountTotal,
571+
ceLSMListener.format());
571572
}
572573

573574
private void invokeTopologyControlAlgorithm() {
574-
Monitor.log(getClass(), Level.INFO, "iter#%03d TCA...(algo=%s, parameters=%s)",
575+
Monitor.log(getClass(), Level.INFO, "%sTCA...(algo=%s, parameters=%s)", getIterationPrefix(),
575576
this.statisticsHelper.getIterationCounter(), getTopologyControlFacade().getConfiguredAlgorithm(),
576577
getTopologyControlAlgorithmParameters());
577578

@@ -612,17 +613,17 @@ private void invokeTopologyControlAlgorithm() {
612613
this.multiplexingFacade.endTopologyControlSequence();
613614

614615
Monitor.log(getClass(), Level.INFO,
615-
String.format(
616-
"iter#%03d TCA Done (t=%.0fms, t_check=%.0fms, violations=%d, allLSMs=%d [%s], effLSMs=%d)",
617-
this.statisticsHelper.getIterationCounter(), statisticsDTO.tcTimeInMillis,
618-
statisticsDTO.tcCheckTimeInMillis, statisticsDTO.tcViolationCount,
619-
statisticsDTO.tcLSMCountTotal, tcLSMListener.format(), statisticsDTO.tcLSMCountEffective));
616+
String.format("%sTCA Done (t=%.0fms, t_check=%.0fms, violations=%d, allLSMs=%d [%s], effLSMs=%d)",
617+
getIterationPrefix(), statisticsDTO.tcTimeInMillis, statisticsDTO.tcCheckTimeInMillis,
618+
statisticsDTO.tcViolationCount, statisticsDTO.tcLSMCountTotal, tcLSMListener.format(),
619+
statisticsDTO.tcLSMCountEffective));
620620

621621
getTopologyControlFacade().removeLinkStateListener(tcLSMListener);
622622
}
623623

624624
private void doStatisticsRecording() {
625-
Monitor.log(getClass(), Level.INFO, "iter#%03d Stat...", this.statisticsHelper.getIterationCounter());
625+
Monitor.log(getClass(), Level.INFO, "%sStat...", getIterationPrefix(),
626+
this.statisticsHelper.getIterationCounter());
626627
final long tic = System.currentTimeMillis();
627628

628629
this.statisticsHelper.collectStatistics(getInputTopology(), getOutputTopology());
@@ -636,9 +637,9 @@ private void doStatisticsRecording() {
636637

637638
final String formattedSimulationTime = Time.getFormattedTime(Time.getCurrentTime());
638639
Monitor.log(getClass(), Level.INFO,
639-
"iter#%03d Stat Done (t=%.0fms, n=%d, m=%d, t-real: %.2fmin, t-sim: %s, avgBatPct=%.2f, minBatPct=%.2f, maxBatPct=%.2f, numEmptyNodes=%d, numSCCsInInput=%d, numSCCsInOutput=%d)",
640-
this.statisticsHelper.getIterationCounter(), statisticsDTO.statTimeInMillis,
641-
statisticsDTO.nodeCountTotal, statisticsDTO.edgeCountTotal, //
640+
"%sStat Done (t=%.0fms, n=%d, m=%d, t-real: %.2fmin, t-sim: %s, avgBatPct=%.2f, minBatPct=%.2f, maxBatPct=%.2f, numEmptyNodes=%d, numSCCsInInput=%d, numSCCsInOutput=%d)",
641+
getIterationPrefix(), statisticsDTO.statTimeInMillis, statisticsDTO.nodeCountTotal,
642+
statisticsDTO.edgeCountTotal, //
642643
statisticsDTO.totalTimeInMinutes, formattedSimulationTime, //
643644
statisticsDTO.energyPercentageAvg, statisticsDTO.energyPercentageMin, statisticsDTO.energyPercentageMax, //
644645
statisticsDTO.nodeCountEmpty, //

0 commit comments

Comments
 (0)