Answered

SAPI: Need clarification on input and output

This is the page I am using to decipher input and output:
https://docs.dwavesys.com/docs/latest/doc_rest_api.html

For the SAPI input:

  1. What is the definition of "number of qubits?" I am guessing that if n = "number of qubits", then qubits 0 through (n-1) will be used. If that is the case, though, does that mean there is no way to select an arbitrary range of qubits? What if I want to shift the range to avoid inactive qubits? 
  2. What is the definition of "number of variables?" Is it the number of biases plus the number of couplings that appear in the input?

For the SAPI output:

Either I am not interpreting the documentation correctly, or there are documents I have missed. I am seeing inconsistent types - some seem to be plain JSON types (such as [10] for a list of a single integer, or [0, 1, 2, 3] for a list of four integers), while others are encoded (such as "oA==" for who knows what until I craft a specialized decoder). Given the "Data Encoding for Solutions" documentation, I was expecting more fields to be specially encoded.

I will paste an input / output pair below to illustrate. (I am using old text format to submit until I have a utility to easily encode values.) In the documentation I am seeing "Replace JSON array of numbers with base-64–encoded little-endian..." for output types. I don't think I know how to interpret this. 

Job Input

[{
"solver": "DW_2000Q_2",
"data": "4 4\n0 0 -1\n1 1 1\n2 2 -1\n3 3 1",
"type": "ising",
"params": {
"num_reads": 10
}
}]

Job Output

{ "status": "COMPLETED",
"earliest_estimated_completion": "2018-07-19T20:59:32.517428Z",
"solved_on": "2018-07-19T20:59:32.741214Z",
"solver": "DW_2000Q_2",
"submitted_on": "2018-07-19T20:59:32.509616Z",
"answer": { "num_variables": 2048,
"energies": [-4.0],
"num_occurrences": [10],
"active_variables": [0, 1, 2, 3],
"solutions": "oA==",
"timing": { "total_real_time": 10630,
"anneal_time_per_run": 20,
"post_processing_overhead_time": 168,
"qpu_sampling_time": 1640,
"readout_time_per_run": 123,
"qpu_delay_time_per_sample": 21,
"qpu_anneal_time_per_sample": 20,
"total_post_processing_time": 168,
"qpu_programming_time": 7590,
"run_time_chip": 1640,
"qpu_access_time": 10630,
"qpu_readout_time_per_sample": 123
}
},
"latest_estimated_completion": "2018-07-19T20:59:32.517428Z",
"type": "ising",
"id": "3a6189c9-ab0c-4f77-bbdb-135bf6b3ca74"
}

 

0

Comments

2 comments
  • Hi Thomas

    The number of qubits is the maximum index used in the problem. This cannot be greater than the solver's num_qubits property. Using the solver's num_qubits value should be fine. 

    Yes, the number of variables is the number of biases plus the number of couplings that appears in the input.

    We agree that there appears to be some key information missing from this document regarding data encoding - we are looking into this.

    In the meantime, here is some information that might help:

    num_variables
       Total number of variables (= solver's num_qubits)

    active_variables 
       List of indices of qubits that were active

    energies 
      List of energies of each returned solution

    num_occurrences
      List of number of time each solution was seen

    solutions
       Base64 encoded bits, each solution is one bit for each active variable (in order of active_variables), with no padding between solutions, little-endian.

    Note also that:

    • num_occurrences is only present for problems with answer_mode=histogram.
    • energies, solutions and num_occurrences list their data for the solutions in the same order.
    • The encoding of the answer depends on the encoding used in the problem. 
    1
    Comment actions Permalink
  • This helps - thanks!

    1
    Comment actions Permalink

Post is closed for comments.

Didn't find what you were looking for?

New post