Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class KnapsackSearchNode
Note: This documentation is automatically generated.
----- KnapsackSearchNode -----
KnapsackSearchNode is a class used to describe a decision in the decision
search tree.
The node is defined by a pointer to the parent search node and an
assignment (see KnapsackAssignment).
As the current state is not explicitly stored in a search node, one should
go through the search tree to incrementally build a partial solution from
a previous search node.
[[["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\u003eKnapsackSearchNode\u003c/code\u003e objects represent decisions within a knapsack problem's decision tree, linked to a parent node and an assignment.\u003c/p\u003e\n"],["\u003cp\u003eThe node's state is implicitly defined by tracing back through its parent nodes to build a partial solution.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods for accessing information like assignment, current profit, depth in the tree, and the next item to consider.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eKnapsackSearchNode\u003c/code\u003e is crucial for navigating and exploring potential solutions in the knapsack problem's search space.\u003c/p\u003e\n"]]],["`KnapsackSearchNode` represents a decision in a search tree, defined by a parent node and an assignment. Key actions involve retrieving information like the `assignment`, `current_profit`, `depth`, `next_item_id`, and `parent`. Methods also allow setting the `current_profit`, `next_item_id`, and `profit_upper_bound`. The state is not explicitly stored, it can be obtained by traversing the search tree using the parent, and incrementally building a partial solution.\n"],null,["# KnapsackSearchNode\n\nC++ Reference: class KnapsackSearchNode\n=======================================\n\n\nNote: This documentation is automatically generated.\n\n----- KnapsackSearchNode ----- \nKnapsackSearchNode is a class used to describe a decision in the decision search tree. The node is defined by a pointer to the parent search node and an assignment (see KnapsackAssignment). As the current state is not explicitly stored in a search node, one should go through the search tree to incrementally build a partial solution from a previous search node.\n\n| Method ||\n|--------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [`assignment`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L343) | Return type: `const KnapsackAssignment& ` \u003cbr /\u003e |\n| [`current_profit`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L345) | Return type: `int64_t ` \u003cbr /\u003e |\n| [`depth`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L341) | Return type: `int ` \u003cbr /\u003e |\n| [`KnapsackSearchNode`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L339) | \u003cbr /\u003e Arguments: `const KnapsackSearchNode* const parent, const KnapsackAssignment& assignment` \u003cbr /\u003e |\n| [`next_item_id`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L351) | Return type: `int ` \u003cbr /\u003e |\n| [`parent`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L342) | Return type: `const KnapsackSearchNode* const ` \u003cbr /\u003e |\n| [`profit_upper_bound`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L348) | Return type: `int64_t ` \u003cbr /\u003e |\n| [`set_current_profit`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L346) | Return type: `void ` Arguments: `int64_t profit` \u003cbr /\u003e |\n| [`set_next_item_id`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L352) | Return type: `void ` Arguments: `int id` \u003cbr /\u003e |\n| [`set_profit_upper_bound`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver.h#L349) | Return type: `void ` Arguments: `int64_t profit` \u003cbr /\u003e |"]]