Originally posted by: KeerthivasanC
A brief overview of my problem:
I have 8 projects [A,B,C,D,E,F,G,H] which need to completed in 4 time periods [T1,T2,T3,T4], where I have the data for the no. teams required for each project and the max. number of teams allowed to work in each time period. The cumulative sum of max. no. of teams allowed is greater than the cumulative sum of total no. teams required for the 8 projects.
Here is what I have done:
TP1 = m.integer_var_dict(name = "TP1",keys=project). Basically, I have TP1_A,TP_B,...,TP_H as integer variables. I have done the same for TP2, TP3 and TP4. The constraints added to the model are the teams needed for each project and the max. teams allowed in each time period. Now, this is basically an assignment problem subject to resource constraints.
Here is what I need to accomplish:
Suppose, the model assigns the following values for project A:
TP1_A = 0
TP2_A = 4
TP3_A = 0
TP4_A = 1, assuming the teams needed for A is 5.
I need to add an addition condition where I say:
If the first assignment for project A by the model is in TP2, then TP3 can't be 0 and so on and so forth until I meet my total teams needed for a project condition. Essentially, when I have assigned a team or teams to a project in one time period, it can't go to 0 in the next time period and back again to some positive team allocation value in the third time period. The project should have non-zero teams assigned to it from start to completion.
Can someone help me frame this as a constraint in docplex.cp using Python? I would be very grateful as I am unable to grasp how to do this. Usage of if_then(), perhaps? Thanks in advance.
#CPOptimizer#DecisionOptimization