CaseStudyForm | |
---|---|
Title | The Cosmic Computers Problem |
DateSubmitted | 21 Sep 2012 |
CaseStudyType | TeachingCaseStudy |
OperationsResearchTopics | IntegerProgramming, FacilityLocationProblem |
ApplicationAreas | Industrial Planning |
ProblemDescription |
The Cosmic Computer company wish to set up production in America. They are contemplating building production plants in up to 4 locations. Each location has planning restrictions that effectively determine the monthly production possible in each location. The monthly fixed costs of the different locations have been calculated by the accounting department, and are listed below:
| Location | Monthly Fixed Cost |
| San Francisco | $70,000 |
| Los Angeles | $70,000 |
| Phoenix | $65,000 |
| Denver | $70,000 |
These plants will supply stores at 4 locations. Predicted demand and per-unit transport costs for supplying the 4 production plants to the 4 stores are shown below, along with the quantity each factory can supply:
![]() |
ProblemFormulation |
This problem is a facility location problem where the master-slave constraints control the existence of supply nodes for a transportation problem.
Traditional transportation problem formulations are as follows:
![]()
The decisions are two-fold:
![]() ![]() ![]()
The cost of transporting good through the network is already incorporated into the transportation problem objective, now we have to add the fixed (construction + maintenance) cost
3. Formulate the Constraints
![]() ![]()
The constraints are the same as the transportation problem formulation, except that the supply is determined by the construction (or not) of a plant:
4. Identify the data
![]() ![]()
The data in this problem is the same as that required for a transportation problem, i.e.,
![]() ![]() ![]() ![]() |
ComputationalModel |
Since a transportation problem is embedded within the Cosmic Computers Problem, we will start with the AMPL model file transportation.mod (see The Transportation Problem in AMPL for details):
set SUPPLY_NODES; set DEMAND_NODES; param Supply {SUPPLY_NODES} >= 0, integer; param Demand {DEMAND_NODES} >= 0, integer; param Cost {SUPPLY_NODES, DEMAND_NODES} default 0; param Lower {SUPPLY_NODES, DEMAND_NODES} integer default 0; param Upper {SUPPLY_NODES, DEMAND_NODES} integer default Infinity; var Flow {i in SUPPLY_NODES, j in DEMAND_NODES} >= Lower[i, j], <= Upper[i, j], integer; minimize TotalCost: sum {i in SUPPLY_NODES, j in DEMAND_NODES} Cost[i, j] * Flow[i, j]; subject to UseSupply {i in SUPPLY_NODES}: sum {j in DEMAND_NODES} Flow[i, j] = Supply[i]; subject to MeetDemand {j in DEMAND_NODES}: sum {i in SUPPLY_NODES} Flow[i, j] = Demand[j];We add new decision variables that decide if we build the production plants or not: var Build {SUPPLY_NODES} binary;We define a new parameter for the fixed cost (of construction + maintenance): param FixedCost {SUPPLY_NODES};We incorporate the fixed cost into the objective function and the Build variables into the supply constraints and change the supply constraints since the problem may not be balanced:
minimize TotalCost: sum {i in SUPPLY_NODES, j in DEMAND_NODES} Cost[i, j] * Flow[i, j] + sum {i in SUPPLY_NODES} FixedCost[i] * Build[i]; subject to UseSupply {i in SUPPLY_NODES}: sum {j in DEMAND_NODES} Flow[i, j] <= Supply[i] * Build[i];SolverStudio does not use a .run file, and so we simply add our data, solve and output commands below the model. data SheetData.dat; # Get data from the spreadsheet check : sum {s in SUPPLY_NODES} Supply[s] >= sum {d in DEMAND_NODES} Demand[d]; option solver cplex; # Use this for the student version of AMPL solve; option display_1col 9999999; # a magic line SolverStudio needs display Build > Sheet; display Flow > Sheet;Note that we have included a check command to ensure there is enough supply. The spreadsheet file with this model (but still with some more work to do, as we discuss next) is SolverStudioCosmicComputersAMPL-Incomplete.xlsx. For this problem, our data includes supplies and demands, lower and upper bounds on the flows, and costs. Note that only some routes have lower and upper bounds; a blank entry in one of these tables means AMPL uses the default values (0 and infinity) given in the model. ![]() ![]() ![]() ![]() |
Results |
The output shows that CPLEX has not required any branch-and-bound nodes again. Is this problem also naturally integer? We can check by solving the LP relaxation using option relax_integrality 1 in our AMPL model.
Unfortunately, our problem is not naturally integer. CPLEX performs a lot of "clever tricks" to solve mixed-integer programmes quickly. Let's look at the effect of some of these techniques.
First, we can see what is happening in the branch-and-bound tree by setting the CPLEX options for displaying the branch-and-bound process: mipdisplay 2 gives a moderate amount of information about the process and mipinterval 1 displays this information for every node. For detailed information on setting CPLEX options in AMPL see ILOG's AMPL CPLEX User Guide![]() ![]() Node 0 (the LP relaxation) is solved, then an integer solution is found quickly with 6 cuts. There are many methods at work here, including:
rinsheur -1 and repairtries -1 ) and see what happens (Note To see the true effect of these changes you will have to make changes to your script file, restart AMPL and run your script again. Otherwise, AMPL will use your old solution and the effect of your changes will not be obvious):
![]() Node 0 is solved, but then cuts are generated (indicated by Node 0+ ) and after 2 cuts are added an integer solution is found, shown by * . After 9 cuts are generated another integer solution is found (hence another * ) and this is the optimal solution. Cuts are linear constraints that are added to the LP relaxation to remove fractional solutions. There is a vast amount of literature on cuts for integer programming (try "integer programming cut" on Google), but we will not delve into it here. Let's turn off all the cuts (CPLEX option mipcuts -1 ) and see what happens:
![]() Build['Denver'] even though this variable is integer in the LP relaxation. Instead of using the default CPLEX selection rules for the branching variable, let's branch on the fractional variable that is closest to integer (CPLEX option varselect -1 ):
![]() |
Conclusions |
As with the Brewery Problem, the solution to the Cosmic Computers Problem can be presented in many ways. Figure 1 gives a graphical solution to the Cosmic Computers Problem.
Figure 1 Solution to the Cosmic Computers Problem
![]() |
ExtraForExperts |
Another form of branch and bound implements branches on constraints that should take integer values. For example, in the Cosmic Computers Problem the sum of any subset of Build variables should be integer. Consider the LP relaxation solution:
![]() Build variables is 2.82 (2 dp), but it should be integer. We can remove the fractional part by forcing this sum to be either ![]() ![]() ![]() ![]() Build variables. We can add further constraint branches to continue searching from this node:
![]() |
StudentTasks |
|
I | Attachment![]() |
History | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|---|
![]() |
SolverStudioCosmicComputersAMPL-Incomplete.xlsx | r2 r1 | manage | 20.5 K | 2012-09-24 - 23:21 | AndrewMason | CosmicComputers Spreadsheet model with data items still to be finished |