Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class BasicKnapsackSolver
Note: This documentation is automatically generated.
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
- O(num_variables * num_relevant_values ^ 2) or
- O(num_variables * num_relevant_values * max_domain_size).
Method |
Solve | Return type: Result Arguments: const std::vector<Domain>& domains,
const std::vector<int64_t>& coeffs,
const std::vector<int64_t>& costs, const Domain& rhs |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[null,null,["Last updated 2024-08-06 UTC."],[],["The `BasicKnapsackSolver` class utilizes dynamic programming to solve a single knapsack problem. It simplifies variables in single linear constraints, with a time complexity of either O(num_variables * num_relevant_values ^ 2) or O(num_variables * num_relevant_values * max_domain_size). The primary action is performed by the `Solve` method, which accepts vectors of domains, coefficients, costs, and a right-hand side domain (`rhs`) as input and returns a `Result`.\n"]]