aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorLia Lenckowski <lialenck@protonmail.com>2024-11-28 16:16:23 +0100
committerLia Lenckowski <lialenck@protonmail.com>2024-11-28 16:16:23 +0100
commite71c5d901beec2b15052785893f7250f958f7719 (patch)
tree832661f0b122f036adc8d85ebaa05ea062527b2a /src/main.rs
parent552bc452de76fd6760c9946c641a2de8217ff1d2 (diff)
downloadembeddings-sort-e71c5d901beec2b15052785893f7250f958f7719.tar
embeddings-sort-e71c5d901beec2b15052785893f7250f958f7719.tar.bz2
embeddings-sort-e71c5d901beec2b15052785893f7250f958f7719.tar.zst
wrap help, add flag for path rotation, change default 2-opt iteration count
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 45621cf..3055768 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -67,9 +67,14 @@ struct Args {
tsp_approx: TspBaseAlg,
/// Number of 2-Opt refinement steps. Has quickly diminishing returns
- #[arg(short = 'r', default_value = "3")]
+ #[arg(short = 'r', default_value = "5")]
refine: usize,
+ /// Don't try to improve result by rotating the output path such that less emphasis is put on
+ /// the similarity of the first and last image
+ #[arg(long)]
+ no_rotate: bool,
+
/// Ignore failed embeddings
#[arg(short = 'i', long)]
ignore_errors: bool,
@@ -174,7 +179,13 @@ where
})
.unzip();
- let (tsp_path, total_dist) = tsp(&embeds, &args.tsp_approx, args.refine, &args.hash_seed);
+ let (tsp_path, total_dist) = tsp(
+ &embeds,
+ &args.tsp_approx,
+ args.refine,
+ !args.no_rotate,
+ &args.hash_seed,
+ );
Ok((
tsp_path.iter().map(|i| images[*i].clone()).collect(),