-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhygese-solver.jl
More file actions
34 lines (26 loc) · 782 Bytes
/
hygese-solver.jl
File metadata and controls
34 lines (26 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Hygese TSP Solver wrapper
# Uses the Hygese.jl package (Hybrid Genetic Search)
import Hygese
"""
solve_hygese(tsp, timeout)
Solves a TSPLIB instance using HGS (Hybrid Genetic Search).
Hygese implements a state-of-the-art hybrid genetic algorithm. The algorithm
combines population-based search with local improvement procedures for high-quality
solutions.
# Arguments
- `tsp`: the TSPLIB instance
- `timeout`: solver timeout in seconds
"""
function solve_hygese(tsp, timeout::Int=60)
n = tsp.dimension
dist_matrix = Float64.(tsp.weights)
t_start = time()
try
result = Hygese.solve_tsp(dist_matrix; verbose=false)
elapsed = time() - t_start
return result.cost, elapsed
catch e
println("Hygese error: $e")
return nothing, nothing
end
end