예제 #1
0
def main():
    """
    Relaxed Checkpoint Simulator simulates the execution of an application given the job parameters required
    """
    MAX_JOBS = 10
    RUNTIME = 50 * HOUR
    OCI_LIST = [
        1.2 * HOUR, 1.7 * HOUR, 2.1 * HOUR, 2.8 * HOUR, 3.3 * HOUR, 4.7 * HOUR
    ]
    BETA_LIST = [
        0.1 * HOUR, 0.2 * HOUR, 0.25 * HOUR, 0.3 * HOUR, 0.35 * HOUR,
        0.4 * HOUR
    ]

    # Ask for Input
    print("Relaxed Checkpointing Simulator")
    print("Configurations. \n 1) Maximum number of jobs:", MAX_JOBS,
          "\n 2) Total compute time    :", RUNTIME, "seconds\n")

    system = Machine()
    simulator_properties = SimulatorProperties(RUNTIME)
    simulator = Simulator(system, simulator_properties)

    initialize_jobs(system, OCI_LIST, BETA_LIST, MAX_JOBS)
    simulator.__do_simulation__()
예제 #2
0
def runCoherenceFadingTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 300},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 3},
        'map': {'type': 'soft',
                'bitsPerSymbol': 10},
        'channel': {'type': 'coherence-fading',
                    'interval': 10,
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 16,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'sequential',
                     'maxPasses': 48*8},
        'statistics': {'type': 'errors'}
        }
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4), 
                               100)
    print str(res)
예제 #3
0
def runRaptorTest():
    experimentSpec = {
            'packetGen': {'type': 'random',
                          'length': 9500},
            'code': {'type': 'raptor'},
            'map': {'type': 'QAM',
                    'bitsPerSymbol': 6},
            'channel': {'type': 'AWGN_c',
                        'SNR_dB': 20},
            'demap': {'type': 'QAM',
                      'useApprox': True},
            'decoder': {'type': 'raptor',
                        'numIter': 40},
            'detector': {'type': 'oracle'},
            'protocol': {'type': 'rate-approx',
                         'maxSymbols': 11500,
                         'delta': 0.97,
                         'minSymbols':1280},
            'statistics': {'type': 'errors'}
            }
    runner = Simulator(2)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4), 
                               3)
    print str(res)
예제 #4
0
def runBscLDPCTest():
    experimentSpec = {
           'packetGen': {'type': 'random',
                          'length': 648*2/3},
            'code': {'type': 'ldpc',
                     'n': 648,
                     'rate': (2,3),
                     'bitsPerSymbol': 1},
            'map': {'type': 'linear',
                    'bitsPerSymbol': 1,
                    'precisionBits': 1},
            'channel': {'type': 'BSC',
                        'flipProb': 0.04},
            'demap': {'type': 'BSC',
                      'flipProb': 0.04},
            'decoder': {'type': 'ldpc-float-bp',
                        'numIter': 40},
            'detector': {'type': 'oracle'},
            'protocol': {'type': 'one-try',
                         'numSymbols': 648},
            'statistics': {'type': 'errors'}
             }
    runner = Simulator(0)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4), 
                               100)
    print str(res)
예제 #5
0
def runParallelKTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 300},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 3},
        'map': {'type': 'linear',
                'bitsPerSymbol': 10,
                'precisionBits': 14},
        'channel': {'type': 'AWGN',
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'parallel',
                    'alpha': 4,
                    'beta': 64,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'sequential',
                     'maxPasses': 48*8},
        'statistics': {'type': 'errors'}
        }
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4), 
                               10)
    print str(res)
예제 #6
0
def runFirstErrorStatisticsTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 256},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 4},
        'map': {'type': 'linear',
                'bitsPerSymbol': 10,
                'precisionBits': 14},
        'channel': {'type': 'AWGN',
                    'SNR_dB': -2},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 100,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'one-try',
                     'numSymbols': 256*2},
        'statistics': {'type': 'first-error'}
        }
    runner = Simulator(1)
    for i in xrange(10):
        res = runner.runExperiment(experimentSpec, 
                                   numpy.random.RandomState().tomaxint(4), 
                                   1)
        print str(res),
    print 
예제 #7
0
def runItppQamLDPCTest():
    experimentSpec = {
            'packetGen': {'type': 'random',
                          'length': 648*5/6},
            'code': {'type': 'ldpc',
                     'n': 648,
                     'rate': (5,6),
                     'bitsPerSymbol': 1},
            'map': {'type': 'QAM',
                    'bitsPerSymbol': 6},
            'channel': {'type': 'AWGN_c',
                        'SNR_dB': 17.8},
            'demap': {'type': 'QAM'},
            'decoder': {'type': 'ldpc-float-bp',
                        'numIter': 40},
            'detector': {'type': 'oracle'},
            'protocol': {'type': 'one-try',
                         'numSymbols': 648/6},
            'statistics': {'type': 'errors'}
            }
    runner = Simulator(0)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4), 
                               100)
    print str(res)
    def doT1nT2n(self,Community_Coordinate):
        nPnt= 10   #1000
        nLink= 11  #40
        
        tests=""
        s=Simulator(nPnt)
        s.genPoints(Community_Coordinate)
        #s.genRandomLinks(nLink*nPnt)

        return s.pAll
        
        
##        f2=    open('doT1nT2n2.txt', 'w')
##        for i in range(0,100):
##            for j in range(0,i+1):   
##                nSteps=self.MutiTimesNoGen(s,1,i,j,0.5,0.2)
##                print str(i)+"\t"+ str(j) +"\t"+str(nSteps)
##                f2.write(str(i)+"\t"+ str(j) +"\t"+str(nSteps)+"\n")
##                tests=tests+str(nSteps)+"\t"
##            for j in range(i,101):  
##                tests=tests+"0\t"
##            tests=tests+("\n")    
##        f = open('doT1nT2n.txt', 'w')
##        f.write(tests)
                  
        return    
예제 #9
0
def runItppQamLDPCTest():
    experimentSpec = {
            'packetGen': {'type': 'random',
                          'length': 648*5/6},
            'code': {'type': 'ldpc',
                     'n': 648,
                     'rate': (5,6),
                     'bitsPerSymbol': 1},
            'map': {'type': 'QAM',
                    'bitsPerSymbol': 6},
            'channel': {'type': 'AWGN_c',
                        'SNR_dB': 17.8},
            'demap': {'type': 'QAM'},
            'decoder': {'type': 'ldpc-float-bp',
                        'numIter': 40},
            'detector': {'type': 'oracle'},
            'protocol': {'type': 'one-try',
                         'numSymbols': 648/6},
            'statistics': {'type': 'errors'}
            }
    runner = Simulator(0)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4) % 4294967295,
                               100)
    print str(res)
예제 #10
0
def main():
    import this
    root = tkinter.Tk()
    root.title('Brownian Motion Simulation')
    simulator = Simulator(root, 50)
    simulator.simulate(300, 0.3)
    root.mainloop()
예제 #11
0
def main():
    cfg.load()
    cfg.print_all()

    hexes = [
        Person(i=0, j=0),
        Person(i=0, j=-5),
        Person(i=5, j=-5),
        Person(i=-4, j=5)
    ]

    # person = Person(i=0, j=0)
    # for i in range(10):
    #     print(person.go_brr(hexes).name)

    # pop = Population()
    # pop.get_by_id(4).state = State.Deceased
    # pop.get_by_id(5).state = State.Recovered
    # print(pop)

    sim = Simulator()
    # print(sim.population)
    # d = Drawer.Drawer()
    # d.draw_hexes(sim.plane.hexagons, hexes)
    # print(util.get_surrounding(hexes[1].coordinates, sim.plane.hexagons))
    # sim.tick()
    # sim.tick()
    for i in range(10):
        sim.tick()
예제 #12
0
def runLDPCTest():
    experimentSpec = {
            'packetGen': {'type': 'random',
                          'length': 648*5/6},
            'code': {'type': 'ldpc',
                     'n': 648,
                     'rate': (5,6),
                     'bitsPerSymbol': 3},
            'map': {'type': 'gray',
                    'bitsPerSymbol': 3,
                    'precisionBits': 14},
            'channel': {'type': 'AWGN',
                        'SNR_dB': 17.8},
            'demap': {'type': 'ml-gray',
                      'SNR_dB': 17.8},
            'decoder': {'type': 'ldpc-float-bp',
                        'numIter': 40},
            'detector': {'type': 'oracle'},
            'protocol': {'type': 'one-try',
                         'numSymbols': 648/3},
            'statistics': {'type': 'errors'}
            }
    runner = Simulator(0)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().randint(0,4294967295,4), 
                               100)
    print str(res)
예제 #13
0
def runTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 300},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 3},
        'map': {'type': 'linear',
                'bitsPerSymbol': 10,
                'precisionBits': 14},
        'channel': {'type': 'AWGN',
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 16,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'sequential',
                     'maxPasses': 48*8},
        'statistics': {'type': 'errors'}
        }
    runner = Simulator(2)
    logging.debug('runtest begin');
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().randint(0,4294967295,4), 
                               100)
    print str(res)
예제 #14
0
    def wake_learning(self, random_movements, veh_pos=None, graphics=True):
        """ Create a vehicle and run for some time-steps """
        self.random_movements = random_movements
        # Create vehicle in simulation
        self.sim = Simulator(self.light)

        if veh_pos is None:
            vehicle_pos, vehicle_angle = find_random_pos(self.light)
        else:
            vehicle_pos, vehicle_angle = veh_pos, random.randint(0, 360)

        self.random_vehicle = self.sim.init_simulation(random_movements,
                                                       graphics=graphics,
                                                       cycle='wake (training)',
                                                       veh_pos=vehicle_pos,
                                                       veh_angle=vehicle_angle)
        vehicle_move = [[
            self.random_vehicle.motor_left[0],
            self.random_vehicle.motor_right[0],
            self.random_vehicle.sensor_left[0],
            self.random_vehicle.sensor_right[0]
        ]]
        for t in range(1, random_movements):
            vehicle_move.append([
                self.random_vehicle.motor_left[t],
                self.random_vehicle.motor_right[t],
                self.random_vehicle.sensor_left[t],
                self.random_vehicle.sensor_right[t]
            ])
        vehicle_first_move = []
        for t in range(0, len(vehicle_move)):
            vehicle_first_move.append(np.transpose(np.array(vehicle_move[t])))
        self.vehicle_first_move = np.transpose(np.array(vehicle_first_move))
    def doT1nT2n(self, Community_Coordinate):
        nPnt = 10  #1000
        nLink = 11  #40

        tests = ""
        s = Simulator(nPnt)
        s.genPoints(Community_Coordinate)
        #s.genRandomLinks(nLink*nPnt)

        return s.pAll

        ##        f2=    open('doT1nT2n2.txt', 'w')
        ##        for i in range(0,100):
        ##            for j in range(0,i+1):
        ##                nSteps=self.MutiTimesNoGen(s,1,i,j,0.5,0.2)
        ##                print str(i)+"\t"+ str(j) +"\t"+str(nSteps)
        ##                f2.write(str(i)+"\t"+ str(j) +"\t"+str(nSteps)+"\n")
        ##                tests=tests+str(nSteps)+"\t"
        ##            for j in range(i,101):
        ##                tests=tests+"0\t"
        ##            tests=tests+("\n")
        ##        f = open('doT1nT2n.txt', 'w')
        ##        f.write(tests)

        return
