Hi, everyone. Today we are going to talk about Gurobi and Python for integer programming. In today's lecture, we will first introduce you, how to construct the integer program with a Gurobi and Python and example will be provided to help you understand the process of construct the program. Let's get started, in the previous lecture, we know how to solve a linear program with Gurobipy and now we want to ask a question, what if we want to solve an integer program? In fact, Gurobi Optimizer can solve both linear programs and integer programs. Recall that, when we are adding a decision variable, we should input three parameter, and the second parameter is the type of the variable. In fact, there are three attributes for the variables in Gurobi Optimizer, which is GRB.BINARY, GRB.INTEGER, and GRB.CONTINUOUS. If you want to formulate a linear program, just set the variable type to be GRB.CONTINUOUS, if we want to formulate an integer program, just set the variable type to be GRB.INTEGER and if the variable can only contain zero or one, just set its type to GRB.BINARY. That's the basic concept of constructing an integer program. Let's take a look at the facility location problem, consider the facility location problem we have introduced in Operations Research Modeling and Applications. In this problem, we have a company want to build field distribution centers and to serve five markets, and there are five candidate centers we can choose. For each market, it has its own demand and for each distribution center, once was open, has its operating cost and capacity and also, there's shipping cost from each facility to each market. In this problem, our goal is to choose one or multiple locations to build distribution centers and satisfy all demands, then minimize the total cost, so that's our problem. According to the previous videos, we have this map, and we use this map to recall the memory. Now we have five locations to build facility and we should choose one or multiple of it. Here, our goal is to satisfy all demands from all five regions and minimize our total cost, so our formulation is here. Our goal is to minimize the total cost, so the first one is the construction cost of building facility and the second one is the shipping cost from cities to markets. We have some constraints here, the first constraint is the capacity constraints and the second constraint is the demand fulfillment constraint, and finally, we have our cycles right here. So we set a decision variable, x_j, should be binary, and the decision variable, y_ij, should be non-negative. Again, it's better to do data-model decoupling to make our Python program more flexible and extendible. Moreover, in previous lecture, we combined the data part and the model part together, but today, we should emphasize that we seldom store the data in the codes, instead, we defined our data in a data file. In today's lecture, in this example, we will first read the data before the model part. Let's take a look at the data part, first, we should define a data file to store in any format, for example, in this course, we use Excel and you also can store the data in.txt or a.csv file. Here you can see, we have five cities and five markets, for each city, we have its operating cost and capacity, and for each market, we have it's own demand. Finally, the relationship between market and cities is the shipping costs, so we also define the data here. Let's turn back to the slides, you can see that now, we have to read the Excel file. Before we get started, we can quickly run through all the codes to give you a basic concept, so let's take a look at JupyterLab. Now we have our formulation here, and in the first cell, we import the data and store the data into a format that we want, so let's compile it. In the second cell, we build our model and add the decision variables, add the objective function, and add some constraint, then we optimize it, so let's, again, run it. Gurobi should give you some output and if we want to print all the decision variables and your objective value, just run this cell and you will see that the optimal solution is here and objective value is here. Let's turn back to our slides. Let's take a closer look of our codes. In the first cell, we use the package pandas to import data. The pandas provides a function called read Excel to help you directly import the Excel file. Now we read the Excel file and the sheet basic information and after doing this, we have basic info, which is a data frame, and then we transfer that data frame to two lists, which is cities and markets and cities and markets is what we want. We do a similar process to other sheets for example, status information and market information and shipping cost. Then doing this process now the data is all loaded and stored into some lists. After the data part, we can define our model part. Again, we use the constructor model to add a new model and we name it as eg2 which represents that it is Example 2, and also we use less to store the decision variable X, and for each city we add a variable. Now, we use add VAR to add a variable for each city and we set the lower bound of the decision variable at zero, and here, notice that our decision variable type is GRP binary, which means that we are not solving an integer program, and finally, we give names for each variable and we do a similar process for variable Y and Y is a continuous variable so we use GRB continuous here. When you are writing coats, be careful of the length of list, then make sure they are consistent or you will get some index error, and use a pen to add a new item or a list into a list. After we set our decision variables, we can now set our objective function. Again, we use quicksum function with four comments to add up a group of decision variables and here we use GRB minimize to solve a minimization problem. Again, we use addconstrs to add multiple construct together in one comments and we have product capacity constraints and demand fulfillment constraint here. That's the formulation of our computer program, and finally, we can use function optimize to invoke Gropius solver to solve this problem, and here some message should be displayed like this one and the next page. We will see the objective value is down below. If you want to have more detailed information about this decision variables, you can simply run this cell and the result is that you will see a well-constructed display should be in your environment, and we have our decision variables here and decision variables Y, I, J here, and finally we have our objective value here. After this introduction, we can do some modification of this problem. Suppose that the company wants to build Adi's for distribution centers for some recent. Now we can modify our model to add new constraints, and here we have the new constraints co-location limit. Please add this constraint in your computer codes and run it by yourself, and besides to see how the optimal solution changes. The problem is snapped to you. Finally, you will have some remarks for you. Please notice that even with the help of computer solving a large scale integer programs still takes a lot of time. Carefully determine whether it is necessary to set the variable to be integer, and it is a trade-off between precision and efficiency. That's all for today. Thank you.