Given three interval variables say
a = mdl.interval_var(name='a',start=(0,10),end=(0,10),size=5) #have revenue of 10
b = mdl.interval_var(name='b',start=(0,10),end=(0,10),size=5) #have revenue of 5
c = mdl.interval_var(name='c',start=(0,10),end=(0,10),size=5) #have revenue of 4
each represents a process to produce products a
,b
and c
.
Say products a
,b
,c
each generate revenue of 10
,5
,4
respectively.
And we have a deadline of 6
- this means that whatever product with end>=6
will not calculate towards the total revenue.
Say if we have
a (start=1, end=6, size=5, length=5)
b (start=0, end=5, size=5, length=5)
c (start=0, end=5, size=5, length=5)
Then the total revenue is 5+4=10
(since product a have end=6
(which satisfies end>=6
)
Here's an initial code:
from docplex.cp.model import CpoModel
mdl = CpoModel()
a = mdl.interval_var(name='a',start=(0,10),end=(0,10),size=5) #have revenue of 10
b = mdl.interval_var(name='b',start=(0,10),end=(0,10),size=5) #have revenue of 5
c = mdl.interval_var(name='c',start=(0,10),end=(0,10),size=5) #have revenue of 4
mdl.add(mdl.maximize(...))#how to write this line
msol = mdl.solve(FailLimit=100000, TimeLimit=10)
msol.print_solution()
How can we accomplish what I describe here in the line of
mdl.add(mdl.maximize(...))
(or anything that work)?