def __init__(self, xsize, ysize, occlusions=[]):
        self.AgentHome = COORD(int(floor((xsize-1)/2)), 0)
        self.PredatorNum = 1
        self.PredatorHome = COORD(0, 0)
        self.ChaseProbability = 0.75
        self.MoveProbability = 0.5
        self.Discount = 0.95
        self.GoalPos = COORD(int(floor((xsize-1)/2)), ysize-1)

        self.Grid = Grid(xsize, ysize)

        self.NumActions = 4
        self.NumObservations = 2
        Simulator.__init__(self, self.NumActions, self.NumObservations, self.Discount)
        self.Occlusions = occlusions

        self.RewardClearLevel = 1000
        self.RewardDefault = -1
        self.RewardDie = -100
        self.RewardHitWall = -25
        self.RewardRange = 100

        self.State = GameState()
        self.State.AgentPos = self.AgentHome
        self.State.PredatorPos = self.PredatorHome
示例#2
0
 def __init__(self, **kwargs):
     Simulator.__init__(self, kwargs['simulation_time'], kwargs['dt'])
     self.simulator = tc.MPMSimulator()
     self.resolution = (kwargs['simulation_width'], kwargs['simulation_height'])
     self.simulation_width, self.simulation_height = self.resolution[0], self.resolution[1]
     self.simulator.initialize(config_from_dict(kwargs))
     self.config = kwargs
     self.delta_x = kwargs['delta_x']
     self.sample_rate = kwargs.get('sample_rate', 2)
示例#3
0
 def __init__(self, boxparam, density, temp, dr, multiplier, params,
              command_list):
     Simulator.__init__(self, boxparam, density, temp, dr, multiplier,
                        params[:2], command_list)
     self.alpha = params[2]
     self.r_a = params[3]
     self.a_g = params[4]
     self.sig_g = params[5]
     self.r_g = params[6]
示例#4
0
 def __init__(self, **kwargs):
     Simulator.__init__(self, kwargs['simulation_time'], kwargs['dt'])
     simulator_name = kwargs['simulator']
     self.simulator = tc.__dict__[simulator_name]()
     self.simulator.initialize(Simulator.config_from_dict(kwargs))
     self.config = kwargs
     self.delta_x = kwargs['delta_x']
     self.resolution = [kwargs['simulation_width'], kwargs['simulation_height']]
     self.simulation_width, self.simulation_height = self.resolution[0], self.resolution[1]
     self.sample_rate = kwargs.get('sample_rate', 2)
     self.show_pressure = kwargs.get('show_pressure', False)
示例#5
0
    def __init__(self):
        Simulator.__init__(self)
        self.stigmergy_network = copy.deepcopy(self.original_network)
        self.stigmergy_free_network = copy.deepcopy(self.original_network)

        self.long_term_stigmergies = self.short_term_stigmergies = {}
        self.today_long_term_stigmergy = self.today_short_term_stigmergy = {}
        self.edge_ids = [edge.getID().encode('utf-8') for edge in self.sumo_net.getEdges()]

        if self.conf.dce == True:
            self.dce_stigmergy = {}
            for node in self.sumo_net.getNodes():
                self.dce_stigmergy[node.getID().encode('utf-8')] = {}
示例#6
0
    def __init__(self, **kwargs):
        Simulator.__init__(self, kwargs['simulation_time'], kwargs['frame_dt'])
        self.simulator = tc_core.MPMSimulator()
        self.res = kwargs['res']
        kwargs['delta_x'] = 1.0 / min(self.res)
        self.simulator.initialize(config_from_dict(kwargs))
        self.config = kwargs
        self.delta_x = kwargs['delta_x']
        self.sample_rate = kwargs.get('sample_rate', 2)
        self.show_limits = kwargs.get('show_limits', True)

        def dummy_levelset_generator(_):
            return self.create_levelset()

        self.levelset_generator = dummy_levelset_generator
示例#7
0
    def __init__(self,
                 xsize,
                 ysize,
                 occlusions=[],
                 visualrange=None,
                 verbose=False):
        self.AgentHome = COORD(int(floor((xsize - 1) / 2)), 0)
        self.PredatorNum = 1
        self.PredatorHome = COORD(0, 0)
        self.ChaseProbability = 0.75
        self.MoveProbability = 0.5
        self.Discount = 0.95
        self.GoalPos = COORD(int(floor((xsize - 1) / 2)),
                             ysize - 1)  #int(floor((xsize-1)/2))

        self.Grid = Grid(xsize, ysize)

        self.NumActions = 4
        self.VisualRange = visualrange
        self.Occlusions = occlusions

        if not visualrange:
            self.NumObservations = 2
        else:
            self.VisionObservationBit = len(
                self.Grid.VisualArea(COORD(0, 0), 0, self.VisualRange))
            self.NumObservations = self.VisionObservationBit  #1 << (self.VisionObservationBit)
            visualArea = self.Grid.VisualArea(self.AgentHome, 0,
                                              self.VisualRange)

        Simulator.__init__(self, self.NumActions, self.NumObservations,
                           self.GoalPos, occlusions, self.Discount)

        self.RewardClearLevel = 1000
        self.RewardDefault = -1
        self.RewardDie = -100
        self.RewardHitWall = -25
        self.RewardRange = 100

        self.State = GameState()
        self.State.AgentPos = self.AgentHome
        self.State.PredatorPos = self.PredatorHome

        self.XSize = xsize
        self.YSize = ysize
        if verbose:
            #self.Display = Display(xsize, ysize, 'game')
            self.InitializeDisplay()
示例#8
0
 def __init__(self):
     # Settings for the simulation
     Simulator.__init__(self)
示例#9
0
 def __init__(self):
     Simulator.__init__(self)
     # dependent table
     self.dependent_table = [0] * 2
     self.dependent_table[0] = -1
     self.dependent_table[1] = -1
示例#10
0
 def __init__(self, fps=30):
     Simulator.__init__(self)
     self.lasttime = 0
     self.fps = fps
     self.perframe = (1.0 / fps) * 1000
     self.lasttime = datetime.datetime.now()