示例#1
0
    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;
示例#2
0
    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;
示例#3
0
 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;
示例#4
0
 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;
示例#5
0
 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;