Commit 47201fae authored by Sascha Dewes's avatar Sascha Dewes

combined singlestep and multistep version of dummysim into a single directory...

combined singlestep and multistep version of dummysim into a single directory to get rid of redundancy
parent 25557da3
Pipeline #401905 failed with stage
in 3 minutes and 51 seconds
from dummysim import SimEnv
from simconsts import *
from ms_simconsts import *
from multistep_simconsts import *
class MultiStepWrapper(object):
def __init__(self):
......
......@@ -4,7 +4,7 @@ import sys
import time
import numpy as np
from roswrapper import RosSimConnector
from multistep_roswrapper import RosSimConnector
from optparse import OptionParser
TRAINING_MODE = 0
......
# (c) https://github.com/MontiCore/monticore
from multistep import MultiStepWrapper
from simconsts import *
from ms_simconsts import *
from multistep_simconsts import *
import rospy
import numpy as np
import time
......
import json
import numpy
with open('results-20210118-173207', 'r') as stream:
results = json.load(stream)
money = results['money']
time = results['time']
mpt = []
for i in range(100):
mpt.append(money[i]/time[i])
print('money: {}'.format(money))
print('time: {}'.format(time))
print('mpt: {}'.format(mpt))
print('avg money: {}'.format(numpy.average(money)))
print('avg time: {}'.format(numpy.average(time)))
print('avg mpt: {}'.format(numpy.average(mpt)))
{"money": [16496.0, 32549.0, 45171.0, 28528.0, 42244.0, 29935.0, 34753.0, 31623.0, 47293.0, 27137.0, 29621.0, 12438.0, 20932.0, 48385.0, 35063.0, 19304.0, 50473.0, 39431.0, 36774.0, 26051.0, 43767.0, 23600.0, 33427.0, 35831.0, 31888.0, 61132.0, 46719.0, 44550.0, 25420.0, 34319.0, 34190.0, 45928.0, 37048.0, 28824.0, 40256.0, -16297.0, 11214.0, 54400.0, 26620.0, 46145.0, 28961.0, 30621.0, 45185.0, 49179.0, 32767.0, 48039.0, 45819.0, 35337.0, 56845.0, 21074.0, 16679.0, 27628.0, 24864.0, 34229.0, 66883.0, 39388.0, 43203.0, 33073.0, 26313.0, 44134.0, 32340.0, 46955.0, 56614.0, 15608.0, 58068.0, 37030.0, 69163.0, 40995.0, 14570.0, 34428.0, 23152.0, 26707.0, 42365.0, 13234.0, 40178.0, 52787.0, 47129.0, 20466.0, 36327.0, 35149.0, 26924.0, 21743.0, 18949.0, 31511.0, -46322.0, 42903.0, 30101.0, 22656.0, 31926.0, 26495.0, 27734.0, 61388.0, 43265.0, 32678.0, 28015.0, 37166.0, 27903.0, 35351.0, 27257.0, 29080.0], "score": [20.459999999999976, 208.48999999999995, 280.21000000000004, 181.77999999999992, 174.43999999999994, 228.35, 238.53000000000006, 205.22999999999993, 317.9299999999999, 160.37000000000006, 193.20999999999992, -12.620000000000001, 112.82000000000001, 352.35000000000014, 225.62999999999985, 52.039999999999985, 294.7300000000001, 181.31000000000006, 251.74000000000004, 141.51000000000002, 290.6700000000001, 157.0, 169.2699999999999, 182.30999999999983, 196.88000000000014, 442.82000000000016, 314.18999999999994, 309.5, 65.19999999999966, 226.19000000000008, 230.9, 308.28000000000014, 243.47999999999996, 190.73999999999998, 249.5599999999999, -335.97, -49.86000000000007, 357.5000000000002, 125.19999999999995, 248.45000000000013, 140.61000000000007, 154.20999999999984, 296.8500000000001, 300.7899999999998, 244.17000000000004, 305.38999999999993, 345.19000000000005, 214.36999999999995, 367.45000000000016, 45.74000000000008, -24.209999999999944, 140.2799999999999, 132.14000000000001, 249.29000000000008, 483.82999999999987, 277.37999999999994, 259.0299999999998, 236.72999999999993, 135.62999999999997, 265.8400000000001, 146.39999999999984, 362.55, 411.13999999999993, -9.41999999999995, 435.68000000000006, 176.80000000000015, 473.1300000000001, 292.95000000000005, -1.29999999999999, 245.28000000000003, 136.51999999999998, 127.07, 322.65, -36.66000000000004, 296.78000000000003, 336.86999999999995, 350.2899999999999, 41.65999999999996, 190.27000000000024, 189.48999999999998, 160.24, 92.43, 100.49, 202.11000000000004, -659.2199999999998, 300.0300000000002, 164.01000000000005, 134.05999999999997, 192.25999999999985, 165.95000000000007, 116.33999999999999, 442.87999999999994, 321.6499999999999, 202.78000000000011, 173.15000000000003, 268.66, 156.52999999999992, 256.51000000000005, 165.5700000000001, 176.80000000000013], "time": [7338.0, 5428.0, 9343.0, 5830.0, 11942.0, 3815.0, 5632.0, 4597.0, 6442.0, 4874.0, 5304.0, 6790.0, 5069.0, 6787.0, 5329.0, 6633.0, 13690.0, 13294.0, 5387.0, 6019.0, 6679.0, 3780.0, 5847.0, 7124.0, 6550.0, 8572.0, 6325.0, 7337.0, 5720.0, 4793.0, 5196.0, 7342.0, 6158.0, 4838.0, 6454.0, 14611.0, 9913.0, 7807.0, 6231.0, 9066.0, 5629.0, 8696.0, 7566.0, 5538.0, 4561.0, 7958.0, 5160.0, 5073.0, 8257.0, 5434.0, 6204.0, 9606.0, 6719.0, 4480.0, 6422.0, 4943.0, 8472.0, 4758.0, 4516.0, 9200.0, 6403.0, 4340.0, 7318.0, 8376.0, 5084.0, 11597.0, 9463.0, 6609.0, 6178.0, 5613.0, 4988.0, 6004.0, 4969.0, 9624.0, 6180.0, 7816.0, 5195.0, 5890.0, 5953.0, 10641.0, 4855.0, 4378.0, 4211.0, 5730.0, 13544.0, 4979.0, 6075.0, 5657.0, 7335.0, 5225.0, 5847.0, 7385.0, 4673.0, 6013.0, 4862.0, 5455.0, 5553.0, 5238.0, 5147.0, 5443.0]}
\ No newline at end of file
{"money": [18210.0, 57468.0, 42472.0, 37534.0, 22785.0, 62305.0, 36382.0, 36359.0, 33664.0, 29700.0, 28063.0, 30539.0, 48183.0, 38537.0, 19139.0, 44898.0, 21740.0, 26828.0, 43302.0, 23522.0, 26578.0, 38617.0, 28758.0, 43167.0, 35934.0, 46821.0, 25821.0, 43744.0, 21430.0, 36504.0, 58614.0, 51635.0, 49652.0, 44361.0, 4217.0, 37538.0, 62549.0, 66953.0, 18851.0, 33992.0, 58530.0, 34232.0, 29976.0, 37089.0, 35054.0, 45986.0, 59491.0, 38450.0, 56953.0, 31994.0, 64048.0, 48465.0, 29876.0, 66952.0, 35100.0, 46475.0, 44488.0, 38060.0, 24765.0, 43070.0, 34694.0, 25350.0, 38533.0, 28186.0, 58911.0, 62086.0, 40402.0, 57779.0, 39523.0, 54711.0, 38031.0, -12922.0, -35737.0, 44959.0, 53811.0, 29783.0, 26955.0, -4043.0, 33687.0, 27125.0, 28430.0, 28900.0, 41442.0, 42757.0, 36367.0, 38486.0, 25565.0, 20925.0, 39865.0, 29995.0, 32051.0, 55964.0, 35569.0, 40782.0, 44778.0, 41542.0, 31805.0, 55806.0, 24163.0, 34088.0], "score": [63.09999999999999, 455.68000000000006, 339.71999999999997, 286.34000000000003, 122.35000000000004, 465.55000000000007, 266.32000000000005, 254.5900000000001, 240.14000000000001, 224.0, 195.63000000000002, 159.89000000000007, 370.83000000000004, 241.8700000000002, 90.39000000000003, 324.47999999999996, 112.39999999999999, 189.27999999999994, 334.0199999999999, 127.22, 170.78000000000003, 287.17, 206.58000000000004, 305.1699999999999, 276.34000000000003, 334.7099999999997, 169.20999999999998, 344.43999999999994, 117.30000000000005, 284.0400000000001, 402.64000000000044, 411.34999999999974, 374.5199999999999, 338.61000000000024, -97.33, 293.37999999999994, 498.4899999999998, 528.5300000000002, 117.50999999999999, 254.9199999999999, 466.30000000000007, 233.32000000000002, 181.76000000000002, 273.8900000000001, 228.53999999999988, 348.86, 462.90999999999974, 277.49999999999994, 413.0299999999999, 238.93999999999988, 519.9799999999999, 379.65, 219.76, 518.52, 224.50000000000009, 367.7499999999999, 349.88, 285.6, 150.14999999999998, 307.1999999999999, 231.93999999999994, 150.00000000000003, 273.3300000000001, 174.85999999999996, 454.11, 479.8599999999999, 306.0199999999999, 448.79000000000013, 279.7299999999999, 338.60999999999984, 305.31000000000006, -285.7200000000001, -563.3699999999997, 330.59000000000003, 421.1100000000001, 206.83000000000004, 194.54999999999998, -209.43, 255.87, 200.25, 209.30000000000004, 165.00000000000009, 293.9200000000001, 332.57, 268.6699999999999, 287.8600000000001, 172.64999999999998, 136.25000000000003, 222.65, 140.94999999999993, 233.51000000000005, 426.6399999999999, 177.69000000000008, 292.81999999999994, 301.7800000000001, 302.9200000000001, 245.04999999999998, 439.06000000000006, 91.62999999999987, 231.87999999999994], "time": [6312.0, 5933.0, 3966.0, 4883.0, 6584.0, 8349.0, 4959.0, 4750.0, 5968.0, 4233.0, 5662.0, 9505.0, 5863.0, 10235.0, 5159.0, 7592.0, 6026.0, 4197.0, 5411.0, 7394.0, 5758.0, 3898.0, 3908.0, 7663.0, 3892.0, 7222.0, 4509.0, 4929.0, 6351.0, 4343.0, 12596.0, 5204.0, 6208.0, 5774.0, 12106.0, 4857.0, 5692.0, 6306.0, 4146.0, 3966.0, 4920.0, 5790.0, 8099.0, 4463.0, 7222.0, 5801.0, 7248.0, 5635.0, 8850.0, 5112.0, 5743.0, 4628.0, 4033.0, 6020.0, 7948.0, 4406.0, 4284.0, 5248.0, 6898.0, 6484.0, 7815.0, 6683.0, 6154.0, 5621.0, 5992.0, 6002.0, 5140.0, 5971.0, 6407.0, 13712.0, 4087.0, 12388.0, 16941.0, 5184.0, 6068.0, 5168.0, 4630.0, 15028.0, 4401.0, 3548.0, 3775.0, 9258.0, 6167.0, 4876.0, 4817.0, 4905.0, 4070.0, 4646.0, 11435.0, 12004.0, 4825.0, 6738.0, 11031.0, 5483.0, 8759.0, 5968.0, 4366.0, 5857.0, 11216.0, 5191.0]}
\ No newline at end of file
{"money": [7519.0, 35370.0, 64708.0, -8323.0, 21672.0, 35692.0, 30781.0, 28903.0, 22104.0, 21955.0, 25620.0, 23577.0, 35423.0, 32209.0, 32812.0, 43235.0, 24780.0, 61222.0, 33585.0, 31534.0, 53316.0, 37376.0, 49267.0, 44484.0, 34604.0, 30623.0, 52028.0, 45557.0, 46580.0, 32847.0, 54285.0, 52901.0, 46000.0, 38304.0, 64106.0, -3381.0, -1153.0, 25475.0, 71821.0, 41645.0, 24124.0, 55192.0, 19073.0, 2056.0, 37783.0, 53661.0, 43644.0, 39510.0, 52019.0, 72805.0, 49880.0, 18206.0, -9496.0, 36533.0, 11967.0, 62307.0, 44731.0, 31904.0, 11350.0, 60077.0, 57828.0, 26541.0, 38035.0, 36845.0, 54982.0, 46763.0, -24785.0, 48101.0, 25567.0, 69362.0, 50136.0, -78211.0, 17347.0, 23678.0, -3074.0, 40523.0, 49600.0, 53883.0, 3076.0, -3442.0, 12815.0, 43743.0, 12293.0, 60776.0, 46076.0, 44880.0, 35946.0, 34842.0, 49265.0, -62577.0, 40644.0, 40927.0, 32388.0, 66234.0, 80793.0, 10657.0, 18436.0, 57500.0, -26833.0, 38520.0], "score": [-190.81000000000014, 60.70000000000002, 362.5799999999995, -504.72999999999956, -173.27999999999972, 115.91999999999996, -44.19000000000008, 7.529999999999991, -74.95999999999987, -11.44999999999996, 47.20000000000007, 65.76999999999992, 122.2299999999999, 67.08999999999995, 77.11999999999998, 176.35000000000008, -31.200000000000088, 249.22000000000045, -7.649999999999955, 44.34000000000019, 120.15999999999971, 130.7600000000002, 270.16999999999956, 238.33999999999997, 197.04000000000016, 30.730000000000075, 334.27999999999986, 195.0699999999999, 32.299999999999834, 125.46999999999997, 281.8499999999998, 114.01000000000018, 9.499999999999751, 32.54000000000002, 297.0599999999996, -396.8099999999999, -350.53000000000037, 111.75000000000006, 249.71, 41.449999999999775, -121.26000000000005, 204.92000000000013, -63.27000000000002, -282.44000000000017, 207.82999999999979, 202.11000000000013, 48.94000000000003, 62.1, 303.19, 425.0499999999995, 91.79999999999974, -34.43999999999997, -533.9599999999997, 96.33000000000021, -223.32999999999998, 198.07000000000062, 230.81000000000006, 53.540000000000035, -215.00000000000003, 243.76999999999995, 263.27999999999963, -357.59, 41.349999999999916, 180.94999999999982, 222.81999999999996, 18.629999999999974, -702.850000000001, 264.0099999999999, -74.32999999999998, 385.1199999999997, 189.36000000000018, -1196.1099999999983, -88.53000000000002, 15.779999999999959, -463.7400000000004, 185.7300000000001, 269.00000000000006, 246.32999999999993, -260.24, -501.91999999999996, -202.85000000000008, 42.43000000000029, -176.5699999999999, 266.2599999999998, 244.26, 57.799999999999876, 224.46000000000006, -86.57999999999981, 106.64999999999957, -1055.270000000001, 90.4400000000002, 180.27000000000004, -79.12000000000012, 237.33999999999995, 432.93000000000006, -198.9300000000002, -171.14000000000019, 270.9999999999998, -568.3300000000003, 139.70000000000013], "time": [9106.0, 6597.0, 9070.0, 14229.0, 11471.0, 7687.0, 14117.0, 9451.0, 14118.0, 7949.0, 8203.0, 6994.0, 7468.0, 7796.0, 10285.0, 8406.0, 10346.0, 8526.0, 11638.0, 7637.0, 10241.0, 7654.0, 7481.0, 7963.0, 5966.0, 11259.0, 6138.0, 8308.0, 10717.0, 6982.0, 8487.0, 10038.0, 11033.0, 9880.0, 11832.0, 14141.0, 10339.0, 6419.0, 11957.0, 12484.0, 10884.0, 9036.0, 11027.0, 9915.0, 8247.0, 8984.0, 9727.0, 9732.0, 7964.0, 6763.0, 11644.0, 10499.0, 11444.0, 8037.0, 12350.0, 11789.0, 8482.0, 10079.0, 9540.0, 8827.0, 10692.0, 11634.0, 10991.0, 8317.0, 7410.0, 12142.0, 14096.0, 6628.0, 12850.0, 10939.0, 6713.0, 16541.0, 13439.0, 9676.0, 13031.0, 7019.0, 8577.0, 9103.0, 10448.0, 16713.0, 10372.0, 13043.0, 12775.0, 6908.0, 7408.0, 9779.0, 5753.0, 9114.0, 14057.0, 16454.0, 11088.0, 6495.0, 10458.0, 9384.0, 10615.0, 10169.0, 12209.0, 7950.0, 13949.0, 7538.0]}
\ No newline at end of file
{"money": [-15850.0, 19006.0, -19944.0, 31941.0, 19081.0, 15986.0, 35617.0, 11867.0, 23348.0, -45123.0, 41532.0, 24556.0, 17437.0, 16873.0, -12418.0, 20391.0, 23321.0, 40019.0, 37191.0, -417.0, 36435.0, 24183.0, 24038.0, 26504.0, 23402.0, 47489.0, 35238.0, 33155.0, 17659.0, 43848.0, 31665.0, 17482.0, 58444.0, 14975.0, 48002.0, 17035.0, 50278.0, -10682.0, 49893.0, 9902.0, 32707.0, 41262.0, 13315.0, -33432.0, 18981.0, 8390.0, 27562.0, 51887.0, 28768.0, 15511.0, 31457.0, 35063.0, 21449.0, 33376.0, 30529.0, 29462.0, 22781.0, 31269.0, 6905.0, 26726.0, -1416.0, 34432.0, 29707.0, 38496.0, 35486.0, 35960.0, 28497.0, 12069.0, 12797.0, 21953.0, 31389.0, 19654.0, 21728.0, 17537.0, 28935.0, 22567.0, 27328.0, 22389.0, 24624.0, 55767.0, 17969.0, 31935.0, 30674.0, 27280.0, 2028.0, 22815.0, 18300.0, 40498.0, 37682.0, 19590.0, 18476.0, 29508.0, 6197.0, 27352.0, 23519.0, 35109.0, 17393.0, 40957.0, -5417.0, 11693.0], "score": [-329.99999999999994, 106.56000000000002, -338.44, 159.91000000000003, 65.81000000000009, 94.86, 271.16999999999996, -18.33000000000002, 108.48000000000006, -603.73, 308.3199999999998, 158.56000000000006, 76.86999999999995, 108.73000000000003, -270.1800000000002, 81.91, 146.21, 265.19000000000005, 268.90999999999997, -144.67000000000004, 266.34999999999985, 160.83, 104.8800000000001, 162.03999999999996, 175.01999999999998, 365.8899999999999, 255.37999999999994, 246.04999999999995, 107.59, 315.4799999999999, 201.65000000000003, 95.81999999999998, 453.4399999999999, 46.750000000000014, 381.0199999999998, 85.35000000000002, 373.28000000000003, -221.81999999999996, 363.93000000000006, -11.97999999999998, 232.06999999999994, 321.6199999999999, 50.150000000000034, -484.3199999999999, 90.81000000000002, -9.100000000000001, 198.61999999999998, 407.8700000000001, 202.68000000000004, 92.11000000000001, 215.57000000000002, 248.63, 145.48999999999998, 214.76000000000005, 230.28999999999996, 219.61999999999995, 177.30999999999995, 194.19, -4.45000000000001, 158.76000000000008, -180.16000000000005, 265.3199999999999, 212.07000000000008, 299.9599999999999, 175.86000000000018, 274.6, 217.97000000000006, 43.68999999999999, 40.970000000000006, 164.52999999999994, 226.89000000000001, 90.54000000000012, 127.28000000000004, 88.36999999999996, 203.35000000000005, 126.67000000000002, 174.28, 122.88999999999997, 163.24000000000007, 438.67000000000013, 100.69, 240.3500000000001, 229.73999999999995, 187.79999999999998, -135.22000000000003, 125.15, 29.000000000000046, 311.9800000000001, 231.82000000000005, 90.9, 107.76, 202.08000000000004, -51.02999999999999, 194.52, 169.19000000000003, 245.09000000000012, 85.92999999999996, 300.57, -135.17000000000002, -29.570000000000025], "time": [12625.0, 4824.0, 8450.0, 7981.0, 5897.0, 2929.0, 3775.0, 8192.0, 5455.0, 11564.0, 4817.0, 4757.0, 5086.0, 2752.0, 12736.0, 7939.0, 4560.0, 8962.0, 4298.0, 8632.0, 5865.0, 3887.0, 8749.0, 5335.0, 3389.0, 4752.0, 4112.0, 3851.0, 4588.0, 4924.0, 5616.0, 4415.0, 5507.0, 6384.0, 4380.0, 5206.0, 6136.0, 7975.0, 4842.0, 5829.0, 4896.0, 4502.0, 4178.0, 12021.0, 6246.0, 5334.0, 3371.0, 5297.0, 4660.0, 3624.0, 4074.0, 5063.0, 3941.0, 5018.0, 3096.0, 3781.0, 2704.0, 7503.0, 4429.0, 6964.0, 10911.0, 4121.0, 4317.0, 4077.0, 10702.0, 3634.0, 3156.0, 4470.0, 4686.0, 2950.0, 3402.0, 7608.0, 5978.0, 4334.0, 4047.0, 4458.0, 4597.0, 5566.0, 4808.0, 4677.0, 4338.0, 3850.0, 3799.0, 4168.0, 12656.0, 5133.0, 9637.0, 4206.0, 6046.0, 6476.0, 4380.0, 4307.0, 6438.0, 4207.0, 3709.0, 6235.0, 5067.0, 4886.0, 4759.0, 8804.0]}
\ No newline at end of file
{"money": [24781.0, 39542.0, 37800.0, 15842.0, 40019.0, 38559.0, 34849.0, 19547.0, 37237.0, 7907.0, 43185.0, 39136.0, 40667.0, 47999.0, 20239.0, 41815.0, -5081.0, 16937.0, 23069.0, 15167.0, 40788.0, 32602.0, 43788.0, 16476.0, 16752.0, 19855.0, 26671.0, 28710.0, 40299.0, 15101.0, 22127.0, 26527.0, 27284.0, 23145.0, 44740.0, 24272.0, 26373.0, 24185.0, 44185.0, 28220.0, 25820.0, 31228.0, 24977.0, 38831.0, 27291.0, 31153.0, 24741.0, 31372.0, 8014.0, 2827.0, 31560.0, 50971.0, 10986.0, 27866.0, 40410.0, 21033.0, -8990.0, 36209.0, 28222.0, 32490.0, 29532.0, 32387.0, 10944.0, 47863.0, 10354.0, 39552.0, 28441.0, 25133.0, 23709.0, -1056.0, 31864.0, 40442.0, 35555.0, 32710.0, 30845.0, 34801.0, -1925.0, 3139.0, 38317.0, 34703.0, 34022.0, 33494.0, 20591.0, 44352.0, 21201.0, 48268.0, 31239.0, 48499.0, 15596.0, 25283.0, 30113.0, 14196.0, 31767.0, 37994.0, 22880.0, 31530.0, 36689.0, 14486.0, 1258.0, 17543.0], "score": [108.31000000000003, 293.91999999999996, 265.00000000000017, 79.42, 292.19000000000017, 289.5900000000001, 258.99, 78.47000000000006, 261.37000000000006, -41.92999999999993, 317.8499999999999, 284.36, 308.1699999999999, 317.4900000000001, 128.39000000000004, 319.15000000000015, -139.81000000000003, 76.37000000000005, 151.68999999999997, 78.67000000000002, 298.88000000000017, 198.02000000000004, 292.37999999999994, 45.26000000000003, 40.019999999999975, 137.05000000000004, 149.71, 170.10000000000008, 289.99000000000007, 72.01000000000002, 136.26999999999995, 165.2699999999999, 189.84, 160.45, 332.4000000000001, 90.71999999999984, 194.73000000000002, 158.85000000000002, 309.8499999999999, 181.20000000000002, 117.69999999999987, 229.28000000000006, 166.76999999999995, 259.80999999999995, 125.41, 236.52999999999994, 147.91000000000003, 218.72000000000003, -14.360000000000012, -156.7299999999999, 152.5999999999999, 383.21, 44.860000000000014, 161.16000000000003, 271.1, 143.32999999999996, -264.4000000000001, 235.08999999999995, 169.22, 237.39999999999998, 190.32000000000005, 198.36999999999995, 42.44, 373.6299999999999, -30.960000000000054, 262.02, 195.41, 145.82999999999998, 100.59000000000015, -187.05999999999995, 152.6400000000001, 283.41999999999985, 179.04999999999998, 194.60000000000002, 213.45, 185.50999999999993, -145.24999999999994, -104.60999999999997, 298.1700000000001, 264.03000000000003, 259.22000000000014, 195.9400000000001, 121.41000000000003, 338.5200000000001, 101.01000000000002, 363.6800000000001, 212.88999999999996, 369.98999999999984, 60.96, 113.83, 192.13000000000002, 64.96, 240.67000000000002, 94.43999999999991, 104.2999999999999, 231.30000000000007, 253.89000000000004, -20.140000000000022, -66.91999999999999, 98.42999999999998], "time": [7488.0, 4520.0, 4971.0, 4164.0, 5395.0, 3997.0, 3863.0, 6344.0, 5173.0, 10126.0, 5592.0, 4509.0, 4704.0, 8843.0, 4643.0, 4933.0, 5268.0, 4282.0, 3827.0, 4946.0, 4621.0, 5753.0, 8276.0, 7735.0, 7678.0, 3641.0, 8549.0, 5556.0, 6555.0, 3942.0, 4526.0, 5620.0, 3664.0, 3633.0, 4925.0, 8318.0, 3740.0, 4345.0, 6167.0, 4738.0, 8809.0, 4681.0, 3454.0, 6761.0, 11056.0, 3397.0, 6766.0, 4216.0, 5542.0, 13271.0, 11336.0, 6290.0, 3246.0, 6223.0, 5246.0, 3323.0, 13362.0, 5488.0, 4929.0, 5349.0, 5210.0, 6851.0, 4496.0, 4171.0, 8017.0, 6217.0, 4421.0, 4850.0, 7619.0, 13969.0, 9307.0, 5851.0, 11246.0, 8124.0, 4107.0, 9778.0, 9200.0, 10020.0, 3342.0, 4056.0, 3462.0, 6455.0, 4863.0, 4228.0, 6170.0, 5021.0, 5169.0, 4832.0, 4409.0, 5721.0, 6094.0, 3907.0, 3504.0, 19965.0, 7170.0, 3882.0, 4153.0, 10186.0, 5010.0, 3825.0]}
\ No newline at end of file
{"money": [24781.0, 39542.0, 37800.0, 15842.0, 38815.0, 41586.0, 34817.0, 19339.0, 31956.0, 42700.0, 25865.0, 32662.0, 21233.0, 49759.0, 26895.0, 22771.0, 31978.0, 27473.0, 37646.0, 38493.0, 16119.0, 55646.0, 46988.0, 30094.0, 36538.0, 37581.0, 18628.0, 26830.0, 23757.0, 30615.0, 55283.0, 22448.0, 37596.0, 44205.0, 50606.0, 18414.0, 23498.0, 11653.0, 44976.0, 49690.0, 10820.0, 47080.0, 43393.0, 20421.0, 18268.0, 42149.0, 30313.0, 34668.0, 35029.0, 21751.0, 35921.0, 25809.0, 46401.0, 21904.0, 37868.0, 33248.0, -22668.0, 25089.0, 47381.0, 16671.0, 11454.0, 23775.0, 32327.0, 6893.0, 7993.0, 43739.0, 24298.0, 40486.0, 26295.0, -29899.0, 29001.0, 41933.0, 25820.0, 33249.0, 29056.0, 40888.0, 36919.0, 34159.0, 38777.0, 21263.0, 31697.0, 42661.0, 26817.0, 39139.0, 39602.0, 36391.0, 22070.0, 21098.0, 29626.0, 47023.0, 40563.0, 41694.0, 32615.0, 19472.0, 26159.0, 50659.0, 25649.0, 34067.0, 50871.0, 11194.0], "score": [108.31000000000003, 293.91999999999996, 265.00000000000017, 79.42, 280.6500000000001, 319.86000000000007, 258.67, 77.39000000000006, 209.56000000000003, 265.00000000000017, 145.15, 243.62, 130.83, 360.59, 177.95000000000005, 120.71, 222.78000000000003, 171.23000000000002, 257.4600000000001, 291.93, 62.19, 377.9599999999999, 321.38, 223.93999999999994, 276.38, 276.81, 89.27999999999997, 177.29999999999995, 116.56999999999984, 215.15000000000018, 423.3300000000002, 137.48000000000002, 278.95999999999987, 331.05, 385.0600000000001, 58.63999999999997, 149.98000000000002, -9.970000000000026, 274.76000000000033, 383.90000000000003, 19.199999999999992, 363.30000000000024, 324.92999999999984, 112.71, 19.679999999999954, 326.4900000000001, 181.63000000000002, 211.67999999999995, 259.2899999999999, 140.51, 260.21000000000004, 171.09, 355.00999999999993, 132.04000000000002, 239.68, 223.47999999999993, -389.67999999999995, 185.89000000000007, 340.3099999999999, 61.70999999999999, 57.54, 120.74999999999999, 232.27000000000007, -38.57000000000002, -14.069999999999975, 330.3900000000001, 78.9800000000001, 289.8600000000001, 181.95, -450.9899999999999, 140.00999999999996, 310.33, 173.1999999999999, 175.9899999999999, 196.55999999999992, 319.87999999999994, 256.18999999999994, 218.58999999999978, 298.27000000000004, 99.12999999999995, 235.97000000000006, 325.61000000000007, 52.169999999999845, 257.39000000000004, 295.02000000000004, 266.91, 137.70000000000002, 147.98000000000002, 165.26, 341.23, 266.13000000000017, 307.94, 233.14999999999995, 109.72000000000003, 180.59, 363.59000000000003, 166.49, 233.67000000000007, 397.71, -18.05999999999996], "time": [7488.0, 4520.0, 4971.0, 4164.0, 5393.0, 3997.0, 3883.0, 6340.0, 5730.0, 7148.0, 7233.0, 3677.0, 4643.0, 5563.0, 3787.0, 5191.0, 4597.0, 5738.0, 4928.0, 4416.0, 4359.0, 10084.0, 8233.0, 3737.0, 4208.0, 4725.0, 4883.0, 3843.0, 7100.0, 4731.0, 5399.0, 3919.0, 4242.0, 5088.0, 5226.0, 6298.0, 3990.0, 7203.0, 10702.0, 4562.0, 5290.0, 4251.0, 4278.0, 4030.0, 9692.0, 4716.0, 7765.0, 5693.0, 4462.0, 3515.0, 5174.0, 4090.0, 4375.0, 4823.0, 6812.0, 4302.0, 12102.0, 3082.0, 6525.0, 5374.0, 3442.0, 7234.0, 3556.0, 5525.0, 5523.0, 4186.0, 11508.0, 4869.0, 3947.0, 11310.0, 10466.0, 5035.0, 4210.0, 7740.0, 5152.0, 3363.0, 4279.0, 6244.0, 3569.0, 7694.0, 4081.0, 4815.0, 15227.0, 6490.0, 5018.0, 4122.0, 3400.0, 3064.0, 5278.0, 5115.0, 7869.0, 5646.0, 4016.0, 5396.0, 4421.0, 5299.0, 4834.0, 5017.0, 5215.0, 8843.0]}
\ No newline at end of file
{"money": [24781.0, 39542.0, 37800.0, 15842.0, 38815.0, 41586.0, 34817.0, 19093.0, 32322.0, 41525.0, 34574.0, 42497.0, 37426.0, 28021.0, 43159.0, 20887.0, 42322.0, 48966.0, 27581.0, 27678.0, 44003.0, 14697.0, 26889.0, 20402.0, 53830.0, 25163.0, 31414.0, 24297.0, 41879.0], "score": [108.31000000000003, 293.91999999999996, 265.00000000000017, 79.42, 280.6500000000001, 319.86000000000007, 258.66999999999996, 74.93000000000004, 213.22, 280.2499999999999, 251.7400000000001, 267.4700000000001, 287.26, 203.2100000000001, 334.59000000000003, 90.36999999999998, 308.21999999999986, 374.6600000000001, 171.81000000000003, 182.7800000000001, 319.02999999999986, 73.97000000000003, 171.8899999999998, 49.01999999999997, 395.30000000000024, 165.12999999999997, 207.14000000000001, 151.97, 301.7900000000002], "time": [7488.0, 4520.0, 4971.0, 4164.0, 5393.0, 3997.0, 3883.0, 6340.0, 5730.0, 7817.0, 5113.0, 9716.0, 3889.0, 4587.0, 4589.0, 7451.0, 5548.0, 5329.0, 5188.0, 4598.0, 5420.0, 3664.0, 4372.0, 10581.0, 6345.0, 5194.0, 5291.0, 5045.0, 4700.0]}
\ No newline at end of file
This diff is collapsed.
MAXJOBS = 10
NEWJOBS = 20
MAXSITES = 10
MAPSIZE = 32
LEN_JOB = 8
LEN_SITE = 22
LEN_DIST = MAXJOBS + MAXSITES + 1
LEN_FORW = 6
STATE_X = 7
STATE_Y = MAPSIZE
STATE_Z = MAPSIZE
NN_STATE_LEN = 2 + (MAXJOBS+NEWJOBS)*LEN_JOB + MAXSITES*LEN_SITE + LEN_DIST-1 + LEN_FORW ## == 488
ACTION_X = 6
ACTION_Y = NEWJOBS
ACTION_Z = 2
NN_ACTION_LEN = NEWJOBS + MAXJOBS*2 + MAXSITES + MAXJOBS + 3 ## == 63
ST_GENERAL = 1-1
ST_MAP = 2-1
ST_JOBINF = 3-1
ST_NEWJOB = 4-1
ST_SITEINF = 5-1
ST_DIST = 6-1
ST_FORW = 7-1
AC_ACCEPT = 1-1
AC_PILES = 2-1
AC_MOVE = 3-1
AC_LOAD = 4-1
AC_UNLOAD = 5-1
AC_WAIT = 6-1
GEN_TIME = 1-1
GEN_MONEY = 2-1
MAP_FOREST = 1
MAP_ROAD = 2
MAP_TRAIL = 3
MAP_SITE = 4
MAP_PILE = 5
JOB_PILEX = 1-1
JOB_PILEY = 2-1
JOB_TYPE = 3-1
JOB_LOGLEN = 4-1
JOB_DEMAND = 5-1
JOB_DEADL = 6-1
JOB_FINE = 7-1
JOB_REWARD = 8-1
SITE_SITEX = 1-1
SITE_SITEY = 2-1
SITE_TYPE = 3-1
SITE_LOGLEN = 4-1
SITE_SUPPLY = 5-1
SITE_SUPTIME1 = 6-1
SITE_SUPTIME2 = 7-1
SITE_SUPTIME3 = 8-1
SITE_SUPUP1 = 9-1
SITE_SUPUP2 = 10-1
SITE_SUPUP3 = 11-1
SITE_MAXGREEN = 12-1
SITE_MAXYELLOW = 13-1
SITE_SOILTIME1 = 14-1
SITE_SOILTIME2 = 15-1
SITE_SOILTIME3 = 16-1
SITE_GREENUP1 = 17-1
SITE_GREENUP2 = 18-1
SITE_GREENUP3 = 19-1
SITE_YELLOWUP1 = 20-1
SITE_YELLOWUP2 = 21-1
SITE_YELLOWUP3 = 22-1
FORW_X = 1-1
FORW_Y = 2-1
FORW_WEIGHT = 3-1
FORW_LOAD = 4-1
FORW_BUNKCAP = 5-1
FORW_CRANECAP = 6-1
WOOD_TYPES = 3
WT_PINE = 1
WT_BEECH = 2
WT_OAK = 3
KGPM_PINE = 56
KGPM_BEECH = 77
KGPM_OAK = 84
## SIM ONLY
LAYER_NAMES = {1:'GENERAL INFO', 2:'MAP', 3:'JOBINF', 4:'NEWJOBINF', 5:'SITEINF', 6:'DISTANCES', 7:'FORWARDER'}
ACTION_NAMES = ['ACCEPT', 'PILES', 'MOVE', 'LOAD', 'UNLOAD', 'WAIT']
import random
from simconsts import *
from math import sqrt, floor, pi
random.seed(12345)
## returns initial general information (2 x 1)
def gengeneral():
return [[0],[0]]
## returns map with correct site positions (32 x 32)
def genmap(siteinf):
result = []
for i in range(0, MAPSIZE):
result.append([MAP_FOREST for j in range(0, MAPSIZE)])
for i in range(0, 50):
result[random.randint(1, 32)-1][random.randint(1, 32)-1] = MAP_ROAD
for i in range(0, MAXSITES):
sitex = siteinf[i][SITE_SITEX]-1
sitey = siteinf[i][SITE_SITEY]-1
result[sitex][sitey] = MAP_SITE
return result
## returns matrix with undefined jobinfos (10 x 8)
def genjobinf():
result = []
for i in range(0, MAXJOBS):
jobinf = [-1 for i in range(0, LEN_JOB)]
result.append(jobinf)
return result
## returns the price per log for a given wood type and length
def getlogprice(woodtype, loglen):
volume = pi * (0.15**2) * loglen
if woodtype == WT_PINE:
return floor(volume * 70)
elif woodtype == WT_BEECH:
return floor(volume * 80)
else: ## WT_OAK
return floor(volume * 120)
## returns randomly generated jobinfos for newjobs (20 x 8)
def gennewjobinf(time, siteinf): #TODO: base demand on supply
result = []
for i in range(0, NEWJOBS):
randsite = random.randint(0, MAXSITES-1)
pilex = -1
piley = -1
woodtype = siteinf[randsite][SITE_TYPE]
loglen = siteinf[randsite][SITE_LOGLEN]
demand = floor(random.uniform(0.5, 1)*siteinf[randsite][SITE_SUPPLY])
deadline = time + random.randint(1000, 10000)
fine = random.randint(1, 5)
reward = demand * getlogprice(woodtype, loglen)
newjobinf = [pilex, piley, woodtype, loglen, demand, deadline, fine, reward]
result.append(newjobinf)
return result
## returns random update time based on a given time offset
def randupdatetime(offset):
return offset + random.randint(500, 2000)
## returns random number of logs by which a supply is increased
def randsupplyupdate():
return random.randint(10, 100)
## returns random maxgreen and maxyellow values
def randcompaclimits():
maxgreen = random.randint(15000, 30000)
maxyellow = maxgreen + random.randint(5000, 15000)
return maxgreen, maxyellow
## returns randomly generated siteinfos (10 x 7)
def gensiteinf():
result = []
for i in range(0, MAXSITES):
sitex = (i+1)*3
sitey = random.randint(1, MAPSIZE)
woodtype = random.randint(1, WOOD_TYPES)
loglen = random.randint(3, 9)
supply = random.randint(100, 300)
## supply update times and number of logs that will be added
suptime1 = randupdatetime(0)
suptime2 = randupdatetime(suptime1)
suptime3 = randupdatetime(suptime2)
supup1 = randsupplyupdate()
supup2 = randsupplyupdate()
supup3 = randsupplyupdate()
maxgreen, maxyellow = randcompaclimits()
## soil update times and weight limits
soiltime1 = randupdatetime(0)
soiltime2 = randupdatetime(soiltime1)
soiltime3 = randupdatetime(soiltime2)
greenup1, yellowup1 = randcompaclimits()
greenup2, yellowup2 = randcompaclimits()
greenup3, yellowup3 = randcompaclimits()
siteinf = [sitex, sitey, woodtype, loglen, supply, suptime1, suptime2, suptime3, supup1, supup2, supup3, maxgreen, maxyellow, soiltime1, soiltime2, soiltime3, greenup1, greenup2, greenup3, yellowup1, yellowup2, yellowup3]
result.append(siteinf)
return result
## returns list of site-, pile- and forwarder positions
def getposlist(siteinf, jobinf, forwarder):
result = []
for s in siteinf:
result.append([s[SITE_SITEX], s[SITE_SITEY]])
for j in jobinf:
result.append([j[JOB_PILEX], j[JOB_PILEY]])
result.append([forwarder[FORW_X][0], forwarder[FORW_Y][0]])
return result
## returns distance between two points
def dist(x1, y1, x2, y2):
if x1 != -1 and y1 != -1 and x2 != -1 and y2 != -1:
return int(sqrt(pow(x1-x2, 2) + pow(y1-y2, 2)))
else:
return -1
## returns distance matrix for given list of positions (21 x 21)
def calcdistmat(poslist):
result = []
for i in range(0, len(poslist)):
idist = []
for j in range(0, len(poslist)):
x1 = poslist[i][0]
y1 = poslist[i][1]
x2 = poslist[j][0]
y2 = poslist[j][1]
idist.append(dist(x1, y1, x2, y2))
result.append(idist)
return result
## returns randomly generated forwarder info (6 x 1)
def genforwarder():
forwx = random.randint(1, MAPSIZE)
forwy = random.randint(1, MAPSIZE)
weight = 18000
load = 0
bunkcapacity = 15000
cranecapacity = 5
forwarder = [[forwx], [forwy], [weight], [load], [bunkcapacity], [cranecapacity]]
return forwarder
## returns the weight of a log, given the wood type and log length
def getlogweight(woodtype, loglen):
if woodtype == WT_PINE:
kgpm = KGPM_PINE
elif woodtype == WT_BEECH:
kgpm = KGPM_BEECH
elif woodtype == WT_OAK:
kgpm = KGPM_OAK
return kgpm*loglen
## returns the given matrix zero-padded to dimensions m x n
def zeropad(mat, m, n):
result = []
for i in range(0, m):
result.append([0 for j in range(0, n)])
for i in range(0, len(mat)):
for j in range(0, len(mat[i])):
result[i][j] = mat[i][j]
return result
## returns randomly generated initial state as a dict
def genstate():
general = gengeneral()
jobinf = genjobinf()
time = general[0][0]
siteinf = gensiteinf()
newjobinf = gennewjobinf(time, siteinf)
forestmap = genmap(siteinf)
forwarder = genforwarder()
poslist = getposlist(siteinf, jobinf, forwarder)
distmat = calcdistmat(poslist)
return {'general':general, 'forestmap':forestmap, 'jobinf':jobinf, 'newjobinf':newjobinf, 'siteinf':siteinf, 'distmat':distmat, 'forwarder':forwarder}
## returns the 3D state array (7 x 32 x 32)
def getstatearray(general, forestmap, jobinf, newjobinf, siteinf, distmat, forwarder):
result = [[] for i in range(0, 7)]
result[ST_GENERAL] = zeropad(general, 32, 32)
result[ST_MAP] = zeropad(forestmap, 32, 32)
result[ST_JOBINF] = zeropad(jobinf, 32, 32)
result[ST_NEWJOB] = zeropad(newjobinf, 32, 32)
result[ST_SITEINF] = zeropad(siteinf, 32, 32)
result[ST_DIST] = zeropad(distmat, 32, 32)
result[ST_FORW] = zeropad(forwarder, 32, 32)
return result
if __name__ == '__main__':
statedict = genstate()
general = statedict['general']
forestmap = statedict['forestmap']
jobinf = statedict['jobinf']
newjobinf = statedict['newjobinf']
siteinf = statedict['siteinf']
distmat = statedict['distmat']
forwarder = statedict['forwarder']
statearray = getstatearray(general, forestmap, jobinf, newjobinf, siteinf, distmat, forwarder)
for i, layer in enumerate(statearray):
print('----------------------------------')
print(LAYER_NAMES[i+1])
print('----------------------------------')
for inf in layer:
print(inf)
......@@ -4,7 +4,7 @@ import sys
import time
import numpy as np
from ms_roswrapper import RosSimConnector
from singlestep_roswrapper import RosSimConnector
from optparse import OptionParser
TRAINING_MODE = 0
......
......@@ -33,7 +33,7 @@ xterm -title "ROSCORE" -e "roscore; bash" &
sleep 10
echo "Start up environment..."
xterm -title "Forest-Sim" -e "python bin/dummysim/${ARCH}/launcher.py --quiet --eval; bash" &
xterm -title "Forest-Sim" -e "python bin/dummysim/${ARCH}_launcher.py --quiet --eval; bash" &
sleep 2
if [ "$BENCHMARK" = "none" ]; then
......
......@@ -17,7 +17,7 @@ xterm -title "ROSCORE" -e "roscore; bash" &
sleep 10
echo "Start up environment..."
xterm -title "Forest-Sim" -e "python bin/dummysim/multistep/launcher.py --quiet; bash" &
xterm -title "Forest-Sim" -e "python bin/dummysim/multistep_launcher.py --quiet; bash" &
sleep 2
echo "Start up preprocessor..."
......
......@@ -25,7 +25,7 @@ xterm -title "ROSCORE" -e "roscore; bash" &
sleep 10
echo "Start up environment..."
xterm -title "Forest-Sim" -e "python bin/dummysim/${ARCH}/launcher.py --quiet; bash" &
xterm -title "Forest-Sim" -e "python bin/dummysim/${ARCH}_launcher.py --quiet; bash" &
sleep 2
echo "Start up preprocessor..."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment