Skip to content

Question about testing ATSP #2

Description

@wzever

Thank you for the insightful work! I have questions when running the ATSP solver, i.e., the GLOP-empowered MatNet to evaluate more ATSP instances:

1. There seems mismatch between the output tour and cost of your random insertion algorithm. I replace the result with manually calculated cost from the tour (to my conventional understanding) and find them different (specifically the following printed cost1 and cost2 are different. Based on eval_atsp/test_glop.py), though the improved amount remain almost stable.

def calc_len(tour, dist):
    cost = 0
    tour = tour.tolist()
    tour.append(tour[0])
    assert sorted(tour[:-1]) == [i for i in range(len(dist))], tour
    for i in range(len(tour) - 1):
        cost += dist[tour[i], tour[i + 1]]
    return cost

def main(n):   
    ...
    for inst in dataset:
        tour, cost = random_insertion_non_euclidean(inst, order)
        print(f'cost1: {cost}')

        cost = calc_len(tour, inst).item()
        print(f'cost2: {cost.item()}')

        original_costs.append(cost)
        improved_cost = revision(torch.tensor(tour.astype(np.int64)), inst, tester)
        revised_cost = cost - improved_cost
        revised_costs.append(revised_cost) 
    ...

Here are the outputs on ATSP150 using the two different original costs, with all other setting and data identical to your instructions.

Using cost1 (which matches the reported results in Table 4 of your paper)
initial costs:  2.2909360318757233
revised costs:  1.8663635640717682
improvement:  0.4245724678039551

Using cost2
initial costs:  4.3610200643539425
revised costs:  3.966040094693502
improvement:  0.3949799696604406

I checked your Cpp code of RI algorithm and find it somewhat complicated with the part of calculating total distance, thus wondering if there's any important design that I miss in either your implementation or the paper that may cause the above discrepancy.

2. Could you please further explain the modelling scheme you implemented for equivalent ATSP of each ASHPP (Line 134-139 in eval_atsp/test_glop.py)? Because I find the result changes as I adjust L. So, should I change the value of L for my customized evaluation on different problem sizes/distributions? And how can I get a complete revised tour upon the MatNet-solved sub-results, for better clarity and reliability of evaluation?

L = 1.5
for sub_inst in sub_insts: # equivalent ATSP of each ASHPP
    sub_inst[:, 0] += L
    sub_inst[:, -1] += L
    sub_inst[0, :] += L
    sub_inst[-1, :] += L
    sub_inst[0, 0] = sub_inst[0, -1] = sub_inst[-1, 0] = sub_inst[-1, -1] = 0

Thanks again! Looking forward to your reply.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions