def process_by_matrix(self, matrix): """! @brief Perform simulation of ant colony to solve travelling salesman problem. @param[in] matrix (list): Adjacency matrix that describes distances between objects. @return (list) The shortest path that consists of all objects. """ output_result = wrapper.antcolony_tsp_process(matrix, self.__parameters, wrapper.CITIES_DISTANCE_SET_BY_MATRIX); result = tsp_result(); result.shortest_length = output_result[0][0]; result.object_sequence = output_result[1]; return result;
def process(self, object_locations): """! @brief Perform simulation of ant colony to solve travelling salesman problem. @param[in] object_locations (list): Coordinates of objects that should be visited. @return (list) The shortest path that consists of all objects. """ output_result = wrapper.antcolony_tsp_process(object_locations, self.__parameters); result = tsp_result(); result.shortest_length = output_result[0][0]; result.object_sequence = output_result[1]; return result;
def process_by_matrix(self, matrix): """! @brief Perform simulation of ant colony to solve travelling salesman problem. @param[in] object_locations (list): Coordinates of objects that should be visited. """ (result_address, c_pointer_tsp_result) = wrapper.antcolony_tsp_process(matrix, self.__parameters, wrapper.CITIES_DISTANCE_SET_BY_MATRIX); result = tsp_result(); result.shortest_length = c_pointer_tsp_result.path_length; for i in range(c_pointer_tsp_result.size): result.object_sequence.append(c_pointer_tsp_result.object_sequence[i]); wrapper.antcolony_tsp_destroy(result_address); return result;
def process_by_matrix(self, matrix): """! @brief Perform simulation of ant colony to solve travelling salesman problem. @param[in] matrix (list): Adjacency matrix that describes distances between objects. @return (list) The shortest path that consists of all objects. """ (result_address, c_pointer_tsp_result) = wrapper.antcolony_tsp_process(matrix, self.__parameters, wrapper.CITIES_DISTANCE_SET_BY_MATRIX); result = tsp_result(); result.shortest_length = c_pointer_tsp_result.path_length; for i in range(c_pointer_tsp_result.size): result.object_sequence.append(c_pointer_tsp_result.object_sequence[i]); wrapper.antcolony_tsp_destroy(result_address); return result;
def process(self, object_locations): """! @brief Perform simulation of ant colony to solve travelling salesman problem. @param[in] object_locations (list): Coordinates of objects that should be visited. @return (list) The shortest path that consists of all objects. """ (result_address, c_pointer_tsp_result) = wrapper.antcolony_tsp_process(object_locations, self.__parameters); result = tsp_result(); result.shortest_length = c_pointer_tsp_result.path_length; for i in range(c_pointer_tsp_result.size): result.object_sequence.append(c_pointer_tsp_result.object_sequence[i]); wrapper.antcolony_tsp_destroy(result_address); return result;