Maximum Flow


    {  Exmpl15.2-1_MaxFlow.mpl  }

    {  AMPL A Modeling Language for Mathematical Programming, 2nd Edition }

    {  Chapter 15.2,  Minimum Cost Transhipment,  Size: 10x5,  Page 329 }


TITLE
    MaxFlow;

INDEX
    inter  := (a,b,c,d,e,f,g);
    inter2 := inter;
    entr[inter] := (a);
    exit[inter] := (g);
    road[inter,inter2] := (a.b,a.c,b.d,b.e,c.d,c.f,d.e,d.f,e.g,f.g);

DATA
    Cap[inter,inter2] := [a,b, 50,
                          a,c,100,
                          b,d, 40,
                          b,e, 20,
                          c,d, 60,
                          c,f, 20,
                          d,e, 50,
                          d,f, 60,
                          e,g, 70,
                          f,g, 70];

VARIABLE
    Traff[inter,inter2 IN road];

MODEL

    MAX Entering_Traff = SUM(inter IN entr,inter2 IN road: Traff);

SUBJECT TO

    Balance[inter<>first(exit)] WHERE (inter <> first(entr)) -> BAL:
         SUM(inter2: Traff[inter:=inter2,inter2:=inter]) = SUM(inter2: Traff);


BOUNDS
    Traff <= Cap;

END


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