QUBO++ Library with QUBO Solver APIs
Author: Koji Nakano, License: Non-commercial research and evaluation purposes without any guarantees.
|
Class to store the QUBO expression for the Traveling Salesman Problem (TSP). More...
#include <qbpp_tsp.hpp>
Public Member Functions | |
TSPQuadModel (const TSPMap &map, bool fix_first=false) | |
Generate a QUBO expression for the Traveling Salesman Problem (TSP) from a map. More... | |
uint32_t | node_count () const |
Returns the number of nodes in the TSP. More... | |
qbpp::Var | get_var (uint32_t i, uint32_t j) const |
Get the variable at (i, j). More... | |
bool | get_fix_first () const |
Returns true if the first node is fixed to node 0. More... | |
const std::vector< coeff_t > & | get_linear () const |
coeff_t | get_linear (vindex_t index) const |
const std::vector< vindex_t > & | get_degree () const |
vindex_t | get_degree (vindex_t index) const |
const std::vector< std::vector< std::pair< vindex_t, coeff_t > > > & | get_quadratic () const |
std::pair< vindex_t, coeff_t > | get_quadratic (vindex_t i, vindex_t j) const |
size_t | term_count (vindex_t deg) const |
size_t | term_count () const override |
coeff_t | get_min_coeff () const |
coeff_t | get_max_coeff () const |
vindex_t | var_count () const |
Var | get_var (vindex_t index) const |
vindex_t | get_index (Var var) const |
bool | has (Var var) const |
const Expr & | get_expr () const |
operator const Expr & () const | |
energy_t | get_constant () const |
const Terms & | get_terms () const |
std::vector< Var > | get_index_var () const |
Static Protected Member Functions | |
static const Expr & | check_expr (const Expr &expr) |
static Expr | check_expr (Expr &&expr) |
Protected Attributes | |
const std::shared_ptr< const Expr > | expr_ptr_ |
const std::shared_ptr< const impl::IndexVarMapper > | index_var_ptr_ |
Private Member Functions | |
std::tuple< qbpp::Model, bool, qbpp::Vector< qbpp::Vector< qbpp::Var > > > | helper_func (const TSPMap &map, bool fix_first) |
Generate a QUBO expression for the Traveling Salesman Problem (TSP). More... | |
TSPQuadModel (std::tuple< qbpp::QuadModel, bool, qbpp::Vector< qbpp::Vector< qbpp::Var >>> tuple) | |
Private Attributes | |
const bool | fix_first |
true if the first node is fixed to node 0. More... | |
const qbpp::Vector< qbpp::Vector< qbpp::Var > > | x |
Variables for the TSP. More... | |
const std::shared_ptr< const Impl > | pimpl_ |
const std::vector< coeff_t > & | linear_ |
const std::vector< vindex_t > & | degree_ |
const std::vector< std::vector< std::pair< vindex_t, coeff_t > > > & | quadratic_ |
Class to store the QUBO expression for the Traveling Salesman Problem (TSP).
Definition at line 103 of file qbpp_tsp.hpp.
|
inlineprivate |
Definition at line 116 of file qbpp_tsp.hpp.
|
inline |
Generate a QUBO expression for the Traveling Salesman Problem (TSP) from a map.
map | Map of nodes with their coordinates |
fix_first | true if the first node is fixed to node 0 |
Definition at line 128 of file qbpp_tsp.hpp.
|
inlineprivate |
Generate a QUBO expression for the Traveling Salesman Problem (TSP).
Definition at line 309 of file qbpp_tsp.hpp.
|
inline |
Returns the number of nodes in the TSP.
Definition at line 133 of file qbpp_tsp.hpp.
|
inline |
Get the variable at (i, j).
Definition at line 136 of file qbpp_tsp.hpp.
|
inline |
Returns true if the first node is fixed to node 0.
Definition at line 139 of file qbpp_tsp.hpp.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineoverridevirtualinherited |
Reimplemented from qbpp::Model.
Definition at line 1268 of file qbpp.hpp.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
private |
true if the first node is fixed to node 0.
Definition at line 105 of file qbpp_tsp.hpp.
|
private |
Variables for the TSP.
Definition at line 107 of file qbpp_tsp.hpp.
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
protectedinherited |
|
protectedinherited |