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

AttributeError: 'float' object has no attribute 'lb'_ #58

Open
lgrandi opened this issue Jan 21, 2021 · 0 comments
Open

AttributeError: 'float' object has no attribute 'lb'_ #58

lgrandi opened this issue Jan 21, 2021 · 0 comments

Comments

@lgrandi
Copy link

lgrandi commented Jan 21, 2021

Hi All,

I am using Numberjack with python3.9.1.

I have a code that with some models works and with some other it crashes. For example if the model looks like the output below WITHOUT the lines marked with "" then it works. If I modify it adding the lines marked with "" then it has a deep crash that I report below. Any suggestion about the possible source of the problem and how to fix it? I am working on a code developed by a colleague and I was told it worked with python2.
Thanks
L

model assign:
  x0 in {0..2}
  **x0 in {0..2}**
  x1 in {0..2}
  x0 in {0..3}
  x1 in {0..3}
  **x in {0..5}**

subject to:
 **((Element(0, 1150.0, 1200.0, x0) <= Element(0, 1100.0, 1400.0, x0)) or (Element(0, 1150.0, 1450.0, x0) <= Element(0, 1100.0, 1150.0, x0)))**
  AllDiff(x0, x1)
  (card of 0 in [x0 x1] == 0)
  AllDiff(x0, x1)
  **(x0 != 0)**
  (card of 0 in [x0 x1] == 0)

Traceback (most recent call last):
File "DataParser_2021.py", line 325, in
(facultyschedules,studentsforfaculty,solver)=MySolver.solve_schedule(FacultyPrefs,StudentPrefs,FacultyTimeSlots,mandatorymeetings,ProfAllowsOverlap2,ProfAllowsOverlap3,ProfAllowsOverlap4,ProfAllowsOverlap8)
File "/media/sf_SharedOSX/2021/CurrentOptimizer2.py", line 134, in solve_schedule
solver = model.load('MiniSat') #param['solver'])
File "/usr/local/lib/python3.8/dist-packages/Numberjack/init.py", line 911, in load
solver = lib.Solver(self, X, encoding=encoding)
File "/usr/local/lib/python3.8/dist-packages/Numberjack/solvers/MiniSat.py", line 213, in init
Numberjack.NBJ_STD_Solver.init(self, "MiniSat", "SatWrapper", model, X, FD, clause_limit, encoding)
File "/usr/local/lib/python3.8/dist-packages/Numberjack/init.py", line 3175, in init
self.solver.add(self.load_expr(expr))
File "/usr/local/lib/python3.8/dist-packages/Numberjack/init.py", line 3286, in load_expr
arguments = [self.load_expr(child) for child in expr.get_children()]
File "/usr/local/lib/python3.8/dist-packages/Numberjack/init.py", line 3286, in
arguments = [self.load_expr(child) for child in expr.get_children()]
File "/usr/local/lib/python3.8/dist-packages/Numberjack/init.py", line 3286, in load_expr
arguments = [self.load_expr(child) for child in expr.get_children()]
File "/usr/local/lib/python3.8/dist-packages/Numberjack/init.py", line 3286, in
arguments = [self.load_expr(child) for child in expr.get_children()]
File "/usr/local/lib/python3.8/dist-packages/Numberjack/init.py", line 3329, in load_expr
return self.decompose_expression(expr)
File "/usr/local/lib/python3.8/dist-packages/Numberjack/init.py", line 3333, in decompose_expression
expr_list = expr.decompose()
File "/usr/local/lib/python3.8/dist-packages/Numberjack/Decomp.py", line 446, in decompose_Element
u = u | set([e] if type(e) is int else list(range(e.lb, e.ub + 1)))
AttributeError: 'float' object has no attribute 'lb'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant