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

TIGHTPLUS constraints: how to set a difference between 2 tasks without knowing their order #64

Open
fredericgirod opened this issue Sep 21, 2018 · 2 comments

Comments

@fredericgirod
Copy link

Hi,
I have to set up some TIGHTPLUS constraints in order to separate my tasks by a few time units: but how to set a difference between 2 tasks without knowing their order ?
For example, I'm using such TIGHTPLUS ... S += Games[11] + 1 <= Games[10],
but I don't want to set an order. I want tasks Games[11] and Games[10] to be separated by 1 time unit whatever the order they will be appearing ...

@timnon
Copy link
Owner

timnon commented Sep 22, 2018

In the following script, breaks are schedule between tasks, maybe sth similar can be applied to your case. Note the is_group, since will speed up the computation, since the breaks are probably all similar, so we can treat them as an interchangeable group.

#! /usr/bin/env python
import sys
sys.path.append('../src')
from pyschedule import Scenario, solvers, plotters

horizon = 20
S = Scenario('Scenario',horizon=horizon)
tasks = S.Tasks('T',num=int(horizon/2),is_group=True,completion_time_cost=1,state=1)
breaks = S.Tasks('B',num=int(horizon/2),is_group=True,completion_time_cost=1,state=-1)

R = S.Resource('R')
tasks += R
breaks += R

# ensure that state is always between 0 and 1
for t in range(horizon):
	S += R['state'][:t] <= 1
	S += R['state'][:t] >= 0

solvers.mip.solve(S, msg=1)
plotters.matplotlib.plot(S, fig_size=(10, 5))
#plotters.matplotlib.plot(S, fig_size=(10, 5), hide_tasks=breaks)

@Eduardoofc
Copy link

hey @fredericgirod , I have the same problem you had 2 years ago!!

I wondering if you can share with me your solution?

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

3 participants