Skip to content

Commit d78865e

Browse files
committed
Updates the solver to handle an empty problem.
1 parent b565610 commit d78865e

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/solver.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class SolverImpl {
8181
backtracks_(*backtracks), cancelled_(cancelled) {}
8282

8383
absl::StatusOr<Solution> Solve() {
84+
if (problem_.buffers.empty()) return solution_;
8485
const auto num_buffers = problem_.buffers.size();
8586
assignment_.offsets.resize(num_buffers, kNoOffset);
8687
solution_.offsets.resize(num_buffers, kNoOffset);

tests/solver_test.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ TEST_P(SolverTest, InfeasibleTricky) {
137137
test_infeasible(problem);
138138
}
139139

140+
TEST_P(SolverTest, EmptyProblem) {
141+
const Problem problem;
142+
test_feasible(problem);
143+
}
144+
140145
TEST_P(SolverTest, SingleBuffer) {
141146
const Problem problem = {
142147
.buffers = {{.lifespan = {0, 2}, .size = 2}},

0 commit comments

Comments
 (0)