More debug output
This commit is contained in:
parent
f17dd4cb9a
commit
99f050bc12
@ -1,11 +1,11 @@
|
|||||||
use super::*;
|
|
||||||
|
|
||||||
use svgdom::{AttributeId, AttributeValue, Document, ElementId, FilterSvg, PathSegment, QName};
|
use svgdom::{AttributeId, AttributeValue, Document, ElementId, FilterSvg, PathSegment, QName};
|
||||||
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
pub(crate) struct InputData {
|
pub(crate) struct InputData {
|
||||||
pub start: Point,
|
pub start: Point,
|
||||||
pub polys: Vec<Polygon>,
|
pub polys: Vec<Polygon>,
|
||||||
|
@ -121,6 +121,9 @@ fn main() {
|
|||||||
.flatten()
|
.flatten()
|
||||||
.map(Point::from)
|
.map(Point::from)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
if opt.debug {
|
||||||
|
eprintln!("DEBUG: {} Polygone mit {} Ecken", polys.len(), points.len());
|
||||||
|
}
|
||||||
|
|
||||||
// Startzustand: Lisa ist an ihrem Haus, zurückgelegte Distanz ist Null
|
// Startzustand: Lisa ist an ihrem Haus, zurückgelegte Distanz ist Null
|
||||||
let start = RunState {
|
let start = RunState {
|
||||||
@ -143,6 +146,7 @@ fn main() {
|
|||||||
let mut iterations = 0;
|
let mut iterations = 0;
|
||||||
let mut time = time::Duration::from_secs(0);
|
let mut time = time::Duration::from_secs(0);
|
||||||
|
|
||||||
|
let dijkstra_start = Instant::now();
|
||||||
// Dijkstra-Algorithmus anwenden
|
// Dijkstra-Algorithmus anwenden
|
||||||
let route = dijkstra(
|
let route = dijkstra(
|
||||||
&start,
|
&start,
|
||||||
@ -200,7 +204,8 @@ fn main() {
|
|||||||
|
|
||||||
// Performanz-Einschätzung ausgeben
|
// Performanz-Einschätzung ausgeben
|
||||||
if opt.debug {
|
if opt.debug {
|
||||||
eprintln!("{}us/iteration ({} iterations)", time.as_micros() / iterations, iterations)
|
eprintln!("DEBUG: {}us/iteration ({} iterations)", time.as_micros() / iterations, iterations);
|
||||||
|
eprintln!("DEBUG: {}ms total", (Instant::now() - dijkstra_start).as_millis());
|
||||||
}
|
}
|
||||||
|
|
||||||
// beste Lösung ausgeben
|
// beste Lösung ausgeben
|
||||||
@ -230,7 +235,7 @@ fn main() {
|
|||||||
.unwrap() + 1
|
.unwrap() + 1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
eprintln!("x={:.02} y={:.02}", s.pos.x(), s.pos.y());
|
eprintln!("x={:03.02} y={:03.02}", s.pos.x(), s.pos.y());
|
||||||
}
|
}
|
||||||
eprintln!("Länge: {:.0}m", last.total_distance);
|
eprintln!("Länge: {:.0}m", last.total_distance);
|
||||||
let seconds = last.total_distance / lisa_speed;
|
let seconds = last.total_distance / lisa_speed;
|
||||||
|
Loading…
Reference in New Issue
Block a user