Choosing Mode of Transport


    {  Exmpl10.2-1_TransportMode.mpl  }

    {  Applications of Optimization with Xpress-MP  }

    {  Chapter 10.2,  Choosing the Mode of Transport,  Size: 30x24,  Page 192 }


TITLE
    MinimumCostFlow;

INDEX
    node := 1..15;
    toNode := node;
    fromNode := node;
    node2 := node;
    arc[fromNode,toNode] :=((1,2),(1,3),(1,4),(1,5),
                            (2,7),(2,9),(3,6),(3,7),(4,9),(4,10),(4,11),(5,8),(5,9),(5,10),(5,11),
                            (6,12),(7,12),(8,13),(9,13),(10,14),(11,14),
                            (12,15),(13,15),(14,15));
    transnodes[node] WHERE node<>first(node) AND node<>last(node);

DATA
    Cost[fromNode,toNode] := [2,7,12,2,9,11,
                              3,6,12,3,7,14,
                              4,9,9,4,10,4,4,11,5,
                              5,8,11,5,9,14,5,10,10,5,11,14];
    MinQ := 180;
    MinCap[fromNode,toNode] := [3,6,10,4,10,10,5,8,10,5,10,10];
    MaxCap[fromNode,toNode] := [1,2,50,1,3,40,1,4,35,1,5,65,
                            3,6,50,
                                4,10,50,
                                5,8,50,5,10,50];


VARIABLE
    Flow[fromNode,toNode IN arc];

MODEL

    MIN TransportCosts = SUM(fromNode,toNode IN arc: Cost * Flow);

SUBJECT TO

    StartBalance[node=first(node)] -> SBL:
    SUM(toNode IN arc: Flow[fromNode:=node]) = MinQ;

    TransBalance[node IN transnodes]-> TBL:
         SUM(fromNode IN arc: Flow[fromNode:=fromNode,toNode:=node]) = SUM(toNode IN arc: Flow[fromNode:=node,toNode:=toNode]);

    EndBalance[node=last(node)] -> SBL:
    SUM(fromNode IN arc: Flow[toNode:=node]) = MinQ;

    MinFlowCap[fromNode,toNode IN arc] WHERE (MaxCap > 0) -> MNCP:
        Flow >= MinCap;

    MaxFlowCap[fromNode,toNode IN arc] WHERE (MaxCap > 0) -> MXCP:
        Flow <= MaxCap;

END


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