-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsim.rb
More file actions
executable file
·78 lines (68 loc) · 2.44 KB
/
sim.rb
File metadata and controls
executable file
·78 lines (68 loc) · 2.44 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/ruby
# The number of transmitters to place
txSizes = [100];
# The random seeds to use to generate values
seeds = [1234]
# Dimensions of the "transmitter" (inner) rectangle
txDimension = [10, 10]
# Dimensions of the "receiver" (outer) rectangle
rxDimension = [12, 12]
# Transmitter distributions
txDistributions = ['2-holes .65', 'circled 1', 'clustered .8 .1', 'dumbbell 4',
'uniform', 'plus .1', 'sine 4', 'rectangled 1']
# Algorithm names to use
algorithms = ['recursive']
# With a density of 35
# grid = 350x350 = 122,500 points
# recursive = 35x35 = 1225 points
gridDensity = 35; # The number of points in a "unit" (grid) or the entire area (recursive)
def buildConfig(baseName, numDev, algorithm, seed, txDim, rxDim, gridDensity, txDist)
string = <<-ENDSTR
<edu.rutgers.winlab.junsim.Config>
\t<beta>0.65</beta>
\t<numTransmitters>#{numDev}</numTransmitters>
\t<numReceivers>3</numReceivers>
\t<radioPower>2.0</radioPower>
\t<radioAlpha>2.68</radioAlpha>
\t<squareWidth>#{txDim[0]}</squareWidth>
\t<squareHeight>#{txDim[1]}</squareHeight>
\t<universeWidth>#{rxDim[0]}</universeWidth>
\t<universeHeight>#{rxDim[1]}</universeHeight>
\t<randomSeed>#{seed}</randomSeed>
\t<numTrials>1</numTrials>
\t<outputFileName>#{baseName}.csv</outputFileName>
\t<numThreads>2</numThreads>
\t<maxRangeMeters>40</maxRangeMeters>
\t<experimentType>#{algorithm}</experimentType>
\t<gridDensity>#{gridDensity}</gridDensity>
\t<randomized>false</randomized>
\t<renderConfig>graphics.xml</renderConfig>
\t<transmittersFile>../transmitters-#{numDev}-#{txDist}.ssv</transmittersFile>
\t<receiversFile>#{baseName}_rcv.ssv</receiversFile>
\t<outputBasePath>#{baseName}</outputBasePath>
\t<transmitterDistribution>#{txDist}</transmitterDistribution>
</edu.rutgers.winlab.junsim.Config>
ENDSTR
end # buildConfig
for numTx in txSizes do
for alg in algorithms do
for seed in seeds do
for distro in txDistributions do
expName = "#{alg}-t#{numTx}-s#{seed}-d#{distro}";
configString = buildConfig(expName, numTx, alg, seed, txDimension, rxDimension, gridDensity, distro);
File.open("#{expName}.xml", 'w') { |file|
file.write(configString);
file.close;
}
puts "Performing #{expName}"
`nice -n 10 java -mx32g -jar jun-sim.jar '#{expName}.xml'`
pid = $?.pid
success = $?.exitstatus
if success != 0
puts "ERROR: Execution failed for #{expName}"
exit
end
end # transmitter distributions
end # seeds
end # algorithms
end # tx sizes