Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiments on huge instances #23

Closed
jcoupey opened this issue Jan 23, 2016 · 7 comments
Closed

Experiments on huge instances #23

jcoupey opened this issue Jan 23, 2016 · 7 comments

Comments

@jcoupey
Copy link
Collaborator

jcoupey commented Jan 23, 2016

Discussion initiated from PR #22. Related commits to be found in branch experimental_huge_instances.

@jcoupey
Copy link
Collaborator Author

jcoupey commented Jan 23, 2016

@frodrigo: Thanks for pointing this out.

I've been paying closer attention to memory while solving big TSPLIB instances. On my laptop the load starts to be significant around 10000 locations. usa13509.tsp is still ok but all bigger instances fail...

The heuristic phase gives a peek for memory usage due to this, a sub-matrix is actually copied from the existing matrix...

@frodrigo
Copy link
Contributor

So, maybe the first step is avoiding to instantiate submatrix by create a virtual matrix using index to access original matrix data.

@jcoupey
Copy link
Collaborator Author

jcoupey commented Jan 23, 2016

After copy, the sub_matrix is actually modified before being passed to minimum_weight_perfect_matching. So I should check on the best way to do this without breaking the original matrix.

This is not actually a problem with your approach as only a part of the locations vector would be copied.

@jcoupey
Copy link
Collaborator Author

jcoupey commented Jan 24, 2016

I removed the initial matrix implementation and replaced it by the one you suggested (this is the only one required in this branch anyway). I removed everything that stood in the way for compilation (e.g. other loaders, forced start and stop options).

Still segfaults due to matrix copies, I hope to fix this by merging some commits from the refactor_tsp_structure branch.

jcoupey added a commit that referenced this issue Mar 7, 2016
Conflicts:
	src/heuristics/christo_heuristic.cpp
	src/loaders/osrm_wrapper.h
	src/loaders/tsplib_loader.h
	src/structures/matrix.h
	src/structures/tsp.cpp
jcoupey added a commit that referenced this issue Mar 7, 2016
jcoupey added a commit that referenced this issue Mar 7, 2016
jcoupey added a commit that referenced this issue Mar 7, 2016
@jcoupey
Copy link
Collaborator Author

jcoupey commented Mar 12, 2016

@frodrigo Using current HEAD of the experimental_huge_instances branch, I've been able to solve bigger instances, e.g. pla33810 from TSPLIB. Limitations are:

@frodrigo
Copy link
Contributor

Interesting ! Thank for looking at this.
How close are you of know solution of pla33810 in 10 hours ?
The bad part, here, is the amount of memory required. Do you think the edge class and the storage of all the weight can be removed ? The spanning tree can be done on square distance without computing the square root. For the rest, I 'm not what between compute distance on the fly or storing on spare matrix can be efficient.

@jcoupey
Copy link
Collaborator Author

jcoupey commented Mar 14, 2016

The solution for pla33810 costs 68133433, which is +3.16% from optimal. As the benchmark results points out so far, the size of the instances does not really impact on the current approach's performance in term of distance to optimal.
The results for other big instances in TSPLIB are quite in line with that: rl11849, usa13509, brd14051, d15112 and d18512 are at +2.96% , +2.88%, +3.18%, +2.93% and +2.94% from the respective optimal solutions.

Reducing the memory by not storing the edges (at least for the complete graph) would be the next step. This might be a little more tricky than with the matrix as the undirected_graph is used differently depending on the context (with edges or with an adjacency list).

@jcoupey jcoupey closed this as completed Sep 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants