Compare commits

..

2 Commits

Author SHA1 Message Date
Outbreak2096 6e5352e426
Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (72 of 72 strings)

Translation: Topola/Topola
Translate-URL: https://translate.codeberg.org/projects/topola/topola/zh_Hans/
2025-11-18 23:23:40 +00:00
Mikolaj Wielgus a8a2e8d8cb feat(autorouter/planar_reconfigurer): Make g-scores proportional to number of changed routes 2025-11-19 00:18:30 +01:00
1 changed files with 16 additions and 9 deletions

View File

@ -104,19 +104,19 @@ impl SccSearchNode {
let mut expanded_nodes = vec![];
if let Some(resized) = self.clone().resize(length) {
if let Some(permuted_resized) = resized.permute() {
if let Some((permuted_resized, changed_count)) = resized.permute() {
expanded_nodes.push((
0.1,
(self.curr_permutation.len() - length) as f64,
changed_count as f64 / 100.0,
(self.curr_permutation.len() - permuted_resized.length) as f64,
permuted_resized,
));
}
}
if let Some(permuted) = self.clone().permute() {
if let Some((permuted, changed_count)) = self.clone().permute() {
expanded_nodes.push((
0.1,
(self.curr_permutation.len() - self.length) as f64,
changed_count as f64 / 100.0,
(self.curr_permutation.len() - permuted.length) as f64,
permuted,
));
}
@ -141,12 +141,19 @@ impl SccSearchNode {
})
}
fn permute(mut self) -> Option<Self> {
fn permute(mut self) -> Option<(Self, usize)> {
let mut changed_count = 0;
for (i, element) in self.permutations.next()?.iter().enumerate() {
self.curr_permutation[i] = element.clone();
if self.curr_permutation[i] != *element {
self.curr_permutation[i] = element.clone();
// FIXME: Uncommenting this breaks the 4x4_1206_led_matrix test.
changed_count += 1;
}
}
Some(self)
Some((self, changed_count))
}
}