Minimum Cost Flow



   {  Exmpl5.3-3_MinCostFlow.mpl  }

   {  H.P. Williams, Model Building in Mathematical Programming, 3rd ed.  }

   {  Chapter 5.3,  Example 3,  Minimum Cost Flow,  Size: 8x11,  Page 87  }


TITLE
    MinimumCostFlow;

INDEX
    node      := 0..7;

    FromNode  := node;
    ToNode    := node;

    Arcs[FromNode,ToNode] := ((0,2),
                              (1,3),
                              (2,3), (2,4), (2,5),
                              (3,4), (3,7),
                              (4,2), (4,5), (4,6),
                              (7,6));

DATA
    FlowCost[FromNode,ToNode] := [ 0, 2,  5,
                                   1, 3,  4,
                                   2, 3,  2,
                                   2, 4,  6,
                                   2, 5,  5,
                                   3, 4,  1,
                                   3, 7,  2,
                                   4, 2,  4,
                                   4, 5,  6,
                                   4, 6,  3,
                                   7, 6,  4];

    Availability[node] := [0, 10,
                           1, 15];

    Requirement[node] := [5,  9,
                          6, 10,
                          7,  6];

VARIABLES
    Flow[FromNode,ToNode] -> x
        WHERE (FlowCost);

MODEL

    MIN TotalCost = SUM(FromNode, ToNode: FlowCost * Flow);

SUBJECT TO

    FlowBalance[node]:

        SUM(FromNode: Flow[FromNode,ToNode:=node]) + Availability
      =
        SUM(ToNode: Flow[FromNode:=node,ToNode]) + Requirement;

END



Back To Top | Maximal Home Page | List of Models | Previous Page | Next Page