No project description provided
Project description
Qbsolv
NOTICE: This repository is deprecated as of the end of 2021. Support will be discontinued after March 2022. Please update your code to use Ocean’s dwave-hybrid or Leap’s quantum-classical hybrid solvers instead.
A decomposing solver that finds a minimum value of a large quadratic unconstrained binary optimization (QUBO) problem by splitting it into pieces. The pieces are solved using a classical solver running the tabu algorithm. qbsolv also enables configuring a D-Wave system as the solver.
Installation or Building
Python
A wheel might be available for your system on PyPI. Source distributions are provided as well.
pip install dwave-qbsolv
Alternatively, you can build the library with setuptools.
pip install -r python/requirements.txt
python setup.py install
C
To build the C library use cmake to generate a build command for your system. On Linux the commands would be something like this:
mkdir build; cd build
cmake ..
make
To build the command line interface turn the cmake option QBSOLV_BUILD_CMD on. The command line option for cmake to do this would be -DQBSOLV_BUILD_CMD=ON. To build the tests turn the cmake option QBSOLV_BUILD_TESTS on. The command line option for cmake to do this would be -DQBSOLV_BUILD_TESTS=ON.
Command Line Usage
qbsolv -i infile [-o outfile] [-m] [-T] [-n] [-S SubMatrix] [-w]
[-h] [-a algorithm] [-v verbosityLevel] [-V] [-q] [-t seconds]
Description
qbsolv executes a quadratic unconstrained binary optimization (QUBO) problem represented in a file. It returns bit-vector results that minimizes—or optionally, maximizes—the value of the objective function represented by the QUBO. The problem is represented in QUBO(5) file format.
The QUBO input problem is not limited to the graph size or connectivity of a sampler, for example the D-Wave system.
Options are as follows:
-i infile
Name of the file for the input QUBO. This option is mandatory.
-o outfile
Optional output filename.
Default is the standard output.
-a algorithm
Optional selection for the outer loop algorithm. Default is o.
'o' for original qbsolv method. Submatrix based upon change in energy.
'p' for path relinking. Submatrix based upon differences of solutions
-m
Optional selection of finding the maximum instead of the minimum.
-T target
Optional argument target value of the objective function. Stops execution when found.
-t timeout
Optional timeout value. Stops execution when the elapsed CPU time equals or
exceeds it. Timeout is only checked after completion of the main
loop. Other halt values such as 'target' and 'repeats' halt before 'timeout'.
Default value is 2592000.0.
-n repeats
Optional number of times the main loop of the algorithm is repeated with
no change in optimal value found before stopping.
Default value is 50.
-S subproblemSize
Optional size of the sub-problems into which the QUBO is decomposed.
If no "-S 0" or "-S" argument is present, uses the size specified in the
embedding file found in the workspace set up by DW. If no DW environment is
established, value defaults to 47 and uses the tabu solver on subproblems.
If a value is specified, subproblems based on that size are solved with the
tabu solver.
-w
If present, the QUBO matrix and result are printed in .csv format.
-h
If present, prints the help or usage message for qbsolv and exits without execution.
-v verbosityLevel
Optional setting of the verbosity of output. The default verbosityLevel of
0 outputs the number of bits in the solution, the solution,
and the energy of the solution. A verbosityLevel of 1 outputs the same
information for multiple solutions, if found. A verbosityLevel of 2
also outputs more detailed information at each step of the algorithm. The
information increases for verbosity levels of up to 4.
-V
If present, prints the version number of the qbsolv program and exits without execution.
-q
If present, prints the format of the QUBO file.
-r seed
Used to reset the seed for the random number generation.
qbsolv QUBO Input File Format
A .qubo file contains data that describes an unconstrained quadratic binary optimization problem. It is an ASCII file comprising four types of lines:
Comments defined by a “c” in column 1. Comments may appear anywhere in the file, and are ignored.
Program line defined by a “p” in the first column. A single program line must be the first non-comment line in the file. The program line has six required fields separated by space(s), as in this example:
p qubo topology maxNodes nNodes nCouplers
where:
p Problem line sentinel. qubo File type identifier. topology String that identifies the topology of the problem and the specific problem type. For an unconstrained problem, target is "0" or "unconstrained." In future implementations, valid strings might include "chimera128" or "chimera512" (among others). maxNodes Number of nodes in the topology. nNodes Number of nodes in the problem (nNodes <= maxNodes). Each node has a unique number and must take a value in the range {0 - (maxNodes-1)}. A duplicate node number is an error. Node numbers need not be in order, and need not be contiguous. nCouplers Number of couplers in the problem. Each coupler is a unique connection between two different nodes. The maximum number of couplers is (nNodes)^2. A duplicate coupler is an error.
nNodes clauses. Each clause is made up of three numbers, separated by one or more blanks. The first two numbers must be integers and are the number for this node (repeated). The node number must be in range {0 , (maxNodes-1)}. The third value is the weight associated with the node. Weight may be an integer or float, and can take on any positive or negative value, or be set to zero.
nCouplers clauses. Each clause is made up of three numbers, separated by one or more blanks. The first two numbers, (i and j), are the node numbers for this coupler and must be different integers, where (i < j).Each number must be one of the nNodes valid node numbers (and thus in range {0, (maxNodes-1)}). The third value is the strength associated with the coupler. Strength may be an integer or float, and can take on any positive or negative value, but not zero. Every node must connect with at least one other node (thus must have at least one coupler connected to it).
Here is a simple QUBO file example for an unconstrained QUBO with 4 nodes and 6 couplers. This example is provided to illustrate the elements of a QUBO benchmark file, not to represent a real problem.
| <--- column 1
c
c This is a sample .qubo file
c with 4 nodes and 6 couplers
c
p qubo 0 4 4 6
c ------------------
0 0 3.4
1 1 4.5
2 2 2.1
3 3 -2.4
c ------------------
0 1 2.2
0 2 3.4
1 2 4.5
0 3 -2
1 3 4.5678
2 3 -3.22
Library usage
TODO
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for dwave_qbsolv-0.3.4-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b41fa3d8832de14f405d11c5b87070c1cc2458a11628141a6bda1fc680185b47 |
|
MD5 | 76162147eab2ab5a96c84ae98117441e |
|
BLAKE2b-256 | 6addde4d96b478f89089278d00fe00e1450e43774a727ae89ec3bf31b7339f9e |
Hashes for dwave_qbsolv-0.3.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b4b3918e78f15a87076b4c8e6cbe31ea3550b9ae8625ae3029ce71e64863075 |
|
MD5 | dccdd15b35fd9307260a90928e31b921 |
|
BLAKE2b-256 | 75379d333af90263690aaa124b546714066b44248c3bb0e5cb0e03be380600f1 |
Hashes for dwave_qbsolv-0.3.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46760a7157853bbc20da47930e799bcd9bc29370f2d0ba2666f789e49fa5347a |
|
MD5 | 85123f5e8db27ba73c44ae1f6ecb79d5 |
|
BLAKE2b-256 | 19bef7ee689d5605eb7e6e920313d3222d8b0822d3926127d38458395d4ac28b |
Hashes for dwave_qbsolv-0.3.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e620a2a9add7a39241509e775bd0f7ea4d8973b85f7461dcc1d4f2d67275e7af |
|
MD5 | 866c1d4afaf0c6ae10cccdfb184b3f16 |
|
BLAKE2b-256 | b0ee559c017f28afe32932176adb1237348063ab5cd1ca83be3452e682c018e9 |
Hashes for dwave_qbsolv-0.3.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a9b90601e2d209be5d2e63f352be22e398e3fec7e135a7ba8186ec45f3ebc8b |
|
MD5 | 665b8d1952bb03aa9aa65c0e16f22e4c |
|
BLAKE2b-256 | 4cb48e24c7a5fdcd5f3f97168bc5c3fc61a365e6d0b042d9f2ba5e00edec99d3 |
Hashes for dwave_qbsolv-0.3.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47bfe274029c94a4a73e36561bcda4779ee210dced96a00dd2d78cf2e6c559ce |
|
MD5 | b5993313ae10103e18b537ef7cc7c1b2 |
|
BLAKE2b-256 | a715b9919accbc7b9e41457e3bd95fbc07a8509d04adcafd7fa35de1da319e41 |
Hashes for dwave_qbsolv-0.3.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff46826b967303ceadd285dae28a5327b8aaf28cd08df621d9eed2d4dc04cd9e |
|
MD5 | 3ff58ee82a28676134aa23c718661b9f |
|
BLAKE2b-256 | d703761268d472e8639771c94a7fdc6f789f576bff869af5e9c0042d6bdc9354 |
Hashes for dwave_qbsolv-0.3.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 406ce48b4606dafd65b8326058a591740b89edd304e7998f6de5560bbae18510 |
|
MD5 | 7995ad6727ad05b3726b36c261f3e4c7 |
|
BLAKE2b-256 | da7ab7723a2f856d90d4afc21ba90d6c68045c52c65a0bba0d14f55b21431722 |
Hashes for dwave_qbsolv-0.3.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd9643a8ed18baabdec92c116d374a53bff1ff2d12e0d3e60847264d1d2053cf |
|
MD5 | f7ef5a8aa4b7273bf6c89ee8184fd383 |
|
BLAKE2b-256 | 5dfa7064dcbca5da5fa02fa92f903699e36b2e9e9163e70959fa75049f49abd9 |
Hashes for dwave_qbsolv-0.3.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af862d82f5439116149bd89975080914b1c96f17fc03a07a64e709c28257246e |
|
MD5 | 231a41ad1c596c984edc6467ba6268b9 |
|
BLAKE2b-256 | fa442d7c1404037bac90645df3d9e79cf7c6e6b9448811feb7101d6f3ddba244 |
Hashes for dwave_qbsolv-0.3.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3dc40bc288306ff97da53606b9c4064d7e1af3c2b4441dcd9c31d3df008f3f4 |
|
MD5 | 180fad635744b3c9b3f7070c910b2524 |
|
BLAKE2b-256 | b84cae98190120f2e368baea764e5333ccaf26317035a6767319f1f073a6b90f |
Hashes for dwave_qbsolv-0.3.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a60051818c7573dc26aa8fa228932ab9ae99548c9ad77ace30bbd611cd549ca9 |
|
MD5 | 0c69c7841228bb39b08aa72489b55eae |
|
BLAKE2b-256 | fd6d2cf189377f36d1106ffa0351e0f0e9719cd5df1946acb4eb3dbecab36908 |
Hashes for dwave_qbsolv-0.3.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | faec8f87cfac35f63626c7de8aaa769f9b855e4661af31319bcdf657eadb9e2f |
|
MD5 | 4af2567b801e9f409a74961fc00e0a5f |
|
BLAKE2b-256 | 62e77a7c0ade04f68ed186f4b83b9ad0c8341a8b92272486d008a4292760c405 |
Hashes for dwave_qbsolv-0.3.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed459c07c9cccb544e7647adfa98949da0dc96758b63b91ae38b4ab14640585e |
|
MD5 | 7cdba811864df44058b94f6aae42535a |
|
BLAKE2b-256 | 3b02832e6e0317524cf85ca215b5b671e76351e35bcef1c75d9845f0cd1e23e2 |
Hashes for dwave_qbsolv-0.3.4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ffce4b23f46bcc2df21da73e59bd773808b7da4d0a318549ec514e10d8e6333 |
|
MD5 | 3b02b144865715453ca2d1b741b709c2 |
|
BLAKE2b-256 | a13e73ecc3a0459ef108cf5eca71ec2053c4311cd22b4318e908fa39d812b403 |
Hashes for dwave_qbsolv-0.3.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cc02aa06525524fc60acd8a31830b8dea2e279da8d198e09721ee9d23463d43 |
|
MD5 | 5ffda100fc7cb11e8b71c6ff7cd57ade |
|
BLAKE2b-256 | 9b823a957e07f5aa75f97f9c2ed364919e458f6bf53b47ef118d846165e4768e |
Hashes for dwave_qbsolv-0.3.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ced43f315e97ca9bd27c4b2c40036eb58fd1ca99c4fbdb854475b67dd4e0910c |
|
MD5 | 9a470aab7695b77a56e8599bdc73685d |
|
BLAKE2b-256 | b1b775c2103ae6a0c2ba15fea3aecc3022235def6df7260d3373f3dbea6ba73f |
Hashes for dwave_qbsolv-0.3.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18506b31cab8f46755d3d9376aceb90f5cacff3ed8097e85055f2f9dd79be1a8 |
|
MD5 | 9a79b7a80987e3d7cb35c2ecc72702b7 |
|
BLAKE2b-256 | 54fd6cb4051b03145df69daf2c9c2dcbbf63b7f4a051407eb1151ac0dd58f1f5 |
Hashes for dwave_qbsolv-0.3.4-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e2ed26ada403371acb76d8c2d762a793ce36a9d249566791bf8d5cd53e10d2a |
|
MD5 | 54bd7715b5b86e4678d878fedc72fa48 |
|
BLAKE2b-256 | aa1a8fdd79ca804e52e4752250feed98db87a24e0d2670c81f17eb1610c872b7 |