MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / ant_colony_optimization

Function ant_colony_optimization

src/graph/ant_colony_optimization.rs:236–262  ·  view source on GitHub ↗

Solve the Travelling Salesman Problem using Ant Colony Optimization. Given a list of cities (as (x, y) coordinates), finds a near-optimal route that visits each city exactly once and returns to the starting city. # Arguments `cities` - Vector of (x, y) coordinate tuples representing city locations `num_ants` - Number of ants per iteration (default: 10) `num_iterations` - Number of iterations to

(
    cities: Vec<(f64, f64)>,
    num_ants: usize,
    num_iterations: usize,
    evaporation_rate: f64,
    alpha: f64,
    beta: f64,
    q: f64,
)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 8

test_aco_simpleFunction · 0.85
test_aco_larger_problemFunction · 0.85
test_aco_empty_citiesFunction · 0.85
test_aco_single_cityFunction · 0.85
test_default_parametersFunction · 0.85
test_zero_antsFunction · 0.85
test_zero_iterationsFunction · 0.85
test_extreme_parametersFunction · 0.85

Calls 2

is_emptyMethod · 0.45
solveMethod · 0.45

Tested by 8

test_aco_simpleFunction · 0.68
test_aco_larger_problemFunction · 0.68
test_aco_empty_citiesFunction · 0.68
test_aco_single_cityFunction · 0.68
test_default_parametersFunction · 0.68
test_zero_antsFunction · 0.68
test_zero_iterationsFunction · 0.68
test_extreme_parametersFunction · 0.68