Compare commits

..

No commits in common. "6aed675ecc0ed84c31a09dcaccf27314dd0b6b78" and "63d0dfb84a13474a75c7c8f2769ffcdd2ac4bd56" have entirely different histories.

2 changed files with 5 additions and 20 deletions

View File

@ -6,11 +6,3 @@ edition = "2021"
[dependencies]
rand = "0.9.0"
rocket = "0.5.1"
[profile.release]
opt-level = 'z' # Optimize for size
lto = true # Enable link-time optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations
panic = 'abort' # Abort on panic
strip = true # Strip symbols from binary*

View File

@ -1,5 +1,5 @@
//use rand::rng;
//use rand::seq::SliceRandom;
use rand::rng;
use rand::seq::SliceRandom;
#[macro_use]
extern crate rocket;
@ -46,17 +46,10 @@ fn lin_kernighan(mut tour: Vec<usize>, cities: &[(f64, f64)]) -> Vec<usize> {
#[get("/")]
fn index() -> String {
let cities = vec![
(50.03317681689108, 7.630692594382566),
(50.0511467529328, 7.610264891874095),
(50.07417811821386, 7.637215727783678),
(50.10154844328665, 7.683642662673185),
(50.070237512738046, 7.697022868469907),
(50.052876354261926, 7.6108551506699955),
];
let cities = vec![(0.0, 0.0), (1.0, 5.0), (5.0, 2.0), (6.0, 7.0), (3.0, 4.0)];
let tour: Vec<usize> = (0..cities.len()).collect();
//tour.shuffle(&mut rng());
let mut tour: Vec<usize> = (0..cities.len()).collect();
tour.shuffle(&mut rng());
let best_tour = lin_kernighan(tour, &cities);