Updates the state by applying or reverting a decision.
Returns false if fails, i.e. trying to apply an inconsistent decision
to an already assigned item.
[[["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."],[[["\u003cp\u003e\u003ccode\u003eKnapsackState\u003c/code\u003e is a C++ class representing a partial solution to the knapsack problem.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to initialize, update, and query the state of items in the knapsack.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eKnapsackState\u003c/code\u003e tracks which items are included in the solution and which are still unbound.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eUpdateState\u003c/code\u003e method allows applying or reverting decisions, ensuring consistency.\u003c/p\u003e\n"]]],["`KnapsackState` represents a partial solution to the knapsack problem. Key actions include: `Init` initializes item vectors as unbound. `GetNumberOfItems` retrieves the item count. `is_bound` and `is_in` check item status. `UpdateState` applies or reverts decisions via a `KnapsackAssignment`, returning `false` if a decision is inconsistent with existing assignments. There's also a constructor `KnapsackState` available.\n"],null,["# KnapsackState\n\nC++ Reference: class KnapsackState\n==================================\n\n\nNote: This documentation is automatically generated.\n\n----- KnapsackState ----- \nKnapsackState represents a partial solution to the knapsack problem.\n\n| Method ||\n|--------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`GetNumberOfItems`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L423) | Return type: `int ` \u003cbr /\u003e |\n| [`Init`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L417) | Return type: `void ` Arguments: `int number_of_items` Initializes vectors with number_of_items set to false (i.e. not bound yet). |\n| [`is_bound`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L424) | Return type: `bool ` Arguments: `int id` \u003cbr /\u003e |\n| [`is_in`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L425) | Return type: `bool ` Arguments: `int id` \u003cbr /\u003e |\n| [`KnapsackState`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L414) | \u003cbr /\u003e |\n| [`UpdateState`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L421) | Return type: `bool ` Arguments: `bool revert, const KnapsackAssignment& assignment` Updates the state by applying or reverting a decision. Returns false if fails, i.e. trying to apply an inconsistent decision to an already assigned item. |"]]