Skip to content

Commit

Permalink
(splw) tiny changes on UI
Browse files Browse the repository at this point in the history
  • Loading branch information
shnarazk committed Aug 12, 2024
1 parent 0b1cb9e commit 59df80a
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions src/bin/splw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,46 +76,56 @@ mod restart {
.hist
.iter()
.enumerate()
.map(|(i, d)| (i as f64, d.0 as f64))
.map(|(i, d)| (i as f64, (d.0 as f64).log2().clamp(2.0, 6.0)))
.collect::<Vec<_>>();
self.cpr = self
.hist
.iter()
.enumerate()
.map(|(i, d)| (i as f64, d.1.log2().clamp(0.0, 8.0)))
.map(|(i, d)| (i as f64, d.1.log2().clamp(2.0, 6.0)))
.collect::<Vec<_>>();
let x_labels = vec![
Span::styled(format!("-{}", LEN), Style::default()),
Span::styled(format!("-{}", 3 * LEN / 4), Style::default()),
Span::styled(format!("-{}", LEN / 2), Style::default()),
Span::styled(format!("-{}", LEN / 4), Style::default()),
Span::styled(" 0", Style::default()),
];
let y_labels = vec![
Span::styled("0.0", Style::default()),
Span::styled("2.0", Style::default()),
Span::styled("4.0", Style::default()),
Span::styled("6.0", Style::default()),
Span::styled("8.0", Style::default()),
Span::styled(" lg(4)", Style::default()),
Span::styled(" lg(8)", Style::default()),
Span::styled("lg(16)", Style::default()),
Span::styled("lg(32)", Style::default()),
Span::styled("lg(64)", Style::default()),
];
let chart = Chart::new(vec![
// Dataset::default().data(&self.spans),
Dataset::default().data(&self.cpr),
// Dataset::default()
// .data(&self.spans)
// .style(Style::default().fg(Color::LightBlue))
// .marker(symbols::Marker::HalfBlock),
Dataset::default()
.data(&self.cpr)
.style(Style::default().fg(Color::LightRed))
.marker(symbols::Marker::Braille),
// .marker(symbols::Marker::Dot),
])
.block(
Block::bordered()
.title(" Log-scaled restart gaps ".cyan().bold())
.title_alignment(Alignment::Center),
Block::bordered().title(
"Log-scaled Restart Gap (conflicts per restart)"
.cyan()
.bold(),
), // .title_alignment(Alignment::Center),
)
.x_axis(
Axis::default()
.title("Restart")
.title("restart")
.style(Style::default().fg(Color::Gray))
.labels(x_labels)
.bounds([0.0, LEN as f64]),
)
.y_axis(
Axis::default()
.title("Restart gaps")
.title("gap")
.style(Style::default().fg(Color::Gray))
.labels(y_labels)
.bounds([0.0, 8.0]),
Expand Down

0 comments on commit 59df80a

Please sign in to comment.