jvkersch / pyconcorde

Python wrapper around the Concorde TSP solver
BSD 3-Clause "New" or "Revised" License
347 stars 95 forks source link

Editing numbers of cut #15

Open aleraguz opened 6 years ago

aleraguz commented 6 years ago

Is there any possibility to change the numbers of cuts used by Concorde to solve TSP? I mean, I think it is currently working con 16 cuts, can I change to 25 for example?

jvkersch commented 6 years ago

Hmm, not sure. I'd have to look into that...

aleraguz commented 6 years ago

What I've figured out, so far, is a function called "usage" in concorde.c . In this function is basically explained the same thing you can find running concorde by command windows, if you put "-C 24" it will run the program adding 24 local cuts. However I could find a way to invoke it in the code.

jvkersch commented 6 years ago

@aleraguz That's a good find, thanks! It shouldn't be too difficult to expose that option on the Python side.

aleraguz commented 6 years ago

To be honest I was finding this information because I got some non-exact solution using Concorde and at the beginning I thought it was because of the numbers of local cutting planes. Actually, this problem arises if you set coordinates with many decimal numbers cause of Concorde's huge approximation errors. Thus, basically, just multiply all the distances by 100 or 1000.

jvkersch commented 3 years ago

@aleraguz Thanks for the find, and sorry it took me so long to get back to this.

I wanted to point out that the 0.2.0 API will run concorde in a subprocess, which will make it much easier to pass arbitrary options to the solver. See https://github.com/jvkersch/pyconcorde/issues/28#issuecomment-770354999 for details.