Skip to content

QAOA run-problem-generation Error #323

@hmy98213

Description

@hmy98213

I am running the "run-problem-generation.py" in

# Copyright 2020 Google
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from recirq.qaoa.experiments.problem_generation_tasks import SKProblemGenerationTask, \
HardwareGridProblemGenerationTask, ThreeRegularProblemGenerationTask, \
generate_3_regular_problem, generate_sk_problem, generate_hardware_grid_problem
def main():
dataset_id = '2020-03-19'
hardware_grid_problem_tasks = [
HardwareGridProblemGenerationTask(
dataset_id=dataset_id,
device_name='Sycamore23',
instance_i=i,
n_qubits=n
)
for i in range(100)
for n in range(2, 23 + 1)
]
sk_problem_tasks = [
SKProblemGenerationTask(
dataset_id=dataset_id,
instance_i=i,
n_qubits=n
)
for i in range(100)
for n in range(3, 17 + 1)
]
three_regular_problem_tasks = [
ThreeRegularProblemGenerationTask(
dataset_id=dataset_id,
instance_i=i,
n_qubits=n
)
for i in range(100)
for n in range(3, 23 + 1) if 3 * n % 2 == 0
]
for task in hardware_grid_problem_tasks:
generate_hardware_grid_problem(task)
for task in sk_problem_tasks:
generate_sk_problem(task)
for task in three_regular_problem_tasks:
generate_3_regular_problem(task)
if __name__ == '__main__':
main()

and got the following error:

Traceback (most recent call last):
  File "c:\Users\hmy98\iCloudDrive\Desktop\Test_Generator\qaoa_tutorial.py", line 60, in <module>
    main()
  File "c:\Users\hmy98\iCloudDrive\Desktop\Test_Generator\qaoa_tutorial.py", line 52, in main
    generate_hardware_grid_problem(task)
  File "C:\Users\hmy98\iCloudDrive\Desktop\Test_Generator\venv\lib\site-packages\recirq\qaoa\experiments\problem_generation_tasks.py", line 174, in generate_hardware_grid_problem        
    problem = _get_all_hardware_grid_problems(
  File "C:\Users\hmy98\iCloudDrive\Desktop\Test_Generator\venv\lib\site-packages\recirq\qaoa\experiments\problem_generation_tasks.py", line 156, in _get_all_hardware_grid_problems       
    device_graph = _get_device_graph(device_name=device_name)
  File "C:\Users\hmy98\iCloudDrive\Desktop\Test_Generator\venv\lib\site-packages\recirq\qaoa\experiments\problem_generation_tasks.py", line 121, in _get_device_graph
    device_graph = ccr.gridqubits_to_graph_device(device.qubits)
AttributeError: 'GridDevice' object has no attribute 'qubits'

Metadata

Metadata

Assignees

Labels

area/dependenciesConcerns ReCirq dependenciesarea/healthIssues and PRs related to code, repository, or project healtharea/qaoaConcerns the QAOA modulepriority/p1High priority

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions