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."],[],["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"]]