tpaviot / ProcessScheduler

A Python package for automatic and optimized resource scheduling
https://processscheduler.github.io/
GNU General Public License v3.0
59 stars 17 forks source link

Error when solving #78

Closed dreinon closed 3 years ago

dreinon commented 3 years ago

Hi! In my implementation, my problem is being solved twice, the second one adding more objectives. The first time it's being solved well, but the second time I'm getting the following error:

    solver = ps.SchedulingSolver(
  File "/home/dani/dribo/trial/ProcessScheduler/processscheduler/solver.py", line 145, in __init__
    self.create_objective()
  File "/home/dani/dribo/trial/ProcessScheduler/processscheduler/solver.py", line 182, in create_objective
    print(weighted_objectives)
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3.py", line 324, in __repr__
    return obj_to_string(self)
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 1238, in obj_to_string
    _PP(out, _Formatter(a))
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 1134, in __call__
    return self.main(a)
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 1108, in main
    return self.pp_expr(a, 0, [])
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 1005, in pp_expr
    return self.pp_app(a, d, xs)
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 970, in pp_app
    return self.pp_infix(a, d, xs)
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 792, in pp_infix
    return group(seq(self.infix_args(a, d, xs), op, False))
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 785, in infix_args
    self.infix_args_core(a, d, xs, r)
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 757, in infix_args_core
    child_pp = self.pp_expr(child, d+1, xs)
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 1005, in pp_expr
    return self.pp_app(a, d, xs)
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 937, in pp_app
    return self.pp_const(a)
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 584, in pp_const
    return self.pp_name(a)
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 540, in pp_name
    return to_format(_op_name(a))
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3printer.py", line 224, in _op_name
    return f.name()
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3.py", line 686, in name
    return _symbol2py(self.ctx, Z3_get_decl_name(self.ctx_ref(), self.ast))
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3.py", line 121, in _symbol2py
    return Z3_get_symbol_string(ctx.ref(), s)
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3core.py", line 2539, in Z3_get_symbol_string
    return _to_pystr(r)
  File "/home/dani/.local/lib/python3.9/site-packages/z3/z3core.py", line 86, in _to_pystr
    if enc != None: return s.decode(enc)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc9 in position 40: invalid continuation byte

The difference between the 1st iteration and the 2nd is that in the 2nd, I'm adding some single flowtime resource optimizers (it might be the name of one of these resources that is causing the error?).

Thank you!

tpaviot commented 3 years ago

A unicode error, certainly an issue with a resource name

tpaviot commented 3 years ago

I removed the related line, can you tell me if this is better?

dreinon commented 3 years ago

Yes, without this line it works fine.

Could you please upload a version 0.7.1 with the hot fix?

I'm working in a docker container in the cloud and can't do modifications of the library locally myself.

tpaviot commented 3 years ago

yes, sure, let me send you a notification as soon as it is available

dreinon commented 3 years ago

Awesome! Thanks Thomas!

tpaviot commented 3 years ago

Version 0.7.1 released and published on pypi.