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'.
Method |
from | Return type: const KnapsackSearchNodeForCuts& |
Init | Return type: void |
KnapsackSearchPathForCuts | Arguments: const KnapsackSearchNodeForCuts* from,
const KnapsackSearchNodeForCuts* to |
KnapsackSearchPathForCuts | Arguments: const KnapsackSearchPathForCuts&) = delete;
KnapsackSearchPathForCuts& operator=(const KnapsackSearchPathForCuts&) =
delete;
void Init( |
to | Return type: const KnapsackSearchNodeForCuts& |
via | Return type: const KnapsackSearchNodeForCuts& |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[null,null,["Last updated 2024-08-06 UTC."],[],["`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,[]]