Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class KnapsackSearchPathForCuts
Note: This documentation is automatically generated.
----- KnapsackSearchPathForCuts -----
KnapsackSearchPathForCuts is a small class used to represent the path between
a node to another node in the search tree.
As the solution state is not stored for each search node, the state should
be rebuilt at each node. One simple solution is to apply all decisions
between the node 'to' and the root. This can be computed in
O(number_of_items).
However, it is possible to achieve better average complexity. Two
consecutively explored nodes are usually close enough (i.e., much less than
number_of_items) to benefit from an incremental update from the node
'from' to the node 'to'.
The 'via' field is the common parent of 'from' field and 'to' field.
So the state can be built by reverting all decisions from 'from' to 'via'
and then applying all decisions from 'via' to 'to'.
[[["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\u003eKnapsackSearchPathForCuts\u003c/code\u003e is a class that represents the path between two nodes in a search tree for the knapsack problem.\u003c/p\u003e\n"],["\u003cp\u003eIt aims to efficiently rebuild the solution state at each node by applying/reverting decisions made along the path.\u003c/p\u003e\n"],["\u003cp\u003eInstead of recomputing the entire state, it leverages a common parent ('via') for incremental updates, improving average complexity.\u003c/p\u003e\n"],["\u003cp\u003eThis approach optimizes state rebuilding by only modifying decisions between the 'from', 'via', and 'to' nodes.\u003c/p\u003e\n"]]],["`KnapsackSearchPathForCuts` represents the path between two nodes in a search tree. It aims to rebuild the solution state efficiently. Instead of recomputing from the root, it incrementally updates the state. This is done by reverting decisions from the 'from' node to the 'via' node (common parent) and then applying decisions from 'via' to the 'to' node. The class uses methods 'from', 'to' and 'via' to get information about the involved nodes. `Init` is a method to use, and there are 2 constructors.\n"],null,["# KnapsackSearchPathForCuts\n\nC++ Reference: class KnapsackSearchPathForCuts\n==============================================\n\n\nNote: This documentation is automatically generated.\n\n----- KnapsackSearchPathForCuts ----- \nKnapsackSearchPathForCuts is a small class used to represent the path between a node to another node in the search tree. As the solution state is not stored for each search node, the state should be rebuilt at each node. One simple solution is to apply all decisions between the node 'to' and the root. This can be computed in O(number_of_items). \n\nHowever, it is possible to achieve better average complexity. Two consecutively explored nodes are usually close enough (i.e., much less than number_of_items) to benefit from an incremental update from the node 'from' to the node 'to'. \n\nThe 'via' field is the common parent of 'from' field and 'to' field. So the state can be built by reverting all decisions from 'from' to 'via' and then applying all decisions from 'via' to 'to'.\n\n| Method ||\n|--------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`from`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver_for_cuts.h#L169) | Return type: `const KnapsackSearchNodeForCuts& ` \u003cbr /\u003e |\n| [`Init`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver_for_cuts.h#L168) | Return type: `void ` \u003cbr /\u003e |\n| [`KnapsackSearchPathForCuts`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver_for_cuts.h#L161) | \u003cbr /\u003e Arguments: `const KnapsackSearchNodeForCuts* from, const KnapsackSearchNodeForCuts* to` \u003cbr /\u003e |\n| [`KnapsackSearchPathForCuts`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver_for_cuts.h#L164) | \u003cbr /\u003e Arguments: `const KnapsackSearchPathForCuts&) = delete; KnapsackSearchPathForCuts& operator=(const KnapsackSearchPathForCuts&) = delete; void Init(` \u003cbr /\u003e |\n| [`to`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver_for_cuts.h#L171) | Return type: `const KnapsackSearchNodeForCuts& ` \u003cbr /\u003e |\n| [`via`](https://github.com/google/or-tools/blob/v9.4/ortools/algorithms/knapsack_solver_for_cuts.h#L170) | Return type: `const KnapsackSearchNodeForCuts& ` \u003cbr /\u003e |"]]