예제 #16
0
파일: Main.py 프로젝트: giomasce/codebots
def main():
    logging.basicConfig(level = logging.DEBUG,
                        format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
    simulator = Simulator()
    manager = Manager(simulator)
    ticker = Ticker(1.0, manager)
    xmlrpcserver = XMLRPCServer(manager)
    pbrpcserver = PBRPCServer(manager)

    # Add some random tanks
    for team in range(4):
        for tank in range(100):
            retry = True
            while retry:
                pos = (random.randint(-100, 100), random.randint(-100, 100))
                if pos not in simulator.position:
                    simulator.create_tank(Tank(team, pos))
                    retry = False

    logging.info("Starting main threads")
    ticker.start()
    # The XML-RPC server isn't maintained at the moment
    #xmlrpcserver.start()
    pbrpcserver.start()

    # To stop the system with Ctrl-C
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        ticker.self_destruct()
예제 #17
0
    def __init__(self, netlist, tspice, sync_obj):
        """Constructor."""

        # Create sync object, and set debug and simulation path
        self.sync_obj = sync_obj

        self.DEBUG = self.sync_obj.getDebug(
            "Tanner") or self.sync_obj.getDebug("all")

        self.sync_obj.appendToSimulationPath("Tanner")

        if self.DEBUG:
            print('Running Tanner...')

        Simulator.__init__(self, netlist=netlist, sync_obj=sync_obj)

        # Netlist path of circuit to be simulated.
        self.netlist = netlist

        # tspice path
        self.tspice = tspice

        # Output simulation waves. Each key corresponds to a different wave.
        self.waves = None

        pass
예제 #18
0
def runRateApproxProtocolTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 24},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 4},
        'map': {'type': 'linear',
                'bitsPerSymbol': 10,
                'precisionBits': 14},
        'channel': {'type': 'AWGN',
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 16,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'rate-approx',
                     'maxSymbols': 48*7,
                     'delta': 0.99},
        'statistics': {'type': 'errors'}
        }
    if 1==0:
        experimentSpec['protocol'] = {'type': 'sequential', 'maxPasses':48*8}
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4), 
                               500)
    print str(res)
예제 #19
0
def runGaussianTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 300},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 3},
        'map': {'type': 'trunc-norm-v2',
                'bitsPerSymbol': 10,
                'precisionBits': 14,
                'numStandardDevs': 0.1},
        'channel': {'type': 'AWGN',
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 16,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'sequential',
                     'maxPasses': 48*8},
        'statistics': {'type': 'errors'}
        }
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4) % 4294967295,
                               100)
    print str(res)
예제 #20
0
def runRateApproxProtocolTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 24},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 4},
        'map': {'type': 'linear',
                'bitsPerSymbol': 10,
                'precisionBits': 14},
        'channel': {'type': 'AWGN',
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 16,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'rate-approx',
                     'maxSymbols': 48*7,
                     'delta': 0.99},
        'statistics': {'type': 'errors'}
        }
    if 1==0:
        experimentSpec['protocol'] = {'type': 'sequential', 'maxPasses':48*8}
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4) % 4294967295,
                               500)
    print str(res)
예제 #21
0
	def _run_simulation(self, num_investments):
		'''Run a single simulation with a given number of investments

		For each position, the number of investments is the number of rows.
		For each investment, we run num_trial trials, where each trial is
		a column in that row.

		We multiply all the trials for each investment by the value of that
		investment, which is simply the intial budget divided by the number
		of investments.

		For each trial (column), we sum up the returns from all the investments
		(rows), producing a 1xnum_trials array with the cumulative returns from 
		each day.'''

		position_value = self.initial_budget / num_investments

		# Create the simulator object
		simulator = Simulator({(0, .51): 1.0, (.51, 1): -1.0}, 
								nrows=num_investments, 
								ncols=self.num_trials) 

		# Run the simulator, and multiply each of the results by the value
		# of a share for this position
		trial_returns = simulator.run() * position_value

		# Collapse all investments on each day into cumulative return
		cumu_ret = self.initial_budget + trial_returns.sum(axis=0)

		# The daily rate of return, which is the final result
		daily_ret = (cumu_ret / float(self.initial_budget)) - 1.

		return daily_ret
예제 #22
0
def main():
    root = tkinter.Tk()
    root.title('Brownian Motion Simulation')
    simulator = Simulator(root)
    numSapienses = input("Please input numSapienses:")
    simulator.simulate(int(numSapienses), 0.01)
    root.mainloop()
예제 #23
0
def get_fitness(start_pos, start_a, brain, iterations, light, test_data=None):
    """
    Returns the fitness of a vehicle using real-world simulation
    :param start_pos: vehicle starting position
    :param start_a: vehicle starting angle
    :param brain: vehicle brain
    :param iterations: number of iterations to run simulation for
    :param light: the light of the simulation
    :return: fitness of vehicle
    """
    # create sprites
    vehicle = BrainVehicle(start_pos, start_a, light)
    vehicle.set_values(brain)
    # create Simulation
    vehicle = Simulator(light).run_simulation(iterations, False, vehicle)
    fitness = np.mean(vehicle.sensor_left) + np.mean(vehicle.sensor_right)

    # check for other initial conditions
    if test_data is not None:
        for test in test_data:
            vehicle = BrainVehicle(test[0], test[1], light)
            vehicle.set_values(brain)
            vehicle = Simulator(light).run_simulation(iterations, False,
                                                      vehicle)
            fitness += np.mean(vehicle.sensor_left) + np.mean(
                vehicle.sensor_right)
        fitness /= len(test_data) + 1
    return fitness
예제 #24
0
def runRaptorTest():
    experimentSpec = {
            'packetGen': {'type': 'random',
                          'length': 9500},
            'code': {'type': 'raptor'},
            'map': {'type': 'QAM',
                    'bitsPerSymbol': 6},
            'channel': {'type': 'AWGN_c',
                        'SNR_dB': 20},
            'demap': {'type': 'QAM',
                      'useApprox': True},
            'decoder': {'type': 'raptor',
                        'numIter': 40},
            'detector': {'type': 'oracle'},
            'protocol': {'type': 'rate-approx',
                         'maxSymbols': 11500,
                         'delta': 0.97,
                         'minSymbols':1280},
            'statistics': {'type': 'errors'}
            }
    runner = Simulator(2)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4) % 4294967295,
                               3)
    print str(res)
 def doT1pT2p(self):
     print Community_Coordinate
     nPnt=1000
     nLink=40
     nT1=40
     nT2=20
     tests=""
     s=Simulator(nPnt)
     s.genPoints()
     s.genRandomLinks(nLink*nPnt) 
     
     f2 = open('doT1pT2p2.txt', 'w')               
     for i in range(0,101):     
         for j in range(0,i+1):   
             nSteps=self.MutiTimesNoGen(s,1,nT1,nT2,0.01*i,0.01*j)
             print str(i)+"\t"+ str(j) +"\t"+str(nSteps)
             f2.write(str(i)+"\t"+ str(j) +"\t"+str(nSteps)+"\n")
             tests=tests+str(nSteps)+"\t"
         for j in range(i,101):  
             tests=tests+"0\t"
         tests=tests+("\n")    
     f = open('doT1pT2p.txt', 'w')
     f.write(tests)
               
     return       
예제 #26
0
def runCoherenceFadingTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 300},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 3},
        'map': {'type': 'soft',
                'bitsPerSymbol': 10},
        'channel': {'type': 'coherence-fading',
                    'interval': 10,
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 16,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'sequential',
                     'maxPasses': 48*8},
        'statistics': {'type': 'errors'}
        }
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4) % 4294967295,
                               100)
    print str(res)
 def __init__(self, flightParamsTemplate, submissionFile, testFlightsFile):
     self.submissionFile = submissionFile
     self.flightParamsTemplate = flightParamsTemplate
     self.testFlightsFile = testFlightsFile
     print "Starting simulator using:", testFlightsFile
     self.simulator = Simulator()
     print "Simulator started."
예제 #28
0
def runBscLDPCTest():
    experimentSpec = {
           'packetGen': {'type': 'random',
                          'length': 648*2/3},
            'code': {'type': 'ldpc',
                     'n': 648,
                     'rate': (2,3),
                     'bitsPerSymbol': 1},
            'map': {'type': 'linear',
                    'bitsPerSymbol': 1,
                    'precisionBits': 1},
            'channel': {'type': 'BSC',
                        'flipProb': 0.04},
            'demap': {'type': 'BSC',
                      'flipProb': 0.04},
            'decoder': {'type': 'ldpc-float-bp',
                        'numIter': 40},
            'detector': {'type': 'oracle'},
            'protocol': {'type': 'one-try',
                         'numSymbols': 648},
            'statistics': {'type': 'errors'}
             }
    runner = Simulator(0)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4) % 4294967295,
                               100)
    print str(res)
예제 #29
0
def main(i, is_worst_case):
    sim = Simulator(n, f, GoodPlayer, BadPlayer, is_worst_case=is_worst_case)
    res_lst = sim.simulate(i)
    plt.xlabel("Number of turns")
    plt.ylabel("Percentage of good policies")
    plt.plot(range(1, i+1), res_lst, 'o')
    plt.show()
예제 #30
0
def test_SVSS_sevreal_runs():
    sim = RBRandomOrderSimulator(4, 1)
    players = {i: Player(sim, i, 4, 1) for i in range(1, 4 + 1)}
    sim.players = players
    runs = 5

    def helper(i):
        dealer = players[randint(1, 4)]
        secret = randint(1, 40)
        dealer.deal_SVSS(secret)

        tag = (dealer.c, dealer.id)
        return dealer, secret, tag

    dealer = []
    secret = []
    tag = []


    for i in range(runs):
        data = helper(i)

        dealer.append(data[0])
        secret.append(data[1])
        tag.append(data[2])

    while sim.remaining():
        sim.step()

    for i in range(runs):
        assert all(tag[i] in player.SVSS_val for player in players.values()), "No secret reconstructed"
        assert all(player.SVSS_val[tag[i]] == secret[i] for player in players.values()), "Wrong secret reconstructed"
예제 #31
0
def runFirstErrorStatisticsTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 256},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 4},
        'map': {'type': 'linear',
                'bitsPerSymbol': 10,
                'precisionBits': 14},
        'channel': {'type': 'AWGN',
                    'SNR_dB': -2},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 100,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'one-try',
                     'numSymbols': 256*2},
        'statistics': {'type': 'first-error'}
        }
    runner = Simulator(1)
    for i in xrange(10):
        res = runner.runExperiment(experimentSpec, 
                                   numpy.random.RandomState().tomaxint(4) % 4294967295,
                                   1)
        print str(res),
    print 
예제 #32
0
def runParallelKTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 300},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 3},
        'map': {'type': 'linear',
                'bitsPerSymbol': 10,
                'precisionBits': 14},
        'channel': {'type': 'AWGN',
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'parallel',
                    'alpha': 4,
                    'beta': 64,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'sequential',
                     'maxPasses': 48*8},
        'statistics': {'type': 'errors'}
        }
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4) % 4294967295,
                               10)
    print str(res)
예제 #33
0
파일: game.py 프로젝트: AndySze/RoboticCar
class Game:
    
    def __init__ (self, complexity = 8, width=1000, height=800, margin=100):
        world = Landscape (terrain = [ground(margin, margin, width-margin, height-margin) for i in range(complexity)])
        self.board = Simulator(world, width=width, height=height)

    def play(self):
        self.board.interactive()
예제 #34
0
    def getScore(self, pos, it):
        '''Determines how close a particle is to the optima - lower is better
		'''
        uavPoly = pos[:len(pos) // 2]
        targetPoly = pos[len(pos) // 2:]
        sim = Simulator(uavPoly, targetPoly, f"test{it}")
        score = sim.runTest()
        return score
예제 #35
0
    def __init__(self, light_pos, type=None, net_filename=None):

        self.net = None  # NARX network
        self.net_filename = net_filename

        # network training
        self.training_runs, self.training_time = None, None
        self.random_movements, self.after_ga_movements = None, None

        if type == 'skmlp':
            self.net = narx.load_narx_mlp(net_filename)
        if net_filename is not None:
            start_time = time.time()
            saved_net = narx.load_pyrenn(net_filename)
            self.net = PyrennNarx()
            self.net.set_net(saved_net)
            self.training_runs = int(
                re.search('\d+',
                          re.search('r\d+', net_filename).group(0)).group(0))
            self.training_time = int(
                re.search('\d+',
                          re.search('t\d+', net_filename).group(0)).group(0))
            self.network_delay = int(
                re.search('\d+',
                          re.search('d\d+', net_filename).group(0)).group(0))
            print 'Loaded NARX from file "%s" in %ds' % (
                net_filename, time.time() - start_time)

        self.vehicle_training_data = None  # this data will hold all the vehicles that the network will train with
        self.ga_test_data = None  # this data will hold all the vehicles that the GA will test the fitness from
        self.pos_before_collect = None  # first position of vehicle before random collection
        self.ang_before_collect = None  # first angle of vehicle before random collection
        self.collection_vehicle_pos = [
        ]  # all pos of collection vehicle to pass to wakeTest vehicle to show on Sim
        self.pos_after_collect = None  # last position of vehicle after collection (passed to GA)
        self.ang_after_collect = None  # last angle of vehicle after collection (passed to GA)

        self.random_vehicle = None
        self.brain = None  # Vehicle brain assigned after GA, 6 weights
        self.vehicle_first_move = None
        self.predicted_pos = None

        self.ga_individuals = None
        self.ga_generations = None

        if light_pos is None:
            light_pos = [1100, 600]
        self.light = Light(light_pos)
        self.sim = Simulator(self.light)

        self.actual_vehicle = None

        self.count_cycles = 0

        # vars for test_2_1
        self.error_sensor_log = None  # predicted sensor log
        self.real_sensor_log = None  # actual sensor log
	def __init__(self, budget, unitPrice):
		Simulator.__init__(self, budget, unitPrice)
		self.Kp = - 100 / (budget * 0.25)
		self.Ki = -7
		self.OUTPUT_NAME = 'output2.csv'
		self.INTEGRAL_OFFSET_RATIO = 0.01
		self.errorIntegral = 0
		# INTEGRAL 에러 누적으로 windup 방지를 위해 만듦
		self.INTEGRAL_ERROR_LIMIT = 1
예제 #37
0
 def __init__(self, test_flights_info, zoneOptions, npts_per_leg, flightParamsTemplate, submission_file):
     self.test_flights_info  = test_flights_info
     self.zoneOptions        = zoneOptions
     self.npts_per_leg       = npts_per_leg
     self.submission_file    = submission_file
     self.flightParamsTemplate = flightParamsTemplate
     print "Starting simulator..."
     self.simulator = Simulator()
     print "Simulator started."
예제 #38
0
class Game:
    def __init__(self, complexity=8, width=1000, height=800, margin=100):
        world = Landscape(terrain=[
            ground(margin, margin, width - margin, height - margin)
            for i in range(complexity)
        ])
        self.board = Simulator(world, width=width, height=height)

    def play(self):
        self.board.interactive()
예제 #39
0
파일: Q1.py 프로젝트: codehatch/school-work
def main():

	NUM_INITIAL_MOBILES = 150
	SIMULATION_ITERATIONS = 3600

	print("callAttempts, blkSig, blkCap, dropSig, HOfail, HO, complSuc, talkTime, GOS, HOFR, intensity")

	for iteration in range(10):
		simulator = Simulator(NUM_INITIAL_MOBILES, 1.0/3600)
		simulator.run(SIMULATION_ITERATIONS, iteration)
예제 #40
0
def penaltyFunction(lamb, mu, numServers, simTime, numReps, maxMIPS, aggressivness):
    mySim = Simulator(lam, mu, numServers, simTime, numRepsSim, maxMIPS, aggressivness)
    mySim.runSimulation()
    totalPenalty = 0

    maxTemps                = mySim.getMaxTemps()
    responseTimes           = mySim.getAvgResponseTime()
    avgjobsinsys            = mySim.getAvgJobsInSimulation()
    avgUtilizations         = mySim.getAvgServerUtils()
    powerConsumedByServers  = mySim.getPowerConsumptions()

    for rep in powerConsumedByServers:
        repIndex = powerConsumedByServers.index(rep)

        print '*****************************************************'
        print 'Log dump for rep', repIndex+1
        print 'Avg avg utils: ', sum(avgUtilizations[repIndex]) / len(avgUtilizations[repIndex])
        print 'Avg power consumed', sum(powerConsumedByServers[repIndex]) / len(powerConsumedByServers[repIndex])
        print 'Avg Response Time', sum(responseTimes[repIndex]) / len(responseTimes[repIndex])
        for i in range(0, len(rep)):
            print 'Server', i, '\tUtil:', avgUtilizations[repIndex][i], '\tMax temp:', maxTemps[repIndex][i],  '\t\tConsumed:', powerConsumedByServers[repIndex][i], '\tRT:', responseTimes[repIndex][i]

        maxTempForRep      = max(maxTemps[repIndex])
        maxPowerConsForRep = max(powerConsumedByServers[repIndex])
        maxUtilForRep      = max(avgUtilizations[repIndex])
        maxRTForRep        = max(responseTimes[repIndex])

        # Huge penalties for infeasible solutions
        if maxTempForRep > maxTemperature:
            totalPenalty += maxTempForRep
        if maxUtilForRep > maxUtilization:
            totalPenalty += maxUtilForRep
        if maxRTForRep > maxResponseTime:
            totalPenalty += maxRTForRep

        # Calculate norms against the maximums for each list
        # No actual use for this, penalties wouldn't make sense since the normalized scores can only be compared relative to the max...
        # normMaxTemps        = [float(i)/maxTempForRep for i in maxTemps[repIndex]].sort(reverse=True)
        # normPowerConsumed   = [float(i)/maxPowerConsForRep for i in powerConsumedByServers[repIndex]].sort(reverse=True)
        # normAvgUtils        = [float(i)/maxUtilForRep for i in avgUtilizations[repIndex]].sort(reverse=True)
        # normResponseTimes   = [float(i)/maxRTForRep for i in responseTimes[repIndex]].sort(reverse=True)

        avgMaxTempForRep    = sum(maxTemps[repIndex]) / len(maxTemps[repIndex])
        avgPowerConsForRep  = sum(powerConsumedByServers[repIndex]) / len(powerConsumedByServers[repIndex])
        avgUtilForRep       = sum(avgUtilizations[repIndex]) / len(avgUtilizations[repIndex])
        avgRTForRep         = sum(responseTimes[repIndex]) / len(responseTimes[repIndex])

        for item in rep:
            itemIndex = rep.index(item)
            if maxTemps[repIndex][itemIndex] > avgMaxTempForRep:
                totalPenalty += maxTemps[repIndex][itemIndex] - avgMaxTempForRep
            if powerConsumedByServers[repIndex][itemIndex] > avgPowerConsForRep:
                totalPenalty += powerConsumedByServers[repIndex][itemIndex] - avgPowerConsForRep
            if avgUtilizations[repIndex][itemIndex] > avgUtilForRep:
                totalPenalty += avgUtilizations[repIndex][itemIndex] - avgUtilForRep
            if responseTimes[repIndex][itemIndex] > avgRTForRep:
                totalPenalty += responseTimes[repIndex][itemIndex] - avgRTForRep
        # ENDFOR
    return totalPenalty
예제 #41
0
 def doT2Number(self):            
     tests=[]
     s=Simulator(1000,40,1)
     s.genPoints()
     s.genRandomLinks(40)
     for i in range(10,31):        
         nSteps=self.MutiTimesNoGen(s,2,30,i,0.5,0.2)
         print str(i) +"\t"+str(nSteps)
         tests.append(nSteps)
     print tests               
     return 
예제 #42
0
 def doT2P(self):
     tests=[]
     s=Simulator(1000,40)
     s.genPoints()
     s.genLinks()
     for i in range(10,51):        
         nSteps=self.MutiTimesNoGen(s,1,20,0.5,0.01*i)
         print str(i*0.01) +"\t"+str(nSteps)
         tests.append(nSteps)
     print tests               
     return         
예제 #43
0
def test_net(p):
    with open(p, "rb") as p:
        dic = pickle.load(p)
    network = dic["sim"].network
    K_pl = network.K_pl
    K_ep = network.K_ep
    inputgen = BehavioralInput(pre_seed_loc=13, K_pl=K_pl, K_ep=K_ep)
    sim = Simulator(network, inputgen)
    m, f = sim.simulate()
    pm.plot_main(sim, f)
    pm.plot_J(sim)
예제 #44
0
 def predict_ball(self, nticks=51):
     self.positions = []
     sim = Simulator([], self.ball, self.rules)
     v1 = self.ball.position
     self.positions.append(v1)
     step = 1
     for i in range(round(nticks / step)):
         sim.tick(step=step)
         self.render.add_line(v1, sim.ball.position)
         v1 = sim.ball.position
         self.positions.append(v1)
예제 #45
0
파일: Q1.py 프로젝트: codehatch/school-work
def main():

    NUM_INITIAL_MOBILES = 150
    SIMULATION_ITERATIONS = 3600

    print(
        "callAttempts, blkSig, blkCap, dropSig, HOfail, HO, complSuc, talkTime, GOS, HOFR, intensity"
    )

    for iteration in range(10):
        simulator = Simulator(NUM_INITIAL_MOBILES, 1.0 / 3600)
        simulator.run(SIMULATION_ITERATIONS, iteration)
예제 #46
0
파일: euchre.py 프로젝트: CyberSmash/euchre
def main():

    logging.basicConfig(format=FORMAT, level=logging.WARN, filename="gamelog.txt")
    # @todo: this may not be necessary in the future.
    dbase = db.quick_setup()
    dbase.choices.delete_many({})
    dbase.games.delete_many({})
    dbase.tricks.delete_many({})

    print("Deleted old data. Continuing....")
    sim = Simulator(GameType.PROGRESSIVE, 100000, BasicPlayer)
    sim.run()
    def __init__(self, sim_duration):
        super().__init__()
        # the simulation env
        self._simulator = Simulator(sim_duration)
        # dynamically get the policy agents
        self._agents = []

        # configure spaces
        self.action_space = []
        self.observation_space = []
        for agent in self._agents:
            pass
예제 #48
0
    def __init__(self,linkRate=1,maxStep=gobalMaxStep,injectRate=0.5,\
                     factory=gobalGridNetworkFactory):
        factory.constructNetwork(8,8)\
            .setFlow(Flow((2,0),(2,7),injectRate),Flow((4,0),(4,7),injectRate),
                     Flow((0,2),(7,2),injectRate),Flow((0,4),(7,4),injectRate),
                     Flow((1,1),(5,1),injectRate),Flow((6,1),(6,6),injectRate)
                     ,Flow((5,6),(1,6),injectRate),Flow((1,5),(1,2),injectRate))
        network = factory.getNetwork()

        self.packetFactory = PacketFactory()
        self.simulator = \
            Simulator(network,maxStep,ConstLinkRateGenerator(linkRate),self.packetFactory)
예제 #49
0
def oneRoundDelay(step=10000):
    injectRate = 0.9
    factory = GridNetworkFactory(makeSimpleNode(), Queues)
    factory.constructNetwork(6,6)\
        .setFlow(Flow((0,0),(0,5),injectRate))\
        .setFlow(Flow((5,0),(5,5),injectRate))\
        .setFlow(Flow((2,0),(3,5),injectRate))

    network = factory.getNetwork()

    packetFactory = PacketFactory()
    simulator = \
        Simulator(network,step,ConstLinkRateGenerator(1),packetFactory)
    simulator.run()
    #simulator.printNetwork()
    stat = simulator.getStaticsInfo()
    print stat['aveDelay']
    packetPool = sorted(stat['packetPool'], key=lambda p: p.getID)

    py.subplot(211)
    py.vlines([p.getCreateTime() for p in packetPool], [1],
              [p.getDelay() for p in packetPool], 'r')
    py.xlabel('Packet create time(bp with $\lambda$ = 0.9)')
    py.ylabel('delay')
    py.grid(True)

    injectRate = 0.9
    factory = GridNetworkFactory(makeMNode(2), Queues)
    factory.constructNetwork(6,6)\
        .setFlow(Flow((0,0),(0,5),injectRate))\
        .setFlow(Flow((5,0),(5,5),injectRate))\
        .setFlow(Flow((2,0),(3,5),injectRate))

    network = factory.getNetwork()

    packetFactory = PacketFactory()
    simulator = \
        Simulator(network,step,ConstLinkRateGenerator(1),packetFactory)
    simulator.run()
    #simulator.printNetwork()

    stat = simulator.getStaticsInfo()
    print stat['aveDelay']
    packetPool = sorted(stat['packetPool'], key=lambda p: p.getID)

    py.subplot(212)
    py.vlines([p.getCreateTime() for p in packetPool], [1],
              [p.getDelay() for p in packetPool], 'b')
    py.xlabel('Packet create time (m=2 with $\lambda$ = 0.9)')
    py.ylabel('delay')
    py.grid(True)
    py.savefig('packetDelayInOneRound_09')
    py.show()
	def __init__(self, budget, unitPrice):
		Simulator.__init__(self, budget, unitPrice)
		self.Kp = - 100 / (budget * 0.25)
		self.Ki = -5
		self.Kd = 10 / (unitPrice * 50)
		if self.budget < unitPrice * 10000:
			self.Kp = -100 / (budget * 0.999)
			self.Kd = 30 / (unitPrice * 20)
		self.OUTPUT_NAME = 'output3.csv'
		self.INTEGRAL_OFFSET_RATIO = 0.01
		self.errorIntegral = 0
		# INTEGRAL 에러 누적으로 windup 방지를 위해 만듦
		self.INTEGRAL_ERROR_LIMIT = 1
예제 #51
0
 def doT1P(self):
     tests=[]
     s=Simulator(1000)
     s.genPoints()
     #s.genLinks(10*1000)
     s.genRandomLinks(10*1000)
     #s.setPointType(nOrigins, nLink1, nLink2, p1, p2)
     for i in range(20,101):        
         nSteps=self.MutiTimesNoGen(s,1,30,10,0.01*i,0.2)
         print str(i*0.01) +"\t"+str(nSteps)
         tests.append(nSteps)
     print tests               
     return 
예제 #52
0
파일: Q3.py 프로젝트: codehatch/school-work
def main():

	NUM_INITIAL_MOBILES = 150
	SIMULATION_ITERATIONS = 3600

	print("callAttempts, blkSig, blkCap, dropSig, HOfail, HO, complSuc, talkTime, GOS, HOFR, intensity")

	for iteration in range(10):
		simulator = Simulator(NUM_INITIAL_MOBILES, 1.0/3600)
#		simulator.basestations[0].ANTENNA_GAIN = 10
#		simulator.basestations[1].ANTENNA_GAIN = 10
		simulator.basestations[0].NUM_CHANNELS = 20
		simulator.basestations[1].NUM_CHANNELS = 20
		simulator.run(SIMULATION_ITERATIONS, iteration)
예제 #53
0
def simulationLoop(server, capacity, period, scaled, ex_time, int_time):
        name = server + ".csv"
        s = Simulator(stats = name)

        # Set the server
        if server == 'polling':
            s.server = PollingServer(capacity, period)
        elif server == 'deferrable':
            s.server = DeferrableServer(capacity, period)
        else:
            s.server = BackgroundServer()


        # Load the taskset
        for t in scaled:
            s.tasks.append(t)

        # Create the aperiodic task
        ap = AperiodicTask("Soft", ex_time, int_time)
        s.tasks.append(ap)


        # RUUUUUUUUN !!!
        s.init(until)
        s.run()


        return computeAverage(name)
예제 #54
0
def runItppQamLDPCTest():
    experimentSpec = {
        "packetGen": {"type": "random", "length": 648 * 5 / 6},
        "code": {"type": "ldpc", "n": 648, "rate": (5, 6), "bitsPerSymbol": 1},
        "map": {"type": "QAM", "bitsPerSymbol": 6},
        "channel": {"type": "AWGN_c", "SNR_dB": 17.8},
        "demap": {"type": "QAM"},
        "decoder": {"type": "ldpc-float-bp", "numIter": 40},
        "detector": {"type": "oracle"},
        "protocol": {"type": "one-try", "numSymbols": 648 / 6},
        "statistics": {"type": "errors"},
    }
    runner = Simulator(0)
    res = runner.runExperiment(experimentSpec, numpy.random.RandomState().tomaxint(4), 100)
    print str(res)
예제 #55
0
def runLTTest():
    experimentSpec = {
        "packetGen": {"type": "random", "length": 1000},
        "code": {"type": "LT"},
        "map": {"type": "QAM", "bitsPerSymbol": 6},
        "channel": {"type": "AWGN_c", "SNR_dB": 17.8},
        "demap": {"type": "QAM"},
        "decoder": {"type": "LT", "numIter": 6},
        "detector": {"type": "oracle"},
        "protocol": {"type": "rate-approx", "maxSymbols": 1000, "delta": 0.97, "minSymbols": 1000 / 6},
        "statistics": {"type": "errors"},
    }
    runner = Simulator(0)
    res = runner.runExperiment(experimentSpec, numpy.random.RandomState().tomaxint(4), 10)
    print str(res)
예제 #56
0
def runRaptorTest():
    experimentSpec = {
        "packetGen": {"type": "random", "length": 9500},
        "code": {"type": "raptor"},
        "map": {"type": "QAM", "bitsPerSymbol": 6},
        "channel": {"type": "AWGN_c", "SNR_dB": 20},
        "demap": {"type": "QAM", "useApprox": True},
        "decoder": {"type": "raptor", "numIter": 40},
        "detector": {"type": "oracle"},
        "protocol": {"type": "rate-approx", "maxSymbols": 11500, "delta": 0.97, "minSymbols": 1280},
        "statistics": {"type": "errors"},
    }
    runner = Simulator(2)
    res = runner.runExperiment(experimentSpec, numpy.random.RandomState().tomaxint(4), 3)
    print str(res)
예제 #57
0
def runBscLDPCTest():
    experimentSpec = {
        "packetGen": {"type": "random", "length": 648 * 2 / 3},
        "code": {"type": "ldpc", "n": 648, "rate": (2, 3), "bitsPerSymbol": 1},
        "map": {"type": "linear", "bitsPerSymbol": 1, "precisionBits": 1},
        "channel": {"type": "BSC", "flipProb": 0.04},
        "demap": {"type": "BSC", "flipProb": 0.04},
        "decoder": {"type": "ldpc-float-bp", "numIter": 40},
        "detector": {"type": "oracle"},
        "protocol": {"type": "one-try", "numSymbols": 648},
        "statistics": {"type": "errors"},
    }
    runner = Simulator(0)
    res = runner.runExperiment(experimentSpec, numpy.random.RandomState().tomaxint(4), 100)
    print str(res)
예제 #58
0
def runShortStriderTest():
    experimentSpec = {
        "packetGen": {"type": "random", "length": 480 * 33},
        "code": {"type": "strider", "fragmentLength": 512},
        "map": {"type": "null", "avgPower": 1.0},
        "channel": {"type": "AWGN_c", "SNR_dB": 30},
        "demap": {"type": "null"},
        "decoder": {"type": "strider"},
        "detector": {"type": "oracle"},
        "protocol": {"type": "multiple-try", "numSymbolsList": [(1215 / 4) * i for i in xrange(1, 4 * 27 + 1)]},
        "statistics": {"type": "errors"},
    }
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, numpy.random.RandomState().tomaxint(4), 10)
    print str(res)
예제 #59
0
def runStriderFadingTest():
    experimentSpec = {
        "packetGen": {"type": "random", "length": 1498 * 33},
        "code": {"type": "strider"},
        "map": {"type": "null", "avgPower": 1.0},
        "channel": {"type": "coherence-fading_c", "SNR_dB": 30, "interval": 100},
        "demap": {"type": "null"},
        "decoder": {"type": "strider-fading"},
        "detector": {"type": "oracle"},
        "protocol": {"type": "multiple-try", "numSymbolsList": [(3840 / 4) * i for i in xrange(1, 4 * 27 + 1)]},
        "statistics": {"type": "errors"},
    }
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, numpy.random.RandomState().tomaxint(4), 10)
    print str(res)
예제 #60
0
def runItppQamTurboTest():
    experimentSpec = {
        "packetGen": {"type": "random", "length": 1530},
        "code": {"type": "turbo"},
        "map": {"type": "QAM", "bitsPerSymbol": 6},
        "channel": {"type": "AWGN_c", "SNR_dB": 3.2},
        "demap": {"type": "QAM"},
        "decoder": {"type": "regular"},
        "detector": {"type": "oracle"},
        "protocol": {"type": "one-try", "numSymbols": (1530 * 5 + 18) / 6},
        "statistics": {"type": "errors"},
    }
    runner = Simulator(0)
    res = runner.runExperiment(experimentSpec, numpy.random.RandomState().tomaxint(4), 100)
    print str(res)