Class to store and manipulate a QUBO model.
More...
#include <abs2.hpp>
|
| | Model (int size, int bits) |
| | Constructor for an empty QUBO model. More...
|
| |
| | Model (int size, int64_t min_coeff, int64_t max_coeff) |
| | Constructor for an empty QUBO model with specified variable size and coefficient range. More...
|
| |
| | Model (const std::string &filename) |
| | Constructor for loading a QUBO model from a file. More...
|
| |
| | ~Model () |
| | Destructor for the QUBO model. More...
|
| |
| | Model (const Model &model) |
| | Copy constructor for the QUBO model. More...
|
| |
| Model & | operator= (const Model &model) |
| | Assignment operator for copying the QUBO model. More...
|
| |
| void | set (int i, int j, int64_t val) |
| | Sets the value of W_{i,j} if i<=j, and W_{j,i} if j<i. More...
|
| |
| int64_t | get (int i, int j) const |
| | Gets the value of W_{i,j} if i<=j, and W_{j,i} if j<i. More...
|
| |
| void | set (const std::string &key, const std::string &val) |
| | Sets a value for a given key. More...
|
| |
| std::string | get (const std::string &key) const |
| | Gets the value associated with a given key. More...
|
| |
| void | print (const std::string &option="", std::ostream &output_stream=std::cout) const |
| | Outputs the model to the specified output stream. More...
|
| |
| void | print (std::ostream &output_stream, const std::string &option="") const |
| | Outputs the model to the specified output stream. More...
|
| |
|
| std::unique_ptr< Impl > | pimpl |
| |
Class to store and manipulate a QUBO model.
Definition at line 91 of file abs2.hpp.
◆ Model() [1/4]
| abs2::Model::Model |
( |
int |
size, |
|
|
int |
bits |
|
) |
| |
Constructor for an empty QUBO model.
- Parameters
-
| size | Number of variables. |
| bits | Number of bits for each coefficient. |
- Note
- The "size" must be between 32 and 65536, and [min_coeff, max_coeff] defines the range of W_{i,j}.
◆ Model() [2/4]
| abs2::Model::Model |
( |
int |
size, |
|
|
int64_t |
min_coeff, |
|
|
int64_t |
max_coeff |
|
) |
| |
Constructor for an empty QUBO model with specified variable size and coefficient range.
- Parameters
-
| size | Number of variables. |
| min_coeff | Minimum value of W_{i,j}. |
| max_coeff | Maximum value of W_{i,j}. |
◆ Model() [3/4]
| abs2::Model::Model |
( |
const std::string & |
filename | ) |
|
Constructor for loading a QUBO model from a file.
- Parameters
-
| filename | The name of the file to load the model from. |
◆ ~Model()
Destructor for the QUBO model.
◆ Model() [4/4]
| abs2::Model::Model |
( |
const Model & |
model | ) |
|
Copy constructor for the QUBO model.
- Parameters
-
| model | The QUBO model to be copied. |
◆ operator=()
| Model& abs2::Model::operator= |
( |
const Model & |
model | ) |
|
Assignment operator for copying the QUBO model.
- Parameters
-
| model | The QUBO model to be copied. |
- Returns
- Reference to the copied QUBO model.
◆ set() [1/2]
| void abs2::Model::set |
( |
int |
i, |
|
|
int |
j, |
|
|
int64_t |
val |
|
) |
| |
Sets the value of W_{i,j} if i<=j, and W_{j,i} if j<i.
- Parameters
-
| i | Row index of W. |
| j | Column index of W. |
| val | Value to be set. |
◆ get() [1/2]
| int64_t abs2::Model::get |
( |
int |
i, |
|
|
int |
j |
|
) |
| const |
Gets the value of W_{i,j} if i<=j, and W_{j,i} if j<i.
- Parameters
-
| i | Row index of W. |
| j | Column index of W. |
- Returns
- The value of W_{i,j} or W_{j,i}.
◆ set() [2/2]
| void abs2::Model::set |
( |
const std::string & |
key, |
|
|
const std::string & |
val |
|
) |
| |
Sets a value for a given key.
- Parameters
-
| key | The key. |
| val | The value to be set. |
◆ get() [2/2]
| std::string abs2::Model::get |
( |
const std::string & |
key | ) |
const |
Gets the value associated with a given key.
- Parameters
-
- Returns
- The value associated with the key.
◆ print() [1/2]
| void abs2::Model::print |
( |
const std::string & |
option = "", |
|
|
std::ostream & |
output_stream = std::cout |
|
) |
| const |
Outputs the model to the specified output stream.
- Parameters
-
| option | The format option. |
| output_stream | The output stream to write to. Defaults to std::cout. |
◆ print() [2/2]
| void abs2::Model::print |
( |
std::ostream & |
output_stream, |
|
|
const std::string & |
option = "" |
|
) |
| const |
Outputs the model to the specified output stream.
- Parameters
-
| output_stream | The output stream to write to. |
| option | The format option. Defaults to an empty string. |
◆ pimpl
| std::unique_ptr<Impl> abs2::Model::pimpl |
|
private |
The documentation for this class was generated from the following file: