Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class KnapsackSolverForCuts
Note: This documentation is automatically generated.
----- KnapsackSolverForCuts -----
KnapsackSolverForCuts is the one-dimensional knapsack solver class.
In the current implementation, the next item to assign is given by the
primary propagator. Using SetPrimaryPropagator allows changing the default
(propagator of the first dimension).
Arguments: int item_id, bool is_item_in,
double* lower_bound, double* upper_bound
Gets the lower and the upper bound when the item is in or out of the
knapsack. To ensure objects are correctly initialized, this method should
not be called before Init().
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["`KnapsackSolverForCuts` is a C++ class designed for solving one-dimensional knapsack problems."],["It utilizes a primary propagator to determine the next item for assignment, which can be customized using `SetPrimaryPropagator`."],["The class provides methods for initialization (`Init`), solving (`Solve`), and retrieving solution details (`best_solution`, `GetUpperBound`, etc.)."],["Users can set limits on nodes explored (`set_node_limit`) and thresholds for solution bounds (`set_solution_lower_bound_threshold`, `set_solution_upper_bound_threshold`) to control the solving process."]]],["The `KnapsackSolverForCuts` class solves one-dimensional knapsack problems. Key actions include initializing the solver with item profits, weights, and capacity via `Init`. Users can query information like the number of items with `GetNumberOfItems`. `GetLowerAndUpperBoundWhenItem` provides bounds for specific items. `Solve` computes the optimal solution, while `best_solution` checks if an item is in the optimal solution. Additionally, `set_node_limit` limits the search, and `set_solution_lower_bound_threshold` and `set_solution_upper_bound_threshold` allows to stop the search based on solution quality.\n"]]