Skip to content

abdulvahidgok/simulated-annealing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simulated Annealing



Usage

from solvers import TSPSolver

solver = TSPSolver(
    data=data,
    steps=2000,  # maximum steps for each thermal equilibrium loop, without steps program will calculate number of neighbour combinations.
    initial_temperature=1000,
    temperature_min=5,  # when system temperature reaches minimum temperature, cooling loop stops.
    cooling_speed=0.9999,  # The system cools slower as the cooling speed approaches 1.
    random_solution=True,  # will generate neighbour solutions randomly ( default )
    distance_calculator=geopy.distance,  # calculates distance between two coordinates.
    distance_matrix_result=None  # optional
)
solver.solve()

Cooling Schedule Types

from solvers import TSPSolver
from algorithm.cooling_schedule import CoolingScheduleType
solver = TSPSolver(
    data=data,
    initial_temperature=7000,
    temperature_min=65,
    cooling_speed=0.0001,
    cooling_schedule_type=CoolingScheduleType.EXPONENTIAL
)
solver.solve()

Plot Accepted Routes

from tests.plot import PlotTSPSolver
PlotTSPSolver(
    data=data,
    initial_temperature=7000,
    temperature_min=65,
    cooling_speed=0.001,
    random_solutions=False,
    plot_coords=True,  # for live simulated annealing process
    save_last_frame=True,  # will save last state /tests/frames folder
    cooling_schedule_type=CoolingScheduleType.EXPONENTIAL
)
solver.solve()

Test

$ python test.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published