Difference: CosmicComputersProblem (22 vs. 23)

Revision 232008-05-13 - MichaelOSullivan

Line: 1 to 1
META TOPICPARENT name="SubmitCaseStudy"
<-- Ready to Review -->
Line: 90 to 90
 |*FORM FIELD ProblemFormulation*|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:

 \[ \begin{array}{r@{\,}r@{\,}l} \min &amp; \displaystyle \sum_{i \in {\cal S}} \sum_{j \in {\cal D}} c_{ij} &amp; x_{ij} \\ \text{subject to} &amp; \displaystyle \sum_{j \in {\cal D}} &amp; x_{ij} = s_i, i \in {\cal S} \\ &amp; \displaystyle \sum_{i \in {\cal S}} &amp; x_{ij} = d_j, j \in {\cal D} \end{array} \]

Let's go through the mathematical programming formulation steps and consider what changes we might have to make.

1. Identify the Decision Variables

The decisions are two-fold:
  1. Where to build the plants?
  2. Where to ship the computers?

The flow variables $x_{ij}, i \in {\cal S}, j \in {\cal D}$ determine where to ship the computers, so we need to add binary variables that govern which of the supply nodes exist, i.e., $z_i \in \{0, 1\}, i \in {\cal S}$ that are 1 if $i$ exists and 0 otherwise.

2. Formulate the Objective Function

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 $C_i, i \in {\cal S}$:
\[ \min \sum_{i \in {\cal S}} \sum_{j \in {\cal D}} c_{ij} x_{ij} + \sum_{i \in {\cal S}} C_i z_i \]

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:
\[ \sum_{j \in {\cal D}} x_{ij} = s_i z_i, i \in {\cal S} \]
and we need to (at least) meet demand, but the formulation no longer needs to be balanced (otherwise we would always build all our construction plants):
\[ \sum_{i \in {\cal S}} x_{ij} \geq d_j, j \in {\cal D} \]

4. Identify the data

The data in this problem is the same as that required for a transportation problem, i.e., ${\cal S}$, ${\cal D}$, $s_i, i \in {\cal S}$, etc except that the fixed costs $C_i, i \in {\cal S}$ also needs to be specified.
| |*FORM FIELD ComputationalModel*|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):

param Supply {SUPPLY_NODES} >= 0, integer;
param Demand {DEMAND_NODES} >= 0, integer;

param Cost {SUPPLY_NODES, DEMAND_NODES} default 0;

  integer default 0;
  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:

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];

Finally, we change the MeetDemand constraints:

subject to MeetDemand {j in DEMAND_NODES}:
  sum {i in SUPPLY_NODES} Flow[i, j] >= Demand[j];

The final model file is given in cosmic.mod.

The data file cosmic.dat is straight forward.

We can also adapt transportation.run by removing all the balancing AMPL commands, e.g., param difference;. We add a different check to cosmic.run that ensures there is enough supply to satisfy the demand (otherwise the problem is infeasible):

check : sum {s in SUPPLY_NODES} Supply[s] >= sum {d in DEMAND_NODES} Demand[d];
| |*FORM FIELD Results*|Results|Using cosmic.run we can solve the Cosmic Computers Problem:


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.


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.


This shows that 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:

  1. A relaxation induced neighbourhood search (RINS) heuristic;
  2. A repair heuristic that tries to from integer solutions from fractional ones;
  3. Application of cuts to the LP relaxation;
  4. Careful selection of variables to branch on.

The RINS heuristic looks for a feasible integer solution starting from the LP relaxation solution and the repair heuristic looks for a feasible integer solution from the initial values (here all zero). Let's turn the heuristics off (CPLEX options 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):


Now the LP relaxation 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:


Here the optimal integer solution is found at the second node and then the rest of the tree (6 branch-and-bound nodes in all) is used to ensure this is the optimum. CPLEX is very careful with its selection of a branching variable. Here, it branches on 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):


Notice that the branch-and-bound tree is larger (8 nodes as opposed to 6), so this selection strategy did not work as well as the CPLEX default.

While solving the Cosmic Computers Problem we have explored many of the "behind the scenes" work that CPLEX does for you. See Integer Programming with AMPL for more examples. In the Extra for Experts we will see another technique called constraint branching.|

|*FORM FIELD Conclusions*|Conclusions|As with the Brewery Problem, the solution to the Cosmic Computers Problem can be presented in many ways. [[#fig1][Figure 1] gives a graphical solution to the Cosmic Computers Problem.

Figure 1 Solution to the Cosmic Computers Problem



|*FORM FIELD Conclusions*|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



 |*FORM FIELD ExtraForExperts*|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:


The sum of the three non-zero 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 $\geq$ 3 or $\leq$ 2. First, let's branch up:


Our solution is integer so we can fathom this node. Now let's ???LINK??? drop the Up constraint and branch down:


This solution still has fractional Build variables. We can further constraint branchs to continue searching from this node:

cosmic_bbtree.jpg| |*FORM FIELD StudentTasks*|StudentTasks|

  1. Solve the Cosmic Computers Problem. Write a management summary of your solution.

    What to hand in Your management summary.

  2. Experts Only Complete the branch-and-bound process using constraint branches on fractional sums of the Build variables. Draw your branch-and-bound tree as shown above (in the Extra for Experts section). Be sure to indicate what branches you used. Briefly (1 paragraph) compare your experience with constraint branching to the variable branching used in CPLEX.

    What to hand in Hand in your drawing of your branch-and-bound tree along with your conclusions about the effectiveness of constraint branching compared with variable branching.

META FILEATTACHMENT attachment="cosmic_badbranch.jpg" attr="h" comment="" date="1208929978" name="cosmic_badbranch.jpg" path="cosmic_badbranch.jpg" size="127425" stream="cosmic_badbranch.jpg" tmpFilename="" user="MichaelOSullivan" version="2"
Line: 115 to 115
META FILEATTACHMENT attachment="latex5ec19384f577119fa936dcc6fb49d9e3.png" attr="h" comment="" date="1208861453" name="latex5ec19384f577119fa936dcc6fb49d9e3.png" stream="GLOB(0xa4b49fc)" tmpFilename="latex5ec19384f577119fa936dcc6fb49d9e3.png" user="BaseUserMapping_333" version="1"
META FILEATTACHMENT attachment="latex4e85da8e3e178be2bf661a6ca694df55.png" attr="h" comment="" date="1208919192" name="latex4e85da8e3e178be2bf661a6ca694df55.png" stream="GLOB(0x8f6dd88)" tmpFilename="latex4e85da8e3e178be2bf661a6ca694df55.png" user="MichaelOSullivan" version="1"
META FILEATTACHMENT attachment="latexe1bee7b21d544faefa6098fc522d595e.png" attr="h" comment="" date="1208927379" name="latexe1bee7b21d544faefa6098fc522d595e.png" stream="GLOB(0xa9028d4)" tmpFilename="latexe1bee7b21d544faefa6098fc522d595e.png" user="MichaelOSullivan" version="1"
META FILEATTACHMENT attachment="cosmic.mod" attr="" comment="" date="1208927396" name="cosmic.mod" path="cosmic.mod" size="1506" stream="cosmic.mod" tmpFilename="" user="MichaelOSullivan" version="1"
META FILEATTACHMENT attachment="cosmic.mod" attr="" comment="" date="1210715039" name="cosmic.mod" path="cosmic.mod" size="1496" stream="cosmic.mod" tmpFilename="" user="MichaelOSullivan" version="2"
META FILEATTACHMENT attachment="cosmic.dat" attr="" comment="" date="1208927408" name="cosmic.dat" path="cosmic.dat" size="818" stream="cosmic.dat" tmpFilename="" user="MichaelOSullivan" version="1"
META FILEATTACHMENT attachment="cosmic.run" attr="" comment="" date="1208927465" name="cosmic.run" path="cosmic.run" size="586" stream="cosmic.run" tmpFilename="" user="MichaelOSullivan" version="1"
META FILEATTACHMENT attachment="cosmic_graphical.jpg" attr="h" comment="" date="1208931299" name="cosmic_graphical.jpg" path="cosmic_graphical.jpg" size="80208" stream="cosmic_graphical.jpg" tmpFilename="" user="MichaelOSullivan" version="1"
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback