Skip to content

Commit 6355721

Browse files
Add best fitness log message
1 parent fd3d623 commit 6355721

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

experiments/etc/shared.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ def solve_scientific(self, scientific_format, problem_path, config_path, solutio
6262
raise ValueError('cannot get solution statistic')
6363

6464
# expected:
65-
# fitness: (0.000, 92.000, 53389.603),
65+
# best fitness: (0.000, 92.000, 53389.603),
6666
for best in re.finditer(
67-
r"fitness: \((?P<unassigned>[\d.]+),?\s*(?P<tours>[\d.]+)?\s*, (?P<cost>[\d.]+)\)",
67+
r"best fitness: \((?P<unassigned>[\d.]+),?\s*(?P<tours>[\d.]+)?\s*, (?P<cost>[\d.]+)\)",
6868
p.stdout):
6969
pass
7070

rosomaxa/src/evolution/telemetry.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ where
269269
let speed = generations as Float / self.time.elapsed_secs_as_float();
270270

271271
self.log(format!("[{elapsed}s] total generations: {generations}, speed: {speed:.2} gen/sec",).as_str());
272+
if let Some(best) = population.ranked().next() {
273+
self.log(format!("\tbest fitness: ({})", format_fitness(best.fitness())).as_str());
274+
} else {
275+
self.log("no solutions found");
276+
}
272277

273278
self.metrics.duration = elapsed;
274279
self.metrics.speed = speed;

0 commit comments

Comments
 (0)