Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class PruningHamiltonianSolver
Note: This documentation is automatically generated.
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."],[[["\u003cp\u003eThe \u003ccode\u003ePruningHamiltonianSolver\u003c/code\u003e class is used for solving the Hamiltonian path problem in C++, aiming to find the shortest path that visits all nodes exactly once.\u003c/p\u003e\n"],["\u003cp\u003eIt offers methods such as \u003ccode\u003eHamiltonianCost\u003c/code\u003e to retrieve the cost of the path and constructors to initialize the solver with the problem's cost function and number of nodes.\u003c/p\u003e\n"],["\u003cp\u003eUsers can leverage this class by providing a cost function that defines the cost between any two nodes and utilizing its methods to determine the optimal Hamiltonian path and its associated cost.\u003c/p\u003e\n"]]],["The `PruningHamiltonianSolver` class in C++ offers methods for calculating Hamiltonian paths. The `HamiltonianCost` method computes the cost of a path from node 0 to a specified `end_node`, returning the cost as `CostType`. The class constructor `PruningHamiltonianSolver` can be initialized with a `CostFunction` or with the number of nodes (`num_nodes`) and a `CostFunction`. These methods are part of calculating hamiltonian path in the graph.\n"],null,["# PruningHamiltonianSolver\n\nC++ Reference: class PruningHamiltonianSolver\n=============================================\n\n\nNote: This documentation is automatically generated.\n\n| Method ||\n|------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|\n| [`HamiltonianCost`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L901) | Return type: `CostType ` Arguments: `int end_node` Returns the cost of the Hamiltonian path from 0 to end_node. |\n| [`PruningHamiltonianSolver`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L897) | Return type: `explicit ` Arguments: `CostFunction cost` \u003cbr /\u003e |\n| [`PruningHamiltonianSolver`](https://github.com/google/or-tools/blob/v9.4/ortools/graph/hamiltonian_path.h#L898) | \u003cbr /\u003e Arguments: `int num_nodes, CostFunction cost` \u003cbr /\u003e |"]]