def log(msg): print('[*] {msg}'.format(msg=msg)) def load_data(file): coords = [] with open(file, "r") as infile: line = infile.readline() # Skip instance header while "NODE_COORD_SECTION" not in line: line = infile.readline() for line in infile.readlines(): line = line.replace("\n", "") if line and 'EOF' not in line: line = [float(x) for x in line.lstrip().split(" ", 1)[1].split(" ") if x] coords.append(line) return coords def timeout_handler(signum, frame): print("Timeout") raise Exception("Timeout")