1

for my master thesis I have to develope a lot sizing model for a radiology. I implement it with opl and I'm totally new to opl or programming in general. So after a lot of programming time and trying to get the model run, it runs. But now it tells me the solution of 0 or negativ lotsizes. I compared my model with other models I found in the internet and I can't find anything wrong. The only thing what comes in my mind is the dvar boolean, which I need for a setup between to examination types on a MRT machine. Do I have to tell the programm that dvar must be equal to 1, when there is a junp fom one examination typ to another? If yes, how can I do that and if not would anybody tell me what's wrong in the model? And I even don't know if I have to work with CP or MIP...

The model is a dynamic model with 9 examinations [i] to bundle in lot sizes, 3 MRT machines [m] and 10 periods [t].

//Sets
{string} ExaminationTypes = ...;
{string} Machines = ...;
{int} Periods = {1,2,3,4,5,6,7,8,9,10};
{int} PreviousPeriodIncluded = {0,1,2,3,4,5,6,7,8,9,10};

//Parameters
float SetupCosts[Machines][Periods]=...;
float ProductionCosts[ExaminationTypes][Machines][Periods]=...;
float OpportunityCosts[Periods]=...;      //when there are left overs of the prior period          
float ScanDuration[ExaminationTypes]=...;
float Capacity[Machines][Periods]= ...;
int Demand[ExaminationTypes][Periods]= ...;

// constants
float Alpha = 0.75;
float SetupBeginTime = 9.50;
float SetupEndTime = 4.50;
int BigNumber = 999999;
float SetUpDuration = 2.00;
float CleaningDuration = 6.00;

At the beginning there was another problem in outlining the Backlogs in period 0. Thats why I built a new set of periods. But now the solution for the amount of backlogs begins already with period 0 and that should be avoided.

//desicion variables
dvar boolean IsSetupNecessary[ExaminationTypes][Machines][Periods];
dvar boolean IsCapacityAvailable[Machines][Periods];
dvar int+ LotSize[ExaminationTypes][Machines][Periods];
dvar int+ BackLogs[ExaminationTypes][PreviousPeriodIncluded];

//objective function
dexpr float K   = sum( i in ExaminationTypes , m in Machines, t in Periods )
(
    SetupCosts[m][t] * IsSetupNecessary[i][m][t] +
    ProductionCosts[i][m][t] * LotSize[i][m][t] + 
    OpportunityCosts[t] * BackLogs[i][t]
);
minimize K;


//contraints
subject to {
    forall( t in Periods )
    ctMeetingCapacity:   
             (
                ( sum ( i in ExaminationTypes, m in Machines ) 
                    (ScanDuration[i]*LotSize[i][m][t] + SetUpDuration*IsSetupNecessary[i][m][t] + CleaningDuration*LotSize[i][m][t])
                ) 
                    <= 
                ( Alpha * sum (m in Machines)
                        (
                        IsCapacityAvailable[m][t] *
                        1*
                        (Capacity[m][t] - (2 * SetupBeginTime + 2 * SetupEndTime))
                        )
                )               
             );

      forall( i in ExaminationTypes, m in Machines, t in Periods )
      ctProduction:
                 (
                    LotSize[i][m][t] <= BigNumber * IsSetupNecessary[i][m][t]
                  );

     forall( i in ExaminationTypes, m in Machines, t in Periods )
     ctLogical:
                 (
                IsSetupNecessary[i][m][t] <= IsCapacityAvailable[m][t]
                  );

    forall( i in ExaminationTypes)
    ctZeroBackLogWhenT=1:   
             (
             // re-check
             BackLogs[i][0] == 0
             );

    forall( i in ExaminationTypes, t in Periods )
    ctMeetingDemand:   
             (
                ( sum ( m in Machines ) 
                    LotSize[i][m][t]
                ) 
                    <= 
                ( Demand[i][t] + BackLogs[i][t-1] )               
             );

    forall( i in ExaminationTypes, t in Periods )
    ctCalculationBackLog:       
             (
                Demand[i][t] - ( sum ( m in Machines )LotSize[i][m][t]) - BackLogs[i][t-1] == BackLogs[i][t]           
             );

     forall( i in ExaminationTypes, t in Periods )
     ctBigNumber:
                 (
                    BigNumber >= Demand[i][t]
                  );

    }

execute DISPLAY_RESULT{
//writeln("Gesamtkosten = ",K);
}

Sorry for that long formulation. I would be glad if somebody knew what to do!

CrnD
  • 11
  • 1
  • Hi everybody, now I fixed the problem and the calculation runs. But unfortunately as a MIP model I get the error: out of memory, as a CP model (with the command "using CP") the calculations has been running for over 60 hours until I had to stop it. Does anybody know how to programm a more heuristic approach? – CrnD Oct 10 '17 at 13:12

1 Answers1

0

by now I guess you have graduated, so this is not relevant anymore, but for the future = if you want somebody to reproduce an error you have to give a run-able stuff:

float SetupCosts[Machines][Periods]=...;
float ProductionCosts[ExaminationTypes][Machines][Periods]=...;
float OpportunityCosts[Periods]=...;      //when there are left overs of the prior period  
float ScanDuration[ExaminationTypes]=...;
float Capacity[Machines][Periods]= ...;
int Demand[ExaminationTypes][Periods]= ...;

no data for these above, yet e.g. you use the SetupCost in the goal...

Laja
  • 1
  • 1