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

A class for storing the ABS2 QUBO solution. More...

#include <qbpp_abs2.hpp>

Inheritance diagram for qbpp_abs2::Sol:
Inheritance graph
[legend]
Collaboration diagram for qbpp_abs2::Sol:
Collaboration graph
[legend]

Public Member Functions

 Sol (const QuadModel &quad_model, const abs2::Sol &sol)
 Construct a new Sol object from an ABS2 solution. More...
 
 Sol (const qbpp::Sol &sol)
 Construct a new Sol object from a QUBO++ QUBO solution. More...
 
 Sol (const Sol &sol)=default
 Copy constructor. More...
 
void print (const std::string &attrs) const
 print the solution More...
 
void set (int index, bool value)
 Set the value of the variable with "index" to "value". More...
 
void set (qbpp::Var var, bool value)
 Set the value of the variable "var" to "value". More...
 
double get_tts () const
 
const std::shared_ptr< abs2::Solget_abs2sol_ptr () const
 Returns the reference to the ABS2 solution. More...
 
bool operator== (const Sol &sol) const
 
bool operator< (const Sol &sol) const
 
var_val_t get (vindex_t index) const
 
var_val_t get (Var var) const
 
energy_t get (const Expr &expr) const
 
template<typename T >
auto get (const Vector< T > &vec) const
 
bool has (Var var) const
 
void clear ()
 
void set (vindex_t index, bool value)
 
Sol set (const Sol &sol)
 
Sol set (const MapList &map_list)
 
virtual void flip (vindex_t index)
 
void flip (Var var)
 
vindex_t popcount () const
 
energy_t get_energy () const
 
void set_energy (energy_t energy)
 
const impl::BitVector & get_bit_vector () const
 
vindex_t var_count () const
 
energy_t get_constant () const
 
Var get_var (vindex_t index) const
 
vindex_t get_index (Var var) const
 
 operator MapList () const
 

Protected Member Functions

energy_t comp_energy () const
 
MapList get_map_list () const
 

Protected Attributes

const QuadModel quad_model_
 
impl::BitVector bit_vector_
 
std::optional< energy_t > energy_ = std::nullopt
 

Private Attributes

const std::shared_ptr< abs2::Solabs2sol_ptr
 Sol object created by ABS2 QUBO solver. More...
 

Detailed Description

A class for storing the ABS2 QUBO solution.

This class is derived from qbpp::Sol and containing an abs2::Sol object.

Definition at line 148 of file qbpp_abs2.hpp.

Constructor & Destructor Documentation

◆ Sol()

qbpp_abs2::Sol::Sol ( const Sol sol)
default

Copy constructor.

Parameters
solSol object

Member Function Documentation

◆ print()

void qbpp_abs2::Sol::print ( const std::string &  attrs) const
inline

print the solution

Parameters
attrsattributes to print

Definition at line 174 of file qbpp_abs2.hpp.

◆ set() [1/5]

void qbpp_abs2::Sol::set ( int  index,
bool  value 
)
inline

Set the value of the variable with "index" to "value".

Parameters
indexVariable index
valueValue

Definition at line 179 of file qbpp_abs2.hpp.

Here is the call graph for this function:

◆ set() [2/5]

void qbpp_abs2::Sol::set ( qbpp::Var  var,
bool  value 
)
inline

Set the value of the variable "var" to "value".

Parameters
varVariable
valueValue

Definition at line 187 of file qbpp_abs2.hpp.

Here is the call graph for this function:

◆ get_tts()

double qbpp_abs2::Sol::get_tts ( ) const
inline

Definition at line 192 of file qbpp_abs2.hpp.

◆ get_abs2sol_ptr()

const std::shared_ptr<abs2::Sol> qbpp_abs2::Sol::get_abs2sol_ptr ( ) const
inline

Returns the reference to the ABS2 solution.

Returns
ABS2 solution

Definition at line 196 of file qbpp_abs2.hpp.

Here is the caller graph for this function:

◆ comp_energy()

energy_t qbpp::Sol::comp_energy ( ) const
inlineprotectedinherited

Definition at line 2809 of file qbpp.hpp.

Here is the caller graph for this function:

◆ get_map_list()

MapList qbpp::Sol::get_map_list ( ) const
inlineprotectedinherited

Definition at line 2834 of file qbpp.hpp.

Here is the call graph for this function:

◆ operator==()

bool qbpp::Sol::operator== ( const Sol sol) const
inlineinherited

Definition at line 1487 of file qbpp.hpp.

Here is the call graph for this function:

◆ operator<()

bool qbpp::Sol::operator< ( const Sol sol) const
inlineinherited

Definition at line 1491 of file qbpp.hpp.

Here is the call graph for this function:

◆ get() [1/4]

var_val_t qbpp::Sol::get ( vindex_t  index) const
inlineinherited

Definition at line 1500 of file qbpp.hpp.

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

◆ get() [2/4]

var_val_t qbpp::Sol::get ( Var  var) const
inlineinherited

Definition at line 1502 of file qbpp.hpp.

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

◆ get() [3/4]

energy_t qbpp::Sol::get ( const Expr expr) const
inlineinherited

Definition at line 1504 of file qbpp.hpp.

Here is the call graph for this function:

◆ get() [4/4]

template<typename T >
auto qbpp::Sol::get ( const Vector< T > &  vec) const
inlineinherited

Definition at line 1514 of file qbpp.hpp.

Here is the call graph for this function:

◆ has()

bool qbpp::Sol::has ( Var  var) const
inlineinherited

Definition at line 1506 of file qbpp.hpp.

Here is the call graph for this function:

◆ clear()

void qbpp::Sol::clear ( )
inlineinherited

Definition at line 1508 of file qbpp.hpp.

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

◆ set() [3/5]

void qbpp::Sol::set ( vindex_t  index,
bool  value 
)
inlineinherited

Definition at line 1523 of file qbpp.hpp.

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

◆ set() [4/5]

Sol qbpp::Sol::set ( const Sol sol)
inlineinherited

Definition at line 1566 of file qbpp.hpp.

Here is the call graph for this function:

◆ set() [5/5]

Sol qbpp::Sol::set ( const MapList map_list)
inlineinherited

Definition at line 1573 of file qbpp.hpp.

Here is the call graph for this function:

◆ flip() [1/2]

virtual void qbpp::Sol::flip ( vindex_t  index)
inlinevirtualinherited

Reimplemented in qbpp::exhaustive_solver::SolDelta, qbpp::easy_solver::TabuSolDelta, and qbpp::easy_solver::SolDelta.

Definition at line 1533 of file qbpp.hpp.

Here is the call graph for this function:

◆ flip() [2/2]

void qbpp::Sol::flip ( Var  var)
inlineinherited

Definition at line 1538 of file qbpp.hpp.

Here is the call graph for this function:

◆ popcount()

vindex_t qbpp::Sol::popcount ( ) const
inlineinherited

Definition at line 1543 of file qbpp.hpp.

Here is the call graph for this function:

◆ get_energy()

energy_t qbpp::Sol::get_energy ( ) const
inlineinherited

Definition at line 1545 of file qbpp.hpp.

Here is the caller graph for this function:

◆ set_energy()

void qbpp::Sol::set_energy ( energy_t  energy)
inlineinherited

Definition at line 1550 of file qbpp.hpp.

Here is the caller graph for this function:

◆ get_bit_vector()

const impl::BitVector& qbpp::Sol::get_bit_vector ( ) const
inlineinherited

Definition at line 1552 of file qbpp.hpp.

◆ var_count()

vindex_t qbpp::Sol::var_count ( ) const
inlineinherited

Definition at line 1556 of file qbpp.hpp.

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

◆ get_constant()

energy_t qbpp::Sol::get_constant ( ) const
inlineinherited

Definition at line 1558 of file qbpp.hpp.

Here is the call graph for this function:

◆ get_var()

Var qbpp::Sol::get_var ( vindex_t  index) const
inlineinherited

Definition at line 1560 of file qbpp.hpp.

Here is the call graph for this function:

◆ get_index()

vindex_t qbpp::Sol::get_index ( Var  var) const
inlineinherited

Definition at line 1562 of file qbpp.hpp.

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

◆ operator MapList()

qbpp::Sol::operator MapList ( ) const
inlineinherited

Definition at line 1564 of file qbpp.hpp.

Member Data Documentation

◆ abs2sol_ptr

const std::shared_ptr<abs2::Sol> qbpp_abs2::Sol::abs2sol_ptr
private

Sol object created by ABS2 QUBO solver.

Note
The shared_ptr is used to avoid copying the object.

Definition at line 151 of file qbpp_abs2.hpp.

◆ quad_model_

const QuadModel qbpp::Sol::quad_model_
protectedinherited

Definition at line 1444 of file qbpp.hpp.

◆ bit_vector_

impl::BitVector qbpp::Sol::bit_vector_
protectedinherited

Definition at line 1446 of file qbpp.hpp.

◆ energy_

std::optional<energy_t> qbpp::Sol::energy_ = std::nullopt
mutableprotectedinherited

Definition at line 1448 of file qbpp.hpp.


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