9.2.5 Sports Scheduling - Video 3 Solving the Problem

In this video, we'll solve our sports scheduling problem in LibreOffice. We can use the solver to solve integer optimization problems using the same process as for linear optimization problems. The only difference is that we need to add extra constraints to define variables as integer or binary. Let's go ahead and solve our small tournament scheduling problem. In LibreOffice, or in the spreadsheet software you're using, go ahead and open the spreadsheet SportsScheduling.ods. At the top of the spreadsheet, I've created a spot for our decision variables. We have a decision variable for each week, weeks one through four, and for each team pair: A and B, A and C, A and D, B and C, B and D, and C and D. This gives us a total of 24 decision variables highlighted in yellow. Below the decision variables, there's a spot for our objective, highlighted in blue. Let's go ahead and construct our objective. Start by typing an equals sign, and then we want it to be equal to 1 times the decision variable for A and B in week 1, plus 2 times the decision variable for A and B in week 2, plus 4 times the decision variable for A and B in week 3, plus 8 times the decision variable for A and B in week 4. Now we want to repeat this for teams C and D. So now we have 1 times the decision variable for C and D in week 1, plus 2 times the decision variable for C and D in week 2, plus 4 times the decision variable for C and D in week 3, plus 8 times the decision variable for C and D in week 4. Go ahead and hit Enter. Our objective has value 0 for now because we haven't filled in our decision variables yet. Now, let's construct our constraints. The first constraint is teams A and B should play twice. So our left hand side should be equal to the sum-- we'll use the sum function here, which just adds up everything inside the parentheses. So type =sum, and then in parentheses, select the four A and B decision variables. The sign should be equals and the right hand side should be 2. Now let's just repeat this for teams C and D. So the left hand side is the sum of the C and D decision variables, the sign is equals, and the right hand side is 2. Now we want to add the constraint that teams A and C should play once, so this left hand side is very similar. It should be the sum of the A and C decision variables, the sign should be equals, and the right hand side here should be 1. Now let's repeat this for teams A and D. The left hand side is the sum of the A and D decision variables, the sign is equals, and the right hand side is 1. We'll repeat it again for teams B and C. So the left hand side is the sum of the B and C decision variables, the sign is equals, and the right hand side is 1. The last of this type of constraint is that teams B and D should play once, so the left hand side is the sum of the B and D decision variables, the sign is equals, and the right hand side is 1. Now we want to add the constraints that each team should only play once in each week. So the first is that team A should play once in week one. So the left hand side should be the sum of all of the decision variables where A plays in week one. So this should be equal to A playing B in week one, plus A playing C in week one, plus A playing D in week one. The sign is equals, and the right hand side is again 1. Now let's repeat this for week two. So the left hand side is equal to A playing B in week two, plus A playing C in week two, plus A playing D in week two. The sign is equals and the right hand side is 1. Now let's repeat this for weeks three and four. So for week three, the left hand side is just equal to the variables of A playing with week three: A and B, A and C, A and D. The sign is equals and the right hand side is 1. For week four, the left hand side is just the A variables in week four, A and B, A and C, and A and D. The sign should be equals and the right hand side is 1. I went ahead and filled in the rest of the constraints for you since they're just repeating the same thing for team B, team C, and team D. Now we're ready to solve our problem. So let's go to the "Tools" menu and select "Solver". In the Solver window, let's first pick our target cell. So with the cursor in the "Target cell" box, go ahead and select the objective cell, or the blue cell. Make sure that "Maximum" is selected, since we're trying to maximize preferences. Then, with the cursor in the "By changing cells" box, go ahead and select all 24 decision variables. Now, let's add in our constraints. Since all of our constraints have an equals sign, we can add them all in together. So in the first Cell Reference box, go ahead and select all of the left hand sides. In the Operator box, select equals. Then, in the Value box, select all of the right hand sides. Since this is an integer optimization problem, there's one more thing we need to do in the constraint area. In the Cell Reference box, go ahead and select all of the decision variables. Then, in the operator pull down menu, select Binary. This will make all of our decision variables binary. We don't need to put anything in the Value column. The last thing we need to do is in Options, make sure that we're using the linear solver, and click OK. Now, go ahead and hit Solve. The solving results says: solving successfully finished, result 24. Go ahead and pick Keep Result, and now let's look at our solution. We can see that teams A and B and teams C and D both play during weeks 3 and 4. This makes sense, since we're trying to maximize preferences, and the preference for teams in the same division is to play later on. In the next video, we'll see the different types of constraints that we can add to an integer optimization model.

Comments

Popular posts from this blog

12. Ion Implantation and Annealing - Analytic Models and Monte Carlo

L17.4 Molecules and energy scales

Lecture 20 Maxwell Theory and its Canonical Quantization