Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <util.h>
Classes | |
struct | Result |
Public Member Functions | |
Result | Solve (const std::vector< Domain > &domains, const std::vector< int64_t > &coeffs, const std::vector< 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 | ( | const std::vector< Domain > & | domains, |
const std::vector< int64_t > & | coeffs, | ||
const std::vector< 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.