bqpjson package

bqpjson.core module

bqpjson.core.bool_to_spin(bool_data)[source]
bqpjson.core.bqpjson_to_hfs(data, out_stream, chimera_cell_size=None, chimera_degree=None, precision=5)[source]

Format description from (https://github.com/alex1770/QUBO-Chimera)

The format of the instance-description file starts with a line giving the size of the Chimera graph. (Two numbers are given to specify an m x n rectangle, but currently only a square, m=n, is accepted.) The subsequent lines are of the form

<Chimera vertex> <Chimera vertex> weight

where <Chimera vertex> is specified by four numbers using the format,

Chimera graph, C_N:

Vertices are (x,y,o,i) 0<=x,y<N, 0<=o<2, 0<=i<4 Edge from (x,y,o,i) to (x’,y’,o’,i’) if (x,y)=(x’,y’), o!=o’, OR |x-x’|=1, y=y’, o=o’=0, i=i’, OR |y-y’|=1, x=x’, o=o’=1, i=i’

x,y are the horizontal,vertical co-ords of the K4,4 o=0..1 is the “orientation” (0=horizontally connected, 1=vertically connected) i=0..3 is the index within the “semi-K4,4”=”bigvertex” There is an involution given by {x<->y o<->1-o}

bqpjson.core.bqpjson_to_minizinc(data, out_stream)[source]
bqpjson.core.bqpjson_to_qubist(data, out_stream)[source]
bqpjson.core.bqpjson_to_qubo(data, out_stream)[source]
bqpjson.core.evaluate(data)[source]
bqpjson.core.print_err()

print(value, …, sep=’ ‘, end=’n’, file=sys.stdout)

Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline.

bqpjson.core.spin_to_bool(ising_data)[source]
bqpjson.core.swap_variable_domain(data)[source]
bqpjson.core.validate(data)[source]

bqpjson.cli module

bqpjson.cli.bqp2hfs()[source]
bqpjson.cli.bqp2mzn()[source]
bqpjson.cli.bqp2qh()[source]
bqpjson.cli.bqp2qubo()[source]
bqpjson.cli.load_data(data_steam)[source]
bqpjson.cli.print_err()

print(value, …, sep=’ ‘, end=’n’, file=sys.stdout)

Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline.

bqpjson.cli.run_bqp2hfs(in_stream=<open file '<stdin>', mode 'r'>, out_stream=<open file '<stdout>', mode 'w'>, chimera_degree=None, chimera_cell_size=None, precision=5)[source]
bqpjson.cli.run_bqp2mzn(in_stream=<open file '<stdin>', mode 'r'>, out_stream=<open file '<stdout>', mode 'w'>)[source]
bqpjson.cli.run_bqp2qh(in_stream=<open file '<stdin>', mode 'r'>, out_stream=<open file '<stdout>', mode 'w'>)[source]
bqpjson.cli.run_bqp2qubo(in_stream=<open file '<stdin>', mode 'r'>, out_stream=<open file '<stdout>', mode 'w'>)[source]
bqpjson.cli.run_spin2bool(in_stream=<open file '<stdin>', mode 'r'>, out_stream=<open file '<stdout>', mode 'w'>, pretty_print=False)[source]
bqpjson.cli.spin2bool()[source]

Module contents