Beispiel #1
0
def beam_lin(count, room_time_limit, seed):
    #beam parameters:

    init_width_domain = [20]
    growf_domain = [(2, 'lin'), (4, 'lin'), (8, 'lin'), (16, 'lin')]
    heuristic_s = [heuristics.PowerHeuristic2(), heuristics.LinearHeuristic()]

    #------------------ Create Agents ------------------
    agent_list = []
    for h in heuristic_s:
        for init_width in init_width_domain:
            for growf in growf_domain:
                algorithm = AnytimeBeamSearch(init_width, growf)
                agent = TestAgent(algorithm, h)
                agent_list.append(agent)

    #---------------- Create Roomsets --------------------
    roomsets = [
        c_roomsets.easy_roomset(count, seed),
        c_roomsets.mild_roomset(count, seed),
        c_roomsets.heavy_roomset(count, seed)
    ]
    #---------------- measure --------------------
    dbs = ameasure(agent_list, roomsets, room_time_limit)
    return dbs
Beispiel #2
0
def get_rs():
    rooms_per_set = 5
    num_sets = 10

    ers = c_roomsets.easy_roomset(rooms_per_set, 0)
    mrs = c_roomsets.mild_roomset(rooms_per_set, 0)
    hrs = c_roomsets.heavy_roomset(rooms_per_set, 0)

    for i in range(1, num_sets):
        erst = c_roomsets.easy_roomset(rooms_per_set, i)
        mrst = c_roomsets.mild_roomset(rooms_per_set, i)
        hrst = c_roomsets.heavy_roomset(rooms_per_set, i)

        ers.rooms.update(erst.rooms)
        mrs.rooms.update(mrst.rooms)
        hrs.rooms.update(hrst.rooms)

    for rs in [ers, mrs, hrs]:
        l1 = rs.rooms.keys()
        print len(l1)  #, rs.name
        print sorted(l1)

    return {"easy_roomset": ers, "mild_roomset": mrs, "heavy_roomset": hrs}
Beispiel #3
0
def get_rs():
    rooms_per_set = 5
    num_sets = 10

    ers =  c_roomsets.easy_roomset(rooms_per_set, 0)
    mrs =  c_roomsets.mild_roomset(rooms_per_set, 0)
    hrs =  c_roomsets.heavy_roomset(rooms_per_set, 0)
    
    for i in range(1, num_sets):
        erst =  c_roomsets.easy_roomset(rooms_per_set, i)
        mrst =  c_roomsets.mild_roomset(rooms_per_set, i)
        hrst =  c_roomsets.heavy_roomset(rooms_per_set, i)
        
        ers.rooms.update(erst.rooms)
        mrs.rooms.update(mrst.rooms)
        hrs.rooms.update(hrst.rooms)
        
    for rs in [ers, mrs, hrs]:
        l1 = rs.rooms.keys()
        print len(l1)#, rs.name
        print sorted(l1)
    
    return {"easy_roomset": ers, "mild_roomset" : mrs, "heavy_roomset" : hrs}        
Beispiel #4
0
def mild_astar(count, room_time_limit, seed):

    heuristic_s = [heuristics.PowerHeuristic2()]

    # ------------------ Create Agents ------------------
    agent_list = []
    for h in heuristic_s:
        agent = TestAgent(LimitedTimeAStar(), h)
        agent_list.append(agent)

    # ---------------- Create Roomsets --------------------
    roomsets = [c_roomsets.mild_roomset(count, seed)]
    # ---------------- measure --------------------
    dbs = ameasure(agent_list, roomsets, room_time_limit)
    return dbs
Beispiel #5
0
def beam_lin(count,room_time_limit, seed):
    #beam parameters:
    
    init_width_domain = [20]
    growf_domain =[ (2,'lin'),(4,'lin'),(8,'lin'),(16,'lin') ]
    heuristic_s = [heuristics.PowerHeuristic2(),heuristics.LinearHeuristic()]
        
    #------------------ Create Agents ------------------            
    agent_list = []
    for h in heuristic_s:
        for init_width in init_width_domain:
            for growf in growf_domain: 
                algorithm = AnytimeBeamSearch(init_width, growf)
                agent =     TestAgent(algorithm, h)
                agent_list.append(agent)
                
    #---------------- Create Roomsets --------------------
    roomsets = [c_roomsets.easy_roomset(count, seed),
                c_roomsets.mild_roomset(count, seed),
                c_roomsets.heavy_roomset(count, seed) ]
    #---------------- measure --------------------
    dbs = ameasure(agent_list, roomsets, room_time_limit)
    return dbs
Beispiel #6
0
def best_first_depth(count, room_time_limit, seed):
    """ @param count: number of rooms
    """
    # best first parameters:
    depths = [10, 80, 150, 250, 400, 1000]
    heuristic_s = [heuristics.PowerHeuristic2(), heuristics.LinearHeuristic()]

    # ------------------ Create Agents ------------------
    agent_list = []
    for h in heuristic_s:
        for depth in depths:
            algorithm = AnytimeBestFirstGraphSearch(depth)
            agent = TestAgent(algorithm, h)
            agent_list.append(agent)

    # ---------------- Create Roomsets --------------------
    roomsets = [
        c_roomsets.easy_roomset(count, seed),
        c_roomsets.mild_roomset(count, seed),
        c_roomsets.heavy_roomset(count, seed),
    ]

    dbs = ameasure(agent_list, roomsets, room_time_limit)
    return dbs