コード例 #1
0
    def test_compare_soleves(self):
        max_depth = 400

        def BeamSolve(beam_width):
            algorithm = beam_search.BeamSearch(beam_width, max_depth)
            heuristic = heuristics.PowerHeuristic()
            agent = measure_agent.MeasureAgent(algorithm, heuristic)

            def solution_len(*args, **kwrds):
                solution = agent.solve(*args, **kwrds)
                if solution is None: solution = []
                return [len(solution)]

            return solution_len

        beam3 = BeamSolve(3)
        beam7 = BeamSolve(7)
        solve_impl_list = [beam3, beam7]
        header = ['RoomId', 'Beam3', 'Beam7']
        rooms = dict(all_static_rooms.items()[:3])

        results = mes2.compare_soleves(solve_impl_list, rooms, 1000)
        #named_results = [[name] + list(r) for r , name in zip(results,solve_impl_names)]

        #len_table = named_results[0]
        t = xplot.table_to_csv2(results, header=header)
        print "f\n"
        print t
コード例 #2
0
ファイル: mes_test.py プロジェクト: hizki/AI1
    def test_compare_soleves(self):
        max_depth = 400
        def BeamSolve(beam_width):
            algorithm = beam_search.BeamSearch(beam_width, max_depth)
            heuristic = heuristics.PowerHeuristic()
            agent =     measure_agent.MeasureAgent(algorithm, heuristic)
            
            def solution_len(*args, **kwrds):
                solution  = agent.solve(*args, **kwrds)
                if solution is None: solution = []
                return [len(solution)]
            
            return solution_len
        
        beam3 = BeamSolve(3)
        beam7 = BeamSolve(7)
        solve_impl_list = [beam3,beam7]
        header = ['RoomId','Beam3','Beam7']
        rooms  = dict(all_static_rooms.items()[:3])
        
        results = mes2.compare_soleves(solve_impl_list, rooms, 1000)
        #named_results = [[name] + list(r) for r , name in zip(results,solve_impl_names)]

        #len_table = named_results[0]        
        t = xplot.table_to_csv2(results,header=header)
        print "f\n"
        print t
コード例 #3
0
    def test_mesure_soleves(self):
        max_depth = 40

        def BeamSolve(beam_width):
            algorithm = beam_search.BeamSearch(beam_width, max_depth)
            heuristic = heuristics.PowerHeuristic()
            agent = measure_agent.MeasureAgent(algorithm, heuristic)

            def solution_len(*args, **kwrds):
                solution = agent.solve(*args, **kwrds)
                if solution is None: solution = []
                return [len(solution)]

            return solution_len

        beam3 = BeamSolve(2)
        beam7 = BeamSolve(7)
        beam11 = BeamSolve(50)
        solve_impl_list = [beam3, beam7, beam11]
        header = ['No', 'RoomId', 'Beam3', 'Beam7', 'Beam11']
        rooms = dict(all_static_rooms.items()[:7])
        print
        print
        results = mes2.compare_measured_soleves(solve_impl_list, rooms, 1000)

        #named_results = [[name] + list(r) for r , name in zip(results,solve_impl_names)]

        time_table = [range(len(results[0][0]))] + results[1]
        t = xplot.table_to_csv2(time_table, header=header)

        y = [
            reduce(lambda x, y: x + int(y != 0), coll)
            for coll in time_table[2:]
        ]
        x = [2, 7, 50]

        dir = r'C:\Users\inesmeya\Desktop\source\din'
        html_name = dir + '\\' + 'index.html'
        img_name = dir + '\\' + 'img.png'

        xplot.html.add_header("Pincture Demo")
        xplot.plot_result((('width', x), ('solved', y)),
                          title='Picture title',
                          label='lable',
                          filename=img_name)
        xplot.html.add_img(img_name)

        xplot.html.add_header("Table demo")
        xplot.html.add_paragraph("Tons of text about this particular table")
        xplot.html.add_table(time_table, 'The Title of table', header=header)
        xplot.html.save(html_name)
        print xplot.table_to_csv2()

        #print d
        print t
コード例 #4
0
ファイル: mes_test.py プロジェクト: hizki/AI1
    def test_mesure_soleves(self):
        max_depth = 40
        def BeamSolve(beam_width):
            algorithm = beam_search.BeamSearch(beam_width, max_depth)
            heuristic = heuristics.PowerHeuristic()
            agent =     measure_agent.MeasureAgent(algorithm, heuristic)
            
            def solution_len(*args, **kwrds):
                solution  = agent.solve(*args, **kwrds)
                if solution is None: solution = []
                return [len(solution)]
            
            return solution_len
        
        beam3 = BeamSolve(2)
        beam7 = BeamSolve(7)
        beam11 = BeamSolve(50)
        solve_impl_list = [beam3,beam7,beam11]
        header = ['No','RoomId','Beam3','Beam7','Beam11']
        rooms  = dict(all_static_rooms.items()[:7])
        print
        print
        results = mes2.compare_measured_soleves(solve_impl_list, rooms, 1000)
        
        
        #named_results = [[name] + list(r) for r , name in zip(results,solve_impl_names)]
        
        time_table = [range(len(results[0][0]))] + results[1]        
        t = xplot.table_to_csv2(time_table,header=header)
        
        y = [reduce(lambda x,y: x + int(y != 0),coll) for coll in time_table[2:]]
        x = [2,7,50]
        
        dir = r'C:\Users\inesmeya\Desktop\source\din'
        html_name = dir + '\\' + 'index.html'
        img_name = dir + '\\' + 'img.png'
        
        xplot.html.add_header("Pincture Demo")
        xplot.plot_result((('width', x),('solved', y)), title='Picture title', label='lable', filename=img_name)
        xplot.html.add_img(img_name)

        xplot.html.add_header("Table demo")
        xplot.html.add_paragraph("Tons of text about this particular table")
        xplot.html.add_table(time_table, 'The Title of table', header=header)
        xplot.html.save(html_name)
        print xplot.table_to_csv2()
        
        
        #print d
        print t
コード例 #5
0
ファイル: mes_test.py プロジェクト: hizki/AI1
 def test_mesurment(self):
     max_depth = 400
     def Beam(beam_width):
         algorithm = beam_search.BeamSearch(beam_width, max_depth)
         heuristic = heuristics.PowerHeuristic()
         agent =     measure_agent.MeasureAgent(algorithm, heuristic)
         return agent
         
     beam3 = Beam(3)
     beam7 = Beam(7)
     agents = [beam3,beam7]
     agetn_names = ['RoomId','Beam3','Beam7']
     rooms  = dict(all_static_rooms.items()[:3])
     len_v_table, time_v_table = mes.compare_agents(agents, rooms, 1000)
     
     len_v_table = [agetn_names] + len_v_table
     time_v_table = [agetn_names] + time_v_table
     
     print 'hi'
     print xplot.table_to_csv(len_v_table)
コード例 #6
0
    def test_mesurment(self):
        max_depth = 400

        def Beam(beam_width):
            algorithm = beam_search.BeamSearch(beam_width, max_depth)
            heuristic = heuristics.PowerHeuristic()
            agent = measure_agent.MeasureAgent(algorithm, heuristic)
            return agent

        beam3 = Beam(3)
        beam7 = Beam(7)
        agents = [beam3, beam7]
        agetn_names = ['RoomId', 'Beam3', 'Beam7']
        rooms = dict(all_static_rooms.items()[:3])
        len_v_table, time_v_table = mes.compare_agents(agents, rooms, 1000)

        len_v_table = [agetn_names] + len_v_table
        time_v_table = [agetn_names] + time_v_table

        print 'hi'
        print xplot.table_to_csv(len_v_table)