Construction of Stadium


    {  Exmpl7.1-1_StadiumConstruction.mpl  }

    {  Applications of Optimization with Xpress-MP  }

    {  Chapter 7.1,  Construction of Stadium,  model1 - Size:  24x20, model2 - Size: 37x33  Page 111 } !Model1 has be run before model2

#define model1
!#define model2

TITLE
    StadiumConstruction;

INDEX
    task := 1..19;
    task2 := task;

DATA
    Arc[task,task2] := [2,1,1,
                        3,2,1,
                        4,2,1,
                        5,3,1,
                        6,4,1,
                        6,5,1,
                        7,4,1,
                        8,6,1,
                        9,4,1,
                        9,6,1,
                        10,4,1,
                        11,6,1,
                        12,9,1,
                        13,7,1,
                        14,2,1,
                        15,4,1,
                        15,14,1,
                        16,8,1,
                        16,11,1,
                        16,14,1,
                        17,12,1,
                        18,17,1,
                        19,18,1];

    Dur[task] := (2,16,9,8,10,6,2,2,9,5,3,2,1,7,4,3,9,1,0);
    M := 1000;

#ifdef model2
    Maxw[task] := (0,3,1,2,2,1,1,0,2,1,1,0,0,2,2,1,3,0,0);
    Cost[task] := (M,30,26,12,17,15,8,M,42,21,18,M,M,22,12,6,16,M,0);
    Bonus := 30;
    PriorObj := DATAFILE("StadObj.dat");
#endif

VARIABLE
    Start[task];

#ifdef model1
    Obj EXPORT TO SparseFile("StadObj.dat");
#endif

#ifdef model2
    Save[task] WHERE Cost < 100;
#endif

#ifdef model1
MODEL
   MIN TotalDuration EXPORT TO SparseFile("StadObj.dat") = Start[task:=19];
#endif

#ifdef model2
    MAX Profit = Bonus * Save[task:=19] - SUM(task=1..18: Cost * Save);
#endif

SUBJECT TO

#ifdef model1
    Precedence[task,task2] WHERE (Arc = 1) -> GNSTR:
       Start[task:=task2] + Dur[task:=task2] <= Start[task];

    ObjCalc: Obj = Start[task:=19];
#endif

#ifdef model2
    Precedence[task,task2] WHERE (Arc = 1) -> GNSTR:
       Start[task] - Start[task:=task2] + Save[task:=task2] >= Dur[task:=task2];

    TotalDuration -> TDUR:
       Start[task:=19] + Save[task:=19] = PriorObj;

    WeeksLimit[task=1..18] -> LWK:
       Save <= Maxw;
#endif

END


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