Ejemplo n.º 1
0
def init_few_fix_evenly_user():       # Scenario : User reports are very few and reports are evenly distributed in fixed-distant interval.
    mylist = []
    for x in range(0, pr.map_size[0], 5):
        for y in range(0, pr.map_size[1], 5):            
            print x, y
            mylist.append( User(getID('user'), x, y) )
    return mylist     
Ejemplo n.º 2
0
def init_user():
    mylist = []
    with open(pr.fn_pos_random, 'rb') as f:
        pos = pk.load(f)
        pos_um = pos[1]
    for i in range(pr.user_no):
        x = pos_um[i][0]
        y = pos_um[i][1]
        mylist.append(User(getID('user'), x, y))
    return mylist
Ejemplo n.º 3
0
def init_cell():
    mylist = []
    fn_opened = pr.fn_pos_fixed if pr.fix_cell_pos else pr.fn_pos_random
    with open(fn_opened, 'rb') as f:
        pos = pk.load(f)  # include [cm, um]
        pos_cm = pos[0]
    for i in range(pr.cell_no):
        x = pos_cm[i][0]
        y = pos_cm[i][1]
        power = pos_cm[i][2]
        mylist.append(Cell(getID('cell'), x, y, power))
    return mylist
Ejemplo n.º 4
0
def init_nonuniform_user():  # non-uniform spatial distribution of user report
    mylist = []
    n_room = 4
    n_per_room = [120, 120, 120, 119]
    center = [[28, 6], [30, 19], [70, 6],
              [79,
               19]]  #room1~4 : left-bottom, left-up, right-bottom, right-up.
    variance = [[8, 2.2], [9, 2.2], [9.5, 2.2], [7, 2.2]]
    for i in range(n_room):
        x = np.random.normal(loc=center[i][0],
                             scale=variance[i][0],
                             size=n_per_room[i])
        y = np.random.normal(loc=center[i][1],
                             scale=variance[i][1],
                             size=n_per_room[i])
        for j in range(n_per_room[i]):
            mylist.append(User(getID('user'), x[j], y[j]))
    return mylist
Ejemplo n.º 5
0
def init_nonuniform_user():   # non-uniform spatial distribution of user report
    mylist = []
    n_report = 500
    n_room = 4
    center = [[27, 6], [30, 19], [70, 6], [79, 19]]   #room1~4 : left-bottom, left-up, right-bottom, right-up.
    variance = [[9, 2.2], [8, 2.2], [9.5, 2.2], [7, 2.2]]
    distribution = 'gaussian'    # non-uniform distribution : gaussian/ laplace/ triangular
    if distribution == 'gaussian':
        # Naive Method:
        # x = np.random.normal(loc=rd.uniform(35, 70), scale=rd.uniform(18, 23), size=n_report) 
        # y = np.random.normal(loc=rd.uniform(8, 17), scale=rd.uniform(4, 8), size=n_report) 
        for i in range(n_room):
            n_per_room = n_report/ n_room
            x = np.random.normal(loc=center[i][0], scale=variance[i][0], size=n_per_room)  
            y = np.random.normal(loc=center[i][1], scale=variance[i][1], size=n_per_room)
            for j in range(n_per_room):
                mylist.append( User(getID('user'), x[j], y[j]) )
    return mylist