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

+= to Assign Task to Resource Not Working #86

Open
disaalda opened this issue May 30, 2019 · 1 comment
Open

+= to Assign Task to Resource Not Working #86

disaalda opened this issue May 30, 2019 · 1 comment

Comments

@disaalda
Copy link

When I run this block on bike-shop.ipynb:

green_paint += Alice|Bob
green_post += Alice|Bob

red_paint += Alice|Bob
red_post += Alice|Bob

I get this error:

Exception Traceback (most recent call last)
in
----> 1 green_paint += Alice|Bob
2 green_post += Alice|Bob
3
4 red_paint += Alice|Bob
5 red_post += Alice|Bob

~/anaconda2/lib/python3.6/site-packages/pyschedule/pyschedule.py in add(self, other)
522
523 def add(self,other) :
--> 524 return _TaskAffine(self) + other
525
526 def sub(self,other) :

~/anaconda2/lib/python3.6/site-packages/pyschedule/pyschedule.py in add(self, other)
111 elif isinstance(other,self.element_class) or _isnumeric(other):
112 return self + type(self)(other)
--> 113 raise Exception('ERROR: you cannot add %s to %s' % (str(other),str(self)))
114
115 def sub(self,other) :
Exception: ERROR: you cannot add Alice|Bob to green_paint

Other examples seem to use += to add resource to task, too. Any idea how to fix this?

@snow-abstraction
Copy link

I just ran the bike show notebook using Python 3.7 and pyschedule 0.2.34 without any problems. I don't think me having Python 3.7 made any difference.

Which version of pyschedule are you using?

Just to eliminate any issues with corrupt state in the jupyter-notebook, could you create a new notebook a run the following in one cell

from pyschedule import Scenario, solvers, plotters
S = Scenario('bike_paint_shop', horizon=10)
Alice = S.Resource('Alice')
Bob = S.Resource('Bob')
green_paint, red_paint = S.Task('green_paint', length=2), S.Task('red_paint', length=2)
green_post, red_post = S.Task('green_post'), S.Task('red_post')
S += green_paint < green_post, red_paint + 1 <= red_post
green_paint += Alice|Bob
green_post += Alice|Bob
red_paint += Alice|Bob
red_post += Alice|Bob

and post the output?

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

2 participants