QUBO++ Library with QUBO Solver APIs
Author: Koji Nakano, License: Non-commercial research and evaluation purposes without any guarantees.
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
qbpp::tsp::TSPSol Class Reference

Class to store a Tour of the TSP. More...

#include <qbpp_tsp.hpp>

Collaboration diagram for qbpp::tsp::TSPSol:
Collaboration graph
[legend]

Public Member Functions

 TSPSol (const TSPQuadModel &tsp_quad_model, const qbpp::Sol &sol)
 Generates a solution of the Traveling Salesman Problem (TSP) from a QUBO model and its solution. More...
 
uint32_t operator[] (uint32_t index) const
 Get the node at index in the tour. More...
 
uint32_t node_count () const
 Get the number of nodes in the tour. More...
 
void print () const
 Print the tour. More...
 
void print_matrix () const
 

Static Private Member Functions

static std::vector< uint32_t > gen_tour (const TSPQuadModel &tsp_quad_model, const Sol &sol)
 helper function to generate a tour from the solution. More...
 

Private Attributes

const TSPQuadModel tsp_quad_model
 QUBO expression for the Traveling Salesman Problem (TSP). More...
 
const Sol sol
 Solution of the QUBO model. More...
 
const std::vector< uint32_t > tour
 A vector of nodes representing the tour. More...
 

Detailed Description

Class to store a Tour of the TSP.

Definition at line 143 of file qbpp_tsp.hpp.

Constructor & Destructor Documentation

◆ TSPSol()

qbpp::tsp::TSPSol::TSPSol ( const TSPQuadModel tsp_quad_model,
const qbpp::Sol sol 
)
inline

Generates a solution of the Traveling Salesman Problem (TSP) from a QUBO model and its solution.

Parameters
tsp_quad_modelThe TSP QUBO expression
solThe Solution of the QUBO model

Definition at line 163 of file qbpp_tsp.hpp.

Member Function Documentation

◆ gen_tour()

std::vector< uint32_t > qbpp::tsp::TSPSol::gen_tour ( const TSPQuadModel tsp_quad_model,
const Sol sol 
)
inlinestaticprivate

helper function to generate a tour from the solution.

Parameters
tsp_quad_modelTSP QUBO expression
solSolution of the QUBO model
Returns
A vector of nodes representing the tour.

Definition at line 353 of file qbpp_tsp.hpp.

Here is the call graph for this function:

◆ operator[]()

uint32_t qbpp::tsp::TSPSol::operator[] ( uint32_t  index) const
inline

Get the node at index in the tour.

Parameters
indexIndex of the node.
Returns
Node at index in the tour.

Definition at line 171 of file qbpp_tsp.hpp.

◆ node_count()

uint32_t qbpp::tsp::TSPSol::node_count ( ) const
inline

Get the number of nodes in the tour.

Definition at line 174 of file qbpp_tsp.hpp.

Here is the call graph for this function:

◆ print()

void qbpp::tsp::TSPSol::print ( ) const
inline

Print the tour.

Definition at line 177 of file qbpp_tsp.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_matrix()

void qbpp::tsp::TSPSol::print_matrix ( ) const
inline

Definition at line 187 of file qbpp_tsp.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ tsp_quad_model

const TSPQuadModel qbpp::tsp::TSPSol::tsp_quad_model
private

QUBO expression for the Traveling Salesman Problem (TSP).

Definition at line 145 of file qbpp_tsp.hpp.

◆ sol

const Sol qbpp::tsp::TSPSol::sol
private

Solution of the QUBO model.

Definition at line 147 of file qbpp_tsp.hpp.

◆ tour

const std::vector<uint32_t> qbpp::tsp::TSPSol::tour
private

A vector of nodes representing the tour.

Definition at line 149 of file qbpp_tsp.hpp.


The documentation for this class was generated from the following file: