ai4co / reevo

[NeurIPS 2024] ReEvo: Large Language Models as Hyper-Heuristics with Reflective Evolution
https://ai4co.github.io/reevo/
MIT License
116 stars 24 forks source link

超时报错问题 #15

Closed ruibo5 closed 2 days ago

ruibo5 commented 2 days ago

你好 我调用了 zhipu ai 的免费 api. GLM-4-Flash
然后出现了以下超时报错, config 文件里面的 timeout 默认设定是 20 , 最开始报超市错误 我把timeout超参数设置成了600 但是依然报错, 请是否能帮助我解决一下这个问题。

(reevo-main) lab@lab-desktop:/ssd1/reevo-main$ python main.py problem=tsp_aco [2024-10-30 16:03:32,051][root][INFO] - Workspace: /ssd1/SNU/reevo-main/outputs/tsp_aco-aco/2024-10-30_16-03-32 [2024-10-30 16:03:32,051][root][INFO] - Project Root: /ssd1/SNU/reevo-main [2024-10-30 16:03:32,051][root][INFO] - Using LLM: GLM-4-Flash [2024-10-30 16:03:32,051][root][INFO] - Using Algorithm: reevo [2024-10-30 16:03:32,417][root][INFO] - Problem: tsp_aco [2024-10-30 16:03:32,423][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-10-30 16:03:32,423][root][INFO] - Function name: heuristics [2024-10-30 16:03:32,423][root][INFO] - Evaluating seed function... [2024-10-30 16:03:32,423][root][INFO] - Seed function code: import numpy as np def heuristics_v2(distance_matrix: np.ndarray) -> np.ndarray: return 1 / distance_matrix [2024-10-30 16:03:32,423][root][INFO] - Iteration 0: Running Code 0 [2024-10-30 16:03:33,686][root][INFO] - Iteration 0: Code Run 0 successful! [2024-10-30 16:03:40,360][root][INFO] - Iteration 0, response_id 0: Objective value: 6.627531378063073 [2024-10-30 16:03:40,361][root][INFO] - Iteration 0: Elitist: 6.627531378063073 [2024-10-30 16:03:40,361][root][INFO] - Iteration 0 finished... [2024-10-30 16:03:40,361][root][INFO] - Best obj: 6.627531378063073, Best Code Path: problem_iter0_code0.py [2024-10-30 16:03:40,361][root][INFO] - Function Evals: 1 [2024-10-30 16:03:40,361][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 ....

henry-yeh commented 2 days ago

您好,尝试一下更小的种群数量: python main.py problem=tsp_aco init_pop_size=2 pop_size=2

查看下outputs文件夹下response.txt是否有问题(例如死循环);查看下stdout.txt的输出内容,是否正常输出,例如: [*] Instance 0: 6.429725805964564

ruibo5 commented 2 days ago

你好。我按照您给的指令输入进去跑了一下 , 还是报错。 错误 和 stdout 给您附上:

(reevo-main) lab@lab-desktop:/ssd1/SNU/reevo-main$ python main.py problem=tsp_aco init_pop_size=2 pop_size=2 [2024-10-30 19:30:22,580][root][INFO] - Workspace: /ssd1/SNU/reevo-main/outputs/tsp_aco-aco/2024-10-30_19-30-22 [2024-10-30 19:30:22,580][root][INFO] - Project Root: /ssd1/SNU/reevo-main [2024-10-30 19:30:22,580][root][INFO] - Using LLM: GLM-4-Flash [2024-10-30 19:30:22,580][root][INFO] - Using Algorithm: reevo [2024-10-30 19:30:22,927][root][INFO] - Problem: tsp_aco [2024-10-30 19:30:22,927][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-10-30 19:30:22,928][root][INFO] - Function name: heuristics [2024-10-30 19:30:22,928][root][INFO] - Evaluating seed function... [2024-10-30 19:30:22,928][root][INFO] - Seed function code: import numpy as np def heuristics_v2(distance_matrix: np.ndarray) -> np.ndarray: return 1 / distance_matrix [2024-10-30 19:30:22,929][root][INFO] - Iteration 0: Running Code 0 [2024-10-30 19:30:24,148][root][INFO] - Iteration 0: Code Run 0 successful! [2024-10-30 19:30:29,873][root][INFO] - Iteration 0, response_id 0: Objective value: 6.583946489201288 [2024-10-30 19:30:29,873][root][INFO] - Iteration 0: Elitist: 6.583946489201288 [2024-10-30 19:30:29,873][root][INFO] - Iteration 0 finished... [2024-10-30 19:30:29,873][root][INFO] - Best obj: 6.583946489201288, Best Code Path: problem_iter0_code0.py [2024-10-30 19:30:29,873][root][INFO] - Function Evals: 1 [2024-10-30 19:30:29,873][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 ....

User Prompt: Below are two heuristics functions 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.

You are provided with two code versions below, where the second version performs better than the first one.

[Worse code]

# Create a matrix with the sum of each row (closeness to all other nodes)
row_sums = np.sum(distance_matrix, axis=1)
# Normalize row sums to get a probability distribution
probability_distribution = row_sums / np.sum(row_sums)
# Create a matrix where each element is a weighted sum of its own value and the inverse of its row sum
weighted_distance = distance_matrix * (probability_distribution[:, np.newaxis])
# Create a threshold based on the maximum weighted distance
threshold = np.max(weighted_distance)
# Sparsify the matrix by setting elements below the threshold to zero
sparsified_matrix = np.where(weighted_distance < threshold, 0, weighted_distance)
# Return the sparsified matrix as the heuristic indicator
return sparsified_matrix

[Better code] return 1 / distance_matrix

You respond with some hints for designing better heuristics, based on the two code versions and using less than 20 words. [2024-10-30 19:31:01,231][httpx][INFO] - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 OK" [2024-10-30 19:31:01,553][httpx][INFO] - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 OK" [2024-10-30 19:31:01,557][root][INFO] - Crossover 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.

[Worse code] def heuristics_v0(distance_matrix: np.ndarray) -> np.ndarray:

# Create a matrix with the sum of each row (closeness to all other nodes)
row_sums = np.sum(distance_matrix, axis=1)
# Normalize row sums to get a probability distribution
probability_distribution = row_sums / np.sum(row_sums)
# Create a matrix where each element is a weighted sum of its own value and the inverse of its row sum
weighted_distance = distance_matrix * (probability_distribution[:, np.newaxis])
# Create a threshold based on the maximum weighted distance
threshold = np.max(weighted_distance)
# Sparsify the matrix by setting elements below the threshold to zero
sparsified_matrix = np.where(weighted_distance < threshold, 0, weighted_distance)
# Return the sparsified matrix as the heuristic indicator
return sparsified_matrix

[Better code] def heuristics_v1(distance_matrix: np.ndarray) -> np.ndarray: return 1 / distance_matrix

[Reflection] Focus on information content, avoid redundant operations, and prioritize simpler computations.

[Improved code] Please write an improved function heuristics_v2, according to the reflection. Output code only and enclose your code with Python code block: python .... [2024-10-30 19:31:05,513][httpx][INFO] - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 OK" [2024-10-30 19:31:09,677][httpx][INFO] - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 OK" [2024-10-30 19:31:09,680][root][INFO] - Iteration 2: Running Code 0 [2024-10-30 19:31:10,897][root][INFO] - Iteration 2: Code Run 0 successful! [2024-10-30 19:31:10,898][root][INFO] - Iteration 2: Running Code 1 [2024-10-30 19:31:12,234][root][INFO] - Iteration 2: Code Run 1 successful! [2024-10-30 19:31:26,502][root][INFO] - Iteration 2, response_id 0: Objective value: 6.539949609732332 [2024-10-30 19:31:26,502][root][INFO] - Iteration 2, response_id 1: Objective value: 6.601617118843419 [2024-10-30 19:31:26,502][root][INFO] - Iteration 2: Elitist: 6.539949609732332 [2024-10-30 19:31:26,502][root][INFO] - Iteration 2 finished... [2024-10-30 19:31:26,502][root][INFO] - Best obj: 6.539949609732332, Best Code Path: problem_iter2_code0.py [2024-10-30 19:31:26,502][root][INFO] - Function Evals: 5 [2024-10-30 19:31:26,502][root][INFO] - Long-term Reflection Prompt: System Prompt: You are an expert in the domain of optimization heuristics. Your task is to give hints to design better heuristics.

User Prompt: Below is your prior long-term reflection on designing heuristics 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.

Below are some newly gained insights. Focus on information content, avoid redundant operations, and prioritize simpler computations. Consider relative distances, not absolute, and use common sense; simpler often beats complex.

Write constructive hints for designing better heuristics, based on prior reflections and new insights and using less than 50 words. [2024-10-30 19:31:32,743][httpx][INFO] - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 OK" [2024-10-30 19:31:32,745][root][INFO] - Mutation 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.

[Prior reflection]

  1. Evaluate edge selection with a weighted sum of factors.
  2. Apply matrix sparsity to filter out unpromising paths.
  3. Prioritize informative choices over complexity.
  4. Use relative distances and common sense over intricate metrics.- Try combining various factors to determine how promising it is to select an edge.
    • Try sparsifying the matrix by setting unpromising elements to zero.

[Code] def heuristics_v1(distance_matrix: np.ndarray) -> np.ndarray:

return 1 / (distance_matrix + np.finfo(float).eps)

[Improved code] Please write a mutated function heuristics_v2, according to the reflection. Output code only and enclose your code with Python code block: python .... [2024-10-30 19:31:40,591][httpx][INFO] - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 OK" [2024-10-30 19:31:40,593][root][INFO] - Iteration 3: Running Code 0 [2024-10-30 19:31:41,800][root][INFO] - Iteration 3: Code Run 0 successful! [2024-10-30 19:31:47,622][root][INFO] - Iteration 3, response_id 0: Objective value: 6.548594326308752 [2024-10-30 19:31:47,622][root][INFO] - Iteration 3 finished... [2024-10-30 19:31:47,622][root][INFO] - Best obj: 6.539949609732332, Best Code Path: problem_iter2_code0.py [2024-10-30 19:31:47,622][root][INFO] - Function Evals: 6 [2024-10-30 19:31:50,194][httpx][INFO] - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 OK" [2024-10-30 19:31:51,107][httpx][INFO] - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 OK" [2024-10-30 19:32:05,239][httpx][INFO] - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 OK" [2024-10-30 19:32:05,241][httpx][INFO] - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 OK" [2024-10-30 19:32:05,244][root][INFO] - Iteration 4: Running Code 0 [2024-10-30 19:32:06,453][root][INFO] - Iteration 4: Code Run 0 successful! [2024-10-30 19:32:06,453][root][INFO] - Iteration 4: Running Code 1 [2024-10-30 19:32:07,648][root][INFO] - Iteration 4: Code Run 1 successful! [2024-10-30 19:32:07,648][root][INFO] - Iteration 4, response_id 0: Objective value: inf [2024-10-30 19:32:13,670][root][INFO] - Iteration 4, response_id 1: Objective value: 5.998063864749301 [2024-10-30 19:32:13,670][root][INFO] - Iteration 4: Elitist: 5.998063864749301 [2024-10-30 19:32:13,670][root][INFO] - Iteration 4 finished... [2024-10-30 19:32:13,670][root][INFO] - Best obj: 5.998063864749301, Best Code Path: problem_iter4_code1.py [2024-10-30 19:32:13,670][root][INFO] - Function Evals: 8 [2024-10-30 19:32:18,155][httpx][INFO] - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 OK" [2024-10-30 19:32:58,379][httpx][INFO] - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 OK" [2024-10-30 19:32:58,382][root][INFO] - Iteration 5: Running Code 0 [2024-10-30 19:32:59,553][root][INFO] - Iteration 5: Code Run 0 successful! [2024-10-30 19:32:59,867][root][INFO] - Iteration 5, response_id 0: Objective value: inf [2024-10-30 19:32:59,867][root][INFO] - Iteration 5 finished... [2024-10-30 19:32:59,867][root][INFO] - Best obj: 5.998063864749301, Best Code Path: problem_iter4_code1.py [2024-10-30 19:32:59,867][root][INFO] - Function Evals: 9 Error executing job with overrides: ['problem=tsp_aco', 'init_pop_size=2', 'pop_size=2'] Traceback (most recent call last): File "/ssd1/SNU/reevo-main/main.py", line 54, in main() File "/home/lab/anaconda3/envs/reevo-main/lib/python3.11/site-packages/hydra/main.py", line 94, in decorated_main _run_hydra( File "/home/lab/anaconda3/envs/reevo-main/lib/python3.11/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra _run_app( File "/home/lab/anaconda3/envs/reevo-main/lib/python3.11/site-packages/hydra/_internal/utils.py", line 457, in _run_app run_and_report( File "/home/lab/anaconda3/envs/reevo-main/lib/python3.11/site-packages/hydra/_internal/utils.py", line 223, in run_and_report raise ex File "/home/lab/anaconda3/envs/reevo-main/lib/python3.11/site-packages/hydra/_internal/utils.py", line 220, in run_and_report return func() ^^^^^^ File "/home/lab/anaconda3/envs/reevo-main/lib/python3.11/site-packages/hydra/_internal/utils.py", line 458, in lambda: hydra.run( ^^^^^^^^^^ File "/home/lab/anaconda3/envs/reevo-main/lib/python3.11/site-packages/hydra/internal/hydra.py", line 132, in run = ret.return_value ^^^^^^^^^^^^^^^^ File "/home/lab/anaconda3/envs/reevo-main/lib/python3.11/site-packages/hydra/core/utils.py", line 260, in return_value raise self._return_value File "/home/lab/anaconda3/envs/reevo-main/lib/python3.11/site-packages/hydra/core/utils.py", line 186, in run_job ret.return_value = task_function(task_cfg) ^^^^^^^^^^^^^^^^^^^^^^^ File "/ssd1/SNU/reevo-main/main.py", line 34, in main best_code_overall, best_code_path_overall = lhh.evolve() ^^^^^^^^^^^^ File "/ssd1/SNU/reevo-main/reevo.py", line 456, in evolve raise RuntimeError("Selection failed. Please check the population.") RuntimeError: Selection failed. Please check the population.

stdout: [] Running ... [] Dataset loaded: /ssd1/SNU/reevo-main/problems/tsp_aco/dataset/train50_dataset.npy with 5 instances. /ssd1/SNU/reevo-main/problems/tsp_aco/gpt.py:21: RuntimeWarning: invalid value encountered in divide normalized_factor = combined_factor / np.max(combined_factor) Traceback (most recent call last): File "/ssd1/SNU/reevo-main/problems/tsp_aco/eval.py", line 53, in obj = solve(node_pos) ^^^^^^^^^^^^^^^ File "/ssd1/SNU/reevo-main/problems/tsp_aco/eval.py", line 29, in solve obj = aco.run(N_ITERATIONS) ^^^^^^^^^^^^^^^^^^^^^ File "/home/lab/anaconda3/envs/reevo-main/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/ssd1/SNU/reevo-main/problems/tsp_aco/aco.py", line 34, in run paths = self.gen_path(require_prob=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/ssd1/SNU/reevo-main/problems/tsp_aco/aco.py", line 92, in gen_path actions, log_probs = self.pick_move(prev, mask, require_prob) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/ssd1/SNU/reevo-main/problems/tsp_aco/aco.py", line 114, in pick_move dist = Categorical(dist) ^^^^^^^^^^^^^^^^^ File "/home/lab/anaconda3/envs/reevo-main/lib/python3.11/site-packages/torch/distributions/categorical.py", line 72, in init super().init(batch_shape, validate_args=validate_args) File "/home/lab/anaconda3/envs/reevo-main/lib/python3.11/site-packages/torch/distributions/distribution.py", line 71, in init raise ValueError( ValueError: Expected parameter probs (Tensor of shape (30, 50)) of distribution Categorical(probs: torch.Size([30, 50])) to satisfy the constraint Simplex(), but found invalid values: tensor([[nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan], ..., [nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan]], dtype=torch.float64)

henry-yeh commented 2 days ago

此次运行没有问题,此处报错是因为我们将population size设置为2进行测试,出现了错误的heuristic后(这是因为LLM生成的问题),selection会失败。将population size调大即可避免这次报错。

由于减小population size即可顺利运行,您之前的问题是因为硬件性能。可以采取较小的init_population_size,或修改代码单进程评估population。

henry-yeh commented 2 days ago

会影响的

ruibo5 commented 2 days ago

您好 init_population_size 设置太小 例如init_population_size=5 会影响性能吗, 还有就是 论文里面用的是chatgpt, 而如果我用 GLM-4-Flash 会影响性能吗

henry-yeh commented 2 days ago

采用不同参数会影响结果复现,对于新的应用影响不会太大

ruibo5 commented 1 day ago

你好 请问这个tsp_aco 20 , 50 100个点 , 数据集是在哪里找的, 如果是自己手动创建, 该如何创建?

henry-yeh commented 1 day ago

参见代码:https://github.com/ai4co/reevo/blob/main/problems/tsp_aco/gen_inst.py

ruibo5 commented 11 hours ago

您好我有以下两个问题想问一下您

1.请问这两个路径下的( problems/tsp_aco/test.ipynb 和 problems/tsp_gls/test.ipynb)的代码def heuristics_reevo(distance_matrix: np.ndarray) 为什么不一样

第1个问题的具体代码内容如下 1. 在problems/tsp_aco/test.ipynb路径下的代码为以下: def heuristics_reevo(edge_attr): num_edges = edge_attr.shape[0] num_attributes = edge_attr.shape[1]

heuristic_values = np.zeros_like(edge_attr)

# Apply feature engineering on edge attributes
transformed_attr = np.log1p(np.abs(edge_attr))  # Taking logarithm of absolute value of attributes

# Normalize edge attributes
scaler = StandardScaler()
edge_attr_norm = scaler.fit_transform(transformed_attr)

# Calculate correlation coefficients
correlation_matrix = np.corrcoef(edge_attr_norm.T)

# Calculate heuristic value for each edge attribute
for i in range(num_edges):
    for j in range(num_attributes):
        if edge_attr_norm[i][j] != 0:
            heuristic_values[i][j] = np.exp(-8 * edge_attr_norm[i][j] * correlation_matrix[j][j])

return heuristic_values

在problems/tsp_gls/test.ipynb 路径下的代码为以下:

def heuristics_reevo(distance_matrix: np.ndarray) -> np.ndarray:

Calculate the average distance for each node

average_distance = np.mean(distance_matrix, axis=1)

# Calculate the distance ranking for each node
distance_ranking = np.argsort(distance_matrix, axis=1)

# Calculate the mean of the closest distances for each node
closest_mean_distance = np.mean(distance_matrix[np.arange(distance_matrix.shape[0])[:, None], distance_ranking[:, 1:5]], axis=1)

# Initialize the indicator matrix and calculate ratio of distance to average distance
indicators = distance_matrix / average_distance[:, np.newaxis]

# Set diagonal elements to np.inf
np.fill_diagonal(indicators, np.inf)

# Adjust the indicator matrix using the statistical measure
indicators += closest_mean_distance[:, np.newaxis] / np.sum(distance_matrix, axis=1)[:, np.newaxis]

return indicators

def vanilla_ktsp(distance_matrix: np.ndarray) -> np.ndarray: return distance_matrix


2. 2-1.problems/tsp_gls/test.ipynb 里面的代码optimality gap 我跑出来了负数 是可以看作是0吗 2-2. 这个代码是否是论文中Table1 里面的 KGLS + ReEvo(ours) 方法, 在Table1 里面 Tsp 200 的opt gap 是 0.216 然后在Table1里面其他的 Tsp 20 50 100 opt gap 全是 0

请问 我在problems/tsp_gls/test.ipynb代码文件里面跑出来的结果是否是是您Table1 里面KGLS + ReEvo(ours) 方法的结果 。我跑出来的以下两个evaluate(heuristics_reevo), evaluate(vanilla_ktsp) 如果不是的话是什么结果?

evaluate(heuristics_reevo)

erage for 20: 3.746594 (3.836285) [] Optimality gap: -2.337967% [] Total/Average duration: 0.064194s 0.001003s [] Average for 50: 5.635503 (5.684580) [] Optimality gap: -0.863328% [] Total/Average duration: 1.737566s 0.027149s [] Average for 100: 7.739454 (7.778580) [] Optimality gap: -0.503004% [] Total/Average duration: 80.867855s 1.263560s [] Average for 200: 10.719096 (10.711946) [] Optimality gap: 0.066744% [*] Total/Average duration: 134.167998s 2.096375s

evaluate(vanilla_ktsp)

[] Average for 20: 3.746594 (3.836285) [] Optimality gap: -2.337967% [*] Total/Average duration: 0.051683s 0.000808s

[] Average for 50: 5.635709 (5.684580) [] Optimality gap: -0.859714% [*] Total/Average duration: 1.691789s 0.026434s

[] Average for 100: 7.739454 (7.778580) [] Optimality gap: -0.503004% [*] Total/Average duration: 82.049456s 1.282023s

[] Average for 200: 10.725571 (10.711946) [] Optimality gap: 0.127199% [*] Total/Average duration: 132.682913s 2.073171s

henry-yeh commented 11 hours ago
  1. 对不同问题设定,ReEvo分别训练heuristic,故不同。 2.1 是因为没有跑出最优解。 2.2 是文中结果,但是Optimality gap偏低,因为没有正确求得最优解。