timnon / pyschedule

pyschedule - resource scheduling in python
Apache License 2.0
295 stars 61 forks source link

schedule_cost doesnt work with T >= 0 constraint #48

Closed timnon closed 6 years ago

timnon commented 6 years ago

In the following example, T1 should not be scheduled, but only T2 in slot 0:

#! /usr/bin/python
import sys
sys.path.append('../src')
import pyschedule

# get input size
S = pyschedule.Scenario('test',horizon=10)

R = S.Resource('R')
T1 = S.Task('T1',length=1,schedule_cost=100)
T2 = S.Task('T2',completion_time_cost=1)
S += T1 >= 0
S += T1 < T2
T1 += R
T2 += R

if pyschedule.solvers.mip.solve(S,msg=1,kind='CBC'):
    pyschedule.plotters.matplotlib.plot(S,color_prec_groups=False)
else:
    print('no solution found')
timnon commented 6 years ago

A workaround is T1 > 0, T1 < 1 at the moment