Diagnostics for MultiPodBuilder (#500)
* Diagnostics for MultiPodBuilder * Reduce duplication
This commit is contained in:
parent
3203c883e5
commit
8844fe124c
2 changed files with 489 additions and 0 deletions
|
|
@ -59,10 +59,12 @@ use crate::{
|
|||
|
||||
mod cost;
|
||||
mod deps;
|
||||
pub mod diagnostics;
|
||||
mod solver;
|
||||
|
||||
use cost::StatementCost;
|
||||
use deps::{DependencyGraph, StatementSource};
|
||||
pub use diagnostics::{ResourceSummary, SolutionBreakdown};
|
||||
pub use solver::MultiPodSolution;
|
||||
|
||||
/// Error type for multi-POD operations.
|
||||
|
|
@ -200,6 +202,22 @@ impl SolvedMultiPod {
|
|||
&self.solution
|
||||
}
|
||||
|
||||
/// Compute a post-solve per-POD resource utilization breakdown.
|
||||
pub fn solution_breakdown(&self) -> SolutionBreakdown {
|
||||
let costs: Vec<StatementCost> = self
|
||||
.operations
|
||||
.iter()
|
||||
.map(StatementCost::from_operation)
|
||||
.collect();
|
||||
SolutionBreakdown::from_solution(
|
||||
&costs,
|
||||
&self.solution.pod_statements,
|
||||
self.solution.pod_count,
|
||||
self.statements.len(),
|
||||
&self.params,
|
||||
)
|
||||
}
|
||||
|
||||
/// Build and prove all PODs.
|
||||
///
|
||||
/// Builds PODs in dependency order (0, 1, ..., k) and proves each one.
|
||||
|
|
@ -515,6 +533,20 @@ impl MultiPodBuilder {
|
|||
self.builder.stmt_len()
|
||||
}
|
||||
|
||||
/// Compute a pre-solve resource summary showing aggregate demand vs. per-POD limits.
|
||||
///
|
||||
/// This is useful for understanding which resource category is the bottleneck
|
||||
/// before running the solver, especially when debugging solver performance issues.
|
||||
pub fn resource_summary(&self) -> ResourceSummary {
|
||||
let costs: Vec<StatementCost> = self
|
||||
.builder
|
||||
.operations
|
||||
.iter()
|
||||
.map(StatementCost::from_operation)
|
||||
.collect();
|
||||
ResourceSummary::from_costs(&costs, &self.params)
|
||||
}
|
||||
|
||||
/// Solve the packing problem and return a solved builder ready for proving.
|
||||
///
|
||||
/// This runs the MILP solver to find the optimal POD assignment.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue