提交集群模拟计算任务 -------------------- **URL: https://xx.com/task/run** 提交计算任务到集群进行模拟计算。 **请求方法:** Post **参数说明:** +----------------+----------------+--------+------------------+----------+ | 参数描述 | 参数命名 | 类型 | 备注 | 是否为空 | +================+================+========+==================+==========+ | 量子程序 | QProg | String | | 不可空 | +----------------+----------------+--------+------------------+----------+ | 量子程序长度 | QProgLength | uint | | 可空 | +----------------+----------------+--------+------------------+----------+ | 配置信息 | Configuration | json | 不同任务类型的配置信息 | 不可空 | +----------------+----------------+--------+------------------+----------+ | 任务类型 | TaskType | uint | 参考任务类型定义 | 可空 | +----------------+----------------+--------+------------------+----------+ | 虚拟机类型 | QMachineType | String | 0:全振幅, 1:噪声, 2:部分振幅, 3:单振幅, 4:MPS | 不可空 | +----------------+----------------+--------+------------------+----------+ | VIP类型 | Priority/VIP | uint/string | 0为普通任务,数值越大优先级越高 | 可空 | +----------------+----------------+--------+------------------+----------+ | 集群ID | ClusterID | string | 为空时系统自动分配 | 可空 | +----------------+----------------+--------+------------------+----------+ | 回调地址 | callbackAddr | String | | 可空 | +----------------+----------------+--------+------------------+----------+ | 唯一标识码 | Token | string | 用户标识 | 可空 | +----------------+----------------+--------+------------------+----------+ Configuration 信息说明及请求示例 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **(1)全振幅虚拟机 (QMachineType: 0)** **Configuration 参数:** - measure_type (uint): 1-Measure测量; 2-PMeasure; 3-哈密顿量(不可空)。 - shot (uint): 测量次数(不可空)。 - qubits (uint数组): PMeasure 和 哈密顿量 时必须指定。 - hamiltonian (数组/string): 哈密顿量参数(measure_type为3时不可空)。 - hamiltonian_param (double): 哈密顿量系数(数组格式时)。 - pauli_type (str数组): 泡利算符类型(数组格式时)。 - pauli_param (double数组): 算符作用比特(数组格式时)。 **请求示例 (Measure):** .. code-block:: json { "QMachineType":"0", "QProg":"QINIT 4\r\nCREG 4\r\nTOFFOLI q[3],q[0],q[1]\r\nMEASURE q[1],c[1]", "QProgLength":58, "Configuration":{ "measure_type": 1, "shot": 1000 } } **请求示例 (PMeasure):** .. code-block:: json { "QMachineType":"0", "QProg":"QINIT 4\r\nCREG 4\r\nH q[0]\r\nCNOT q[0],q[1]...", "QProgLength":71, "Configuration":{ "measure_type":2, "qubits":[0,1,2,3] } } **请求示例 (哈密顿量):** .. code-block:: json { "QMachineType":"0", "Configuration":{ "qubits":[0,1,2,3,4,5], "hamiltonian":[ {"pauli_type": ["X", "Y"], "pauli_param": [0, 1], "hamiltonian_param": 0.2}, {"pauli_type": ["Y", "X"], "pauli_param": [2, 3], "hamiltonian_param": 0.8} ], "measure_type":3 } } **(2)部分振幅虚拟机 (QMachineType: 2)** **Configuration 参数:** - Amplitude (string数组): 十进制索引数组(不可空)。 **请求示例:** .. code-block:: json { "QMachineType":"2", "Configuration":{ "Amplitude":["0"] } } **(3)单振幅虚拟机 (QMachineType: 3)** **Configuration 参数:** - Amplitude (string): 十进制索引(不可空)。 **请求示例:** .. code-block:: json { "QMachineType":"3", "Configuration":{ "Amplitude":"0" } } **(4)噪声虚拟机 (QMachineType: 1)** **Configuration 参数:** - measure_type (uint): 必须为 1。 - shot (uint): 测量次数。 - noisemodel.single_gate (数组): 单门操作数据 [类型str, 参数double]。 - noisemodel.double_gate (数组): 双门操作数据 [类型str, 参数double]。 - mode (uint): 噪声模型类型。 **请求示例:** .. code-block:: json { "QMachineType":"1", "Configuration":{ "mode":1, "measure_type":1, "noisemodel":{ "single_gate":["DAMPING_KRAUS_OPERATOR",0.100000], "double_gate":["DAMPING_KRAUS_OPERATOR",0.200000] }, "shot":1000 } } **(5)MPS虚拟机 (QMachineType: 4)** **Configuration 参数:** - measure_type (uint): 1-Measure; 2-PMeasure。 - shot (uint): 测量次数。 - qubits (int数组): PMeasure时不可空。 **返回参数说明:** - taskState (string): 任务状态。 - taskId (string): 任务ID。