Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChimeraModel() fails due to missing positional argument 'sparse' #381

Open
j-danek opened this issue Jul 13, 2023 · 0 comments
Open

ChimeraModel() fails due to missing positional argument 'sparse' #381

j-danek opened this issue Jul 13, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@j-danek
Copy link

j-danek commented Jul 13, 2023

Describe the bug
Hi all. I was trying to run the code from tutorial on ChimeraModel but the call of the functions fails. I believe there is positional argument sparse missing in the internal call of function make_BinaryQuadraticModel().

To Reproduce
Executing code with
Q={(0, 4): -1, (4, 12): -1}
chimera_model = ChimeraModel(Q, unit_num_L=2) # make
chimera_self.validate_chimera()

Following Error is obtained:


TypeError Traceback (most recent call last)
Cell In[32], line 2
1 Q={(0, 4): -1, (4, 12): -1}
----> 2 chimera_model = ChimeraModel(Q, unit_num_L=2) # make
3 chimera_self.validate_chimera()

File ~/miniforge3/envs/jij/lib/python3.10/site-packages/openjij/model/chimera_model.py:358, in ChimeraModel(linear, quadratic, offset, vartype, unit_num_L, model, gpu)
323 def ChimeraModel(
324 linear: dict = None,
325 quadratic: dict = None,
(...)
330 gpu: bool = False,
331 ):
332 """Generate ChimeraModel object
333
334 This model deal with chimera graph.
(...)
355 >>> chimera_self.validate_chimera()
356 """
--> 358 Model = make_ChimeraModel(linear, quadratic)
360 return Model(linear, quadratic, offset, vartype, unit_num_L, model, gpu)

File ~/miniforge3/envs/jij/lib/python3.10/site-packages/openjij/model/chimera_model.py:31, in make_ChimeraModel(linear, quadratic)
24 def make_ChimeraModel(linear, quadratic):
25 """ChimeraModel factory.
26
27 Returns:
28 generated ChimeraModel class
29 """
---> 31 class ChimeraModel(make_BinaryQuadraticModel(linear, quadratic)):
32 """Binary quadnratic model dealing with chimera graph This model deal
33
34 with chimera graph. ChimeraModel provide methods to verify whether a
(...)
42 >>> chimera_self.validate_chimera()
43 """
45 def init(
46 self,
47 linear=None,
(...)
53 gpu=False,
54 ):

TypeError: make_BinaryQuadraticModel() missing 1 required positional argument: 'sparse'

Expected behavior
Function should return chimeramodel object instead of failing.

Environment (please complete the following information):

  • OS: Ubuntu 22.04
  • Python 3.10.12
  • Version jij-cimod 1.4.55; openjij 0.7.3
@j-danek j-danek added the bug Something isn't working label Jul 13, 2023
@j-danek j-danek changed the title ChimeraModel() fails due to missing positional argument 'sparce' ChimeraModel() fails due to missing positional argument 'sparse' Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants