Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class KnapsackGenericSolver
Note: This documentation is automatically generated.
----- KnapsackGenericSolver -----
KnapsackGenericSolver is the multi-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), and selecting another dimension when
more constrained.
TODO(user): In the case of a multi-dimensional knapsack problem, implement
an aggregated propagator to combine all dimensions and give a better guide
to select the next item (see, for instance, Dobson's aggregated efficiency).
[[["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."],[[["`KnapsackGenericSolver` is a C++ class designed for solving multi-dimensional knapsack problems."],["It utilizes propagators to guide the search for the optimal solution, with the primary propagator determining the next item to consider."],["Users can initialize the solver with profits, weights, and capacities, and then call `Solve` to find the optimal solution's profit."],["The `best_solution` method can be used to check if a specific item is included in the optimal knapsack."],["While a default primary propagator is used, it's recommended to implement an aggregated propagator for improved efficiency in multi-dimensional scenarios."]]],["The `KnapsackGenericSolver` class solves multi-dimensional knapsack problems. Key actions include `Init` to set up the problem with profits, weights, and capacities, and `Solve` to find the optimal solution's profit, optionally with a time limit. `set_primary_propagator_id` allows selecting the dimension guiding the next item assignment. `best_solution` checks if an item is in the optimal solution. `GetLowerAndUpperBoundWhenItem` retrieves the bounds when specific item is packed. `GetNumberOfItems` gets the number of items.\n"]]