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

Optimal path and minimal cost #2

Open
georgesakarellos opened this issue Apr 13, 2021 · 1 comment
Open

Optimal path and minimal cost #2

georgesakarellos opened this issue Apr 13, 2021 · 1 comment

Comments

@georgesakarellos
Copy link

Hi John!

I managed to get your code to run, but it took some modifications. In the 'Example usage' I used the following code to get it to run in a new python file in the same directory:


from AntColonyOptimizer import AntColonyOptimizer
import numpy as np
problem = some_distance_matrix

problem = np.array(problem)
optimizer = AntColonyOptimizer(ants=1, evaporation_rate=.1, intensification=2, alpha=1, beta=1,
beta_evaporation_rate=0, choose_best=.1)

best = optimizer.fit(problem, 100)
optimizer.plot()


With this I managed to get a performance vs iterations graph (an odd one...) but I'm uncertain on how to get the code to display the optimal path and the minimum cost. Any advice?

Thanks,
George

@johnberroa
Copy link
Owner

Hi @georgesakarellos! What did you need to change to get it to run? Seems to run fine on my local machine.

I don't have any code to display the optimal path, although that should be saved in self.best_path, so creating one shouldn't be too hard. Minimum cost should be saved in self.best.

Note that it's been quite some time since I wrote this code, so I'm a bit rusty with it 😄. But if you have any other questions, feel free to ask!

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