Let's talk about constraints. In that project, we actually did a lot for the company. We formulated a lot of constraints. But here in this lecture we only want to talk about four sets of constraints to show you, to give you a taste about the formulation. First, for each CSR, in each day, that person should only be assigned exactly one shift. That means if I ask you to do this, I cannot ask you to do that. We should have some constraints to calculate the total shortage, which means to link X_ijk and the Y_jt. For each day or each period, we should be able to know what's the number of shortage according to the schedule we assigned to our CSRs. There should be some constraints calculating the maximum number of extra on-duty CSRs. That means we should be able to calculate the measurements for fairness in dimension one, to link X_ijk to W_1. Also, we should be able to calculate the maximum number of night shifts. That means to link X_ijk to W_2. If we define these indicators, we need to be able to calculate them according to the schedule. That's the key for defining our objective functions. Maybe you want to stop the video for a while and think about how you may formulate these constraints. Maybe you will do the same thing as I'm going to do. Maybe you may do even better. But anyway, I'm going to show you how these may be formulated, at least in my way. We will formulate these constraints and define parameters when it is necessary. For the first constraint, for each CSR and each day, which means for each I and each J, for CSR i and day j, among all the shifts, only one of them and exactly one of them should be assigned to that particular CSR. I hope this is clear enough. For each CSR in each day, he or she should take exactly one shift. If this person is having a day off, he should take shift zero. If we want to calculate the total shortage, what should we do? Don't forget that previously we say we want to minimize the sum of Y_jt, and why is that? This is somehow because for each period in each day, what we are actually doing is that we have these a minus b and 0 with maximization previously explained. A is the demand, B is the supply. Pretty much when we use Y_jt to replace that, we are actually playing the trick for linearizing a maximum function. When we say Y_jt equals to this one, we know we are going to say Y_jt is greater than or equal to the first term, and Y_jt should be greater than or equal to the second term. The only thing remains is that we need to being able to express the difference, to express demand and the supply, then we're done. That is something here. Let's take a look. Pretty much, we first need to have demand and the demand is known. D_jt is the number of CSRs needed in period t of day j. This is some given information. Some people already told us that for the first hour in Monday we need 48 percent and so on. This is a known parameter. Then how about this? This is the amount of supply we have for that particular period. We need a parameter called A_kt. A_kt is one if shift k covers period t or zero otherwise. What does that mean? Suppose we have a shift, shift one, and we have some time periods that say period 1,2,3. Suppose shift one covers period 1, period 2, and then an hour of lunch break and so on. We will say A_11 is A_12, which are 1 and A_13 would be 0. If shift two says, "Please come to the work at 10:00 AM," and so on, then A_21 would be 0, but A_22, A_23 would be 1. This is used to indicate whether a shift covers period t. Then let's take a look at how it works. For each particular day, for each period, we take a look at all the shifts. If a shift does not cover that particular period, then no matter how many workers you have working in that shift, they contribute nothing to your workforce. Only if that particular shift covers that particular period, then you count the number of workers working in that shift. Then all of them contributes, each of them contributes one labor to that particular period. Then the sum of them would exactly be the number of workers you have being on duty in that particular period. That's how we calculate the supply. Then collecting all of this, we have a way to determine the supply. We have a way to determine Y_jt, then we're done with formulating total shortage. Then if we are talking about the maximum number of extra on-duty CSRs, as you see this maximum. When we are minimizing some kind of W_1, we know W_1 should be greater than or equal to all those extra on-duty CSRs for each day, for each period. If W_1 is greater than or equal to all of them, W_1 would be the maximum of them. In that case, let's take a look at this. Pretty much all we need to do is to calculate extra on-duty CSRs for each period in each day. Then is nothing but reversing supply and demand. When it is demand minus supply, is shortage. When it is supply minus demand, is extra. In this case, the extra is either positive or zero, just like the way we calculate shortage. There's nothing difficult. Finally, if we want to calculate the maximum number of night shifts, then among all workers for each CSR, we count the number of days where this particular person is taking a night shift. Here we need another notation. K^N is defined as the set of night shifts. You have several shifts, some of them are night shifts, some of them are not. K^N is the set of night shifts. You are going to use this expression to count the number of days for this CSR to take a night shift. That may be four the other person, there may be two and the other person could happen to be five and so on and so on. W_2 is the maximum of them, and that's your indicator for your second measurement for fairness. Once we have all of this, if we go back to take a look, we do see that for all these indicators, they may be calculated according to your schedule. Then we feel satisfied because then we are really able to calculate to indicate how good a schedule is. Then the model will take the remaining things. Some solvers will help us to solve these problems. The last thing I want to say about this kind of formulation is that if you are a beginner, in many cases, a beginner would like to write a formulation like this. Pretty much they write everything but they're going to ignore the boundaries and they would write something like this. Some people would even ignore those for-all statements. First, if you don't have those for-all statements, your formulation is definitely wrong and second, even if you have your for-all statements, you need to indicate the boundaries, the range of your indexes. Your K, you should tell everybody that whether your k is in the set capital K or in a subset of capital K, or in the union of capital K with some other things. You must do that so that your formulation is precise. Here we have one good example. If you don't define these carefully, then your formulation would be wrong. If you just say W_2 is greater than or equal to j, k x_ijk, for all i. This formulation is wrong, because you need to somehow indicate the range for k in the correct way. If you don't do that, then this is not a precise formulation. This is not a correct formulation. If you are a beginner, I ask you to really write down everything in details, especially the boundaries of indexes, either inside a summation or in a for-all statement because that's something that is typically ignored by beginners, but that's actually something that we should never ignore. Only with that, we are able to formulate a correct, complete, precise formulation.