C++ Reference: class KnapsackSolver
Note: This documentation is automatically generated.
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."],[[["`KnapsackSolver` is a C++ class within the Google OR-Tools library designed for solving knapsack problems, offering various methods for initialization, problem-solving, and solution analysis."],["Users can initialize the solver with item profits, weights, and knapsack capacities using the `Init` method, and then invoke the `Solve` method to find the optimal solution."],["The class provides functionalities like `BestSolutionContains` to check if an item is part of the optimal solution, and `IsSolutionOptimal` to determine the solution's optimality."],["Additional features include setting time limits for the solver using `set_time_limit` and controlling problem reduction techniques with `set_use_reduction`."]]],[]]