![]() |
Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
|
#include <util.h>
Classes | |
struct | Result |
Public Member Functions | |
Result | Solve (absl::Span< const Domain > domains, absl::Span< const int64_t > coeffs, absl::Span< const int64_t > costs, const Domain &rhs) |
Use Dynamic programming to solve a single knapsack. This is used by the presolver to simplify variables appearing in a single linear constraint.
Complexity is the best of
BasicKnapsackSolver::Result operations_research::sat::BasicKnapsackSolver::Solve | ( | absl::Span< const Domain > | domains, |
absl::Span< const int64_t > | coeffs, | ||
absl::Span< const int64_t > | costs, | ||
const Domain & | rhs ) |
The complexity of our DP will depends on the number of "activity" values that need to be considered.
Problem is clearly infeasible, we can report the result right away.
Abort if complexity too large.
Canonicalize to positive coeffs and non-negative variables.
Transform solution back.