Comments (10)
Yes, i think i understood the problem, like in the example above, having two green or red courses in parallel would be ok, but not a mix of red and green
from pyschedule.
Hi,
unfortunately, i dont think that this is possible at the moment, but will be in the future. It is already possible to allow a resource to process things in parallel, like in the following example. The one thing missing is to restrict the parallel processing to one type of task. This requires the adding of capacity constraints, sth that is high on my todo list. I will try to add this in the next days since there seems to be use cases.
from pyschedule import Scenario, solvers, plotters, alt
S = Scenario('parallel_courses',horizon=20)
#size 2 means teacher can do two things in parallel
Teacher = S.Resource('T',size=2)
Courses_English = S.Tasks('CE',num=10,completion_time_cost=1,plot_color='red')
Courses_Math = S.Tasks('CM',num=10,completion_time_cost=1,plot_color='green')
Courses_English += Teacher
Courses_Math += Teacher
if solvers.mip.solve(S,time_limit=600,msg=1):
plotters.matplotlib.plot(S,show_task_labels=True)
else:
print('no solution found')
There is no way to restrict that only Math or English classes are processed in parallel (at the moment), so the result might look like this:
from pyschedule.
restrict the parallel processing to one type of task
I'd need parallel processing of groups of multiple types of tasks. Eg., he can do [Task1, Task2] at the same time and [Task3, Task4] at the same time, but not [Task1, Task3]
from pyschedule.
That's totally it
from pyschedule.
Is there any way I could help ? I saw you created the add_capacities
branch and made a commit, is there any way of testing ?
from pyschedule.
The add_capacities
branch is indeed the branch with the required features. It would be great if you could test this branch. It is now possible to do the following
from pyschedule import Scenario, solvers, plotters, alt
horizon = 20
S = Scenario('parallel_courses',horizon=horizon)
#size 2 means teacher can do two things in parallel
Teacher = S.Resource('T',size=2)
Courses_English = S.Tasks('CE',num=10,completion_time_cost=1,plot_color='red',english=1)
Courses_Math = S.Tasks('CM',num=10,completion_time_cost=1,plot_color='green',math=1)
Courses_English += Teacher
Courses_Math += Teacher
# NEW FEATURES: adding capacities and .max
S += Teacher['english'][0:horizon:1].max + Teacher['math'][0:horizon:1].max <= 1
if solvers.mip.solve(S,time_limit=600,msg=1):
plotters.matplotlib.plot(S,show_task_labels=True)
else:
print('no solution found')
To explain: Teacher['english'][0:horizon:1].max
gives the sequence of capacity slices
Teacher['english'][0:1].max, Teacher['english'][1:2].max, ... , Teacher['english'][horizon-1:horizon].max
and e.g. Teacher['english'][0:1].max
is the maximum english
-param of any task in period 0 (this is the python slice notation of all periods t with 0 <= t < 1). Since all english course have english=1
, this just measures if there is any english course scheduled on resource Teacher in period 0. Therefore, Teacher['english'][0:1].max + Teacher['math'][0:1].max
is 2 if both an english and a math course are scheduled on resource Teacher in period 0, the case we want to avoid by using the constraint <= 1
. The final result is hence correct, there are either two english courses or two math courses scheduled in each period:
from pyschedule.
I think I got how to do it, though I have a question. The way I see this is that it is implemented as a black-list, "can't do that and that at the same time", although I'm looking to make it a whitelist: "cant do two things at the same time, except for these two specific courses". Is there a way I can achieve that ?
I know I could implement a white-list as a black-list (add a constraint for EVERY course except two of them), but that would add a lot of constraints, growing what I guess is exponentially, when the number of classes goes up.
from pyschedule.
Regarding a whitelist: the scheduling rules need to get translated to constraints for a solver, and a solver needs to know what is not allowed, basically the inverse of what is allowed. Thats why only giving a “blacklist“ works.
Did you get your example running anyway?
from pyschedule.
I haven't been able to get it implemented yet. I will do so in the next days.
from pyschedule.
adding capacities and max-capacities are now in the master branch
from pyschedule.
Related Issues (20)
- Assign task length depending on the resource HOT 1
- Annoucement: ProcessScheduler
- TypeError: unsupported operand type(s) for %: 'Task' and 'Resource'
- Py
- Assign Task to any couple of Resources HOT 1
- Python 3.8 : ImportError: cannot import name 'clock' from 'time' HOT 1
- += to Assign Task to Resource Not Working HOT 1
- Optimal solution HOT 3
- Assign any of 2 resources to a task HOT 1
- Restrict resources end time HOT 1
- plans for pyschedule HOT 4
- ImportError: cannot import name 'clock' from 'time' HOT 1
- Flexible Resources
- Different resource cost for different time periods?
- "length cost" by resource / task
- maintenance tasks in industry - BREAK
- Bug when using .diff together with blocking a ressource
- Theres any way to do the Inverse Problem?
- No module named 'pulp.solvers' HOT 2
- pyschedule only works with PuLP 2.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyschedule.