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

customization issue #7

Closed
drissDean opened this issue Aug 11, 2021 · 4 comments
Closed

customization issue #7

drissDean opened this issue Aug 11, 2021 · 4 comments

Comments

@drissDean
Copy link

Hello.

I've replaced the tsp file with data coming from a database and it works well. Now I want to replace the classic Euclidean distance metrics with estimated travel time between points.
I've already written the methods for that and then, given two points, I can tell how many seconds it'll take to travel from one of them to the other.
I don't know how to integrate that in the system.

Your help would be very appreciated.

@cptanalatriste
Copy link
Owner

Hello @drissDean !

Isula's implementation of ACO algorithms look for solutions with the minimum cost. These solutions are generated by instances of Ant, and the cost is obtained by the method Ant::getSolutionCost(). In a TSP instance, the cost is expressed in terms of distance. If you have a different cost metric, just override Ant::getSolutionCost() with the logic that suits your domain.

@drissDean
Copy link
Author

Thank you very much.
I'm striving to keep the minimum cost too. The issue with the Euclidean system is that no two cities in a country are joined with a straightforward path. We can even find watercourses or other things we would have to bypass and that would make the distance much longer. So I need to take into account certain real factors for the system I have to build. I actually try to deliver the best itinerary given the actual traffic data, not only distances between points.
Since I've taken the aco-acs-tsp implementation, then I have to create my own class which would extend AntForTsp class (and overload the getSolutionCost() method) and use it anywhere we had AntForTsp class before?

@cptanalatriste
Copy link
Owner

Hi @drissDean ,

I would approach it this way:

  1. Extend AntForTsp , for example CustomAntForTsp, overriding getSolutionCost(). According to your problem, you might also need to override getHeuristicValue().
  2. Use these new type CustomAntForTsp when creating the AntColony instance for your AcoProblemSolver. Take a look at the getAntColony method at AcoTspWithIsula.

Good luck!

@drissDean
Copy link
Author

Alright, sir. Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants