def test_read_file_ok(self):
     graph = Instance()
     graph.read_file(NodeTest.GRAPH_1_TEST_PTH)
     self.assertEqual(100, graph.get_total_nodes())
     self.assertEqual(2266, graph.get_total_edges())
     self.assertEqual(100, len(graph.get_nodes()), 100)
     self.assertTrue(GraphUtils.are_adjacent(graph.get_node(0), graph.get_node(1)))
Exemple #2
0
                            graph, file, solution_type, fixed_seed, alpha)
                        find_grasp_sol_time = time.time() - start_time
                        ratio, density, cardinality = GraphUtils.calculate_solution(
                            graph, solution)

                        local_search_sol = instance_solution.apply_ls(
                            graph, solution)
                        find_ls_sol_time = time.time() - start_time
                        ls_ratio, ls_density, ls_cardinality = GraphUtils.calculate_solution(
                            graph, local_search_sol)

                        table_key_name = filename + MAIN_SEP_NAMES + solution_type + MAIN_SEP_NAMES + str(
                            iteration) + MAIN_SEP_NAMES + str(alpha)
                        data.update({
                            table_key_name: [
                                graph.get_total_nodes(), density, ratio,
                                cardinality, find_grasp_sol_time, alpha
                            ]
                        })

                        data_ls.update({
                            table_key_name: [
                                graph.get_total_nodes(), ls_density, ls_ratio,
                                ls_cardinality, find_ls_sol_time, alpha
                            ]
                        })

                        if GraphUtils.is_clique_solution(graph, solution):
                            LOGGER.debug(
                                MAIN_LOG_PROCESS.format(
                                    file, solution_type, iteration, alpha,