ai4co / LLM-as-HH

Large Language Models as Hyper-Heuristics for Combinatorial Optimization (CO)
MIT License
89 stars 21 forks source link

Attempt 1 failed with error: Request timed out. #6

Closed Li-lab98 closed 3 months ago

Li-lab98 commented 3 months ago

How to solve this problem?

[2024-05-27 11:03:36,897][root][INFO] - Using LLM: gpt-3.5-turbo [2024-05-27 11:03:36,899][root][INFO] - Using Algorithm: reevo [2024-05-27 11:03:38,178][root][INFO] - Problem: tsp_aco [2024-05-27 11:03:38,178][root][INFO] - Problem description: Solving Traveling Salesman Problem (TSP) via stochastic solution sampling following "heuristics". TSP requires finding the shortest path that visits all given nodes and returns to the starting node. [2024-05-27 11:03:38,178][root][INFO] - Function name: heuristics [2024-05-27 11:03:38,191][root][INFO] - Evaluating seed function... [2024-05-27 11:03:38,191][root][INFO] - Seed function code: import numpy as np def heuristics_v2(distance_matrix: np.ndarray) -> np.ndarray: return 1 / distance_matrix [2024-05-27 11:03:38,191][root][INFO] - Iteration 0: Running Code 0 [2024-05-27 11:03:40,944][root][INFO] - Iteration 0: Code Run 0 successful! [2024-05-27 11:03:49,394][root][INFO] - Iteration 0, response_id 0: Objective value: 6.737054565194424 [2024-05-27 11:03:49,394][root][INFO] - Iteration 0: Elitist: 6.737054565194424 [2024-05-27 11:03:49,394][root][INFO] - Iteration 0 finished... [2024-05-27 11:03:49,396][root][INFO] - Best obj: 6.737054565194424, Best Code Path: problem_iter0_code0.py [2024-05-27 11:03:49,396][root][INFO] - Function Evals: 1 [2024-05-27 11:03:49,396][root][INFO] - Initial Population Prompt: System Prompt: You are an expert in the domain of optimization heuristics. Your task is to design heuristics that can effectively solve optimization problems. Your response outputs Python code and nothing else. Format your code as a Python code string: "python ...". User Prompt: Write a heuristics function for Solving Traveling Salesman Problem (TSP) via stochastic solution sampling following "heuristics". TSP requires finding the shortest path that visits all given nodes and returns to the starting node. The heuristics function takes as input a distance matrix, and returns prior indicators of how promising it is to include each edge in a solution. The return is of the same shape as the input.

def heuristics_v1(distance_matrix: np.ndarray) -> np.ndarray: return 1 / distance_matrix Refer to the format of a trivial design above. Be very creative and give heuristics_v2. Output code only and enclose your code with Python code block: python ....

Furffico commented 3 months ago

This is probably due to a network error. Please check if your connection to OpenAI's API (https://api.openai.com/v1/chat/completions) is valid.

Li-lab98 commented 3 months ago

Thanks, the code is working fine now.