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

Class to store a solution computed by ABS2 QUBO solver. More...

#include <abs2.hpp>

Public Member Functions

 Sol (int size)
 Constructor for a solution with "size" bits. More...
 
 Sol ()
 Construct a new Sol object. More...
 
 ~Sol ()
 Destructor. More...
 
 Sol (const Sol &sol)
 Copy constructor. Create a new Sol object from "sol". More...
 
 Sol (Sol &&sol)
 Move constructor. Create a new Sol object from "sol". More...
 
Soloperator= (const Sol &sol)
 Copy assignment of "sol". More...
 
Soloperator= (Sol &&sol)
 Move assignment of "sol". More...
 
void set (int i, bool val)
 Set "val" to x_i. More...
 
bool get (int i) const
 Get the value of x_i. More...
 
void set (const std::string &key, const std::string &val)
 Set "val" to key. More...
 
const std::string get (const std::string &key) const
 Get the value of key. More...
 
void print (const std::string &option="", std::ostream &output_stream=std::cout) const
 Output solution in stream "output_stream". More...
 
void print (std::ostream &output_stream, const std::string &option="") const
 Output solution in stream "output_stream". More...
 

Private Attributes

std::unique_ptr< Impl > pimpl
 

Detailed Description

Class to store a solution computed by ABS2 QUBO solver.

Note
The size of the solution can be changed after the construction

Definition at line 205 of file abs2.hpp.

Constructor & Destructor Documentation

◆ Sol() [1/4]

abs2::Sol::Sol ( int  size)

Constructor for a solution with "size" bits.

Parameters
sizeNumber of bits

◆ Sol() [2/4]

abs2::Sol::Sol ( )

Construct a new Sol object.

◆ ~Sol()

abs2::Sol::~Sol ( )

Destructor.

◆ Sol() [3/4]

abs2::Sol::Sol ( const Sol sol)

Copy constructor. Create a new Sol object from "sol".

Parameters
solSol object to be copied

◆ Sol() [4/4]

abs2::Sol::Sol ( Sol &&  sol)

Move constructor. Create a new Sol object from "sol".

Parameters
solSol object to be moved

Member Function Documentation

◆ operator=() [1/2]

Sol& abs2::Sol::operator= ( const Sol sol)

Copy assignment of "sol".

Parameters
solSol object to be copied

◆ operator=() [2/2]

Sol& abs2::Sol::operator= ( Sol &&  sol)

Move assignment of "sol".

Parameters
solSol object to be moved

◆ set() [1/2]

void abs2::Sol::set ( int  i,
bool  val 
)

Set "val" to x_i.

Parameters
iIndex of x
valValue to be set

◆ get() [1/2]

bool abs2::Sol::get ( int  i) const

Get the value of x_i.

Parameters
iIndex of x
Returns
x_i

◆ set() [2/2]

void abs2::Sol::set ( const std::string &  key,
const std::string &  val 
)

Set "val" to key.

Parameters
keySolution key
valSolution value

◆ get() [2/2]

const std::string abs2::Sol::get ( const std::string &  key) const

Get the value of key.

Parameters
keySolution key
Returns
Solution value

◆ print() [1/2]

void abs2::Sol::print ( const std::string &  option = "",
std::ostream &  output_stream = std::cout 
) const

Output solution in stream "output_stream".

Parameters
optionFormat option
output_streamOutput stream

◆ print() [2/2]

void abs2::Sol::print ( std::ostream &  output_stream,
const std::string &  option = "" 
) const

Output solution in stream "output_stream".

Parameters
optionFormat option
output_streamOutput stream

Member Data Documentation

◆ pimpl

std::unique_ptr<Impl> abs2::Sol::pimpl
private

Definition at line 254 of file abs2.hpp.


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