Add function to show results
This commit is contained in:
		
							parent
							
								
									f534521410
								
							
						
					
					
						commit
						6a3bdc44e3
					
				@ -49,6 +49,12 @@ def local_search():
 | 
			
		||||
    pass
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def show_results(solutions):
 | 
			
		||||
    distance_sum = solutions["distance"].sum()
 | 
			
		||||
    print(solutions)
 | 
			
		||||
    print("Total distance: " + str(distance_sum))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def usage(argv):
 | 
			
		||||
    print(f"Usage: python {argv[0]} <file>")
 | 
			
		||||
    exit(1)
 | 
			
		||||
@ -59,7 +65,7 @@ def main():
 | 
			
		||||
        usage(argv)
 | 
			
		||||
    n, m, data = parse_file(argv[1])
 | 
			
		||||
    solutions = greedy_algorithm(n, m, data)
 | 
			
		||||
    print(solutions)
 | 
			
		||||
    show_results(solutions)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user