0

I am doing an MIP code in Cplex. The problem has feasible solution but CPLEX solution is not feasible. And, it does not show any relaxation but it relaxes capacity constraints 1 and 2. I think it relates to run configuration but I do not know what the problem is exactly.

the model is as follow:

//Parameters

//DKPCs
int I=...;
range DKPCs=1..I;

//Small DKPCs 
int S=...;
range SDKPCS=1..S;

//Big and Medium DKPCs

range BDKPCs=S+1..I;

//Depots
range Depots=1..2;

//Free capacity of depots
float Cj[Depots]=...;

//The unit storage cost of product i
float Hi[DKPCs]=...;

//Volume
float Vi[DKPCs]=...;

//The unit lost sale cost of product i
float Si[DKPCs]=...;

//The probability of selling product i if it were available in the DK depots

float Pi[DKPCs]=...;


//The initial inventory of consignment depot for product i
int Ki[DKPCs]=...;

// Total demand for product i in time period

int Di[DKPCs]=...;

int M=...;

//Decision Varaibles

//The assigned consignment capacity for product i
dvar int+ Yi[DKPCs];

//if product i is selected for consignment capacity
dvar boolean  Xi[DKPCs];

//if product i is available in the DK deopts in the problem time period
dvar boolean  Zi[DKPCs];

//Formulation
//Total Cost
dexpr float TotalStorageCost=sum (i in DKPCs)(Yi[i]+Ki[i]*Xi[i]-1/2*Di[i]*Xi[i])*Hi[i];
dexpr float TotalLostSaleCost=sum (i in DKPCs)(1-Zi[i])*(Di[i]-Ki[i])*Si[i]*Pi[i];
dexpr float TotalSmallProductsVolume= sum (i in SDKPCS)Vi[i]*Yi[i];
dexpr float TotalBigProductsVolume= sum (i in BDKPCs)Vi[i]*Yi[i];



minimize TotalStorageCost+TotalLostSaleCost;


subject to {

const1: forall (i in SDKPCS, j in 1..1){
                                                Vi[i]*Yi[i]<=Cj[1];}

const2: forall (i in BDKPCs, j in 2..2){
                                                Vi[i]*Yi[i]<=Cj[2];}

const3: forall (i in DKPCs){
                                                Yi[i]<=M*Xi[i];}

//const4: forall (i in DKPCs){                          
//                                              Ki[i]-Di[i]<=M*(1-Xi[i])-1;}

const5: forall (i in DKPCs){
                                                Ki[i]-Di[i]<=M*Zi[i]-1;}

const6: forall (i in DKPCs){                    
                                                Xi[i]*(Di[i]-Ki[i])<=Yi[i];}

const7: forall (i in DKPCs){                    
                                                Yi[i]<=M*Zi[i];}

const8: forall (i in DKPCs){
                                                (Di[i]-Ki[i])*Zi[i]<=M*Xi[i];}                                              

const9: forall (i in DKPCs){    
                                                Yi[i]>=0;}}

execute DISPLAY {
      writeln("TotalStorageCost=", TotalStorageCost);
      writeln("TotalLostSaleCost=",TotalLostSaleCost);
      writeln("TotalSmallProductsVolume=",TotalSmallProductsVolume);
      writeln("TotalBigProductsVolume=",TotalBigProductsVolume);

        }

And data is as follows:

 I=10;
 S=3;

Cj=[2,500];

Hi=[38  33  23  23  23  33  43  43  47  41];

Vi=[0.02    0.03    0.01    0.38    1.02    1.86    0.48    1.00    1.31    1.19];

Si=[63  81  174 119 157 177 125 101 97  176];

Pi=[0.83    0.69    0.10    0.07    0.51    0.20    0.92    0.60    0.32    0.33];

Ki=[20  24  13  22  16  24  13  12  20  13];


Di=[67  20  212 406 417 423 134 425 103 447];

M=999999999999999999;

1 Answers1

0

indeed. My suggestion : turn off presolve.

Add

execute
{
  cplex.preind=0;
}

at the beginning of your model

Plus if you use datacheck 2

execute
{
  cplex.datacheck=2;
}

you will get

CPLEX Warning 1041: In constraint 50, where variable 'Xi(1)' has a coefficient of 1e+18, consider using an indicator.

So instead of using big M you could use logical constraints.

If x is a binary decision variable and y an integer decision variable you can write in OPL

(x==(y>=7));
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15
  • I have added execute { cplex.preind=0; } – Atiye Ghorbani May 27 '20 at 13:33
  • I have added cplex.preind=0 and changed constraint 3 to (Xi[i]==(Yi[i]>=1));}. Also I have changed M to M=999. But it still return infeasible solutions and does not consider capacity constraints 2 and 3. I know that optimal feasible solution to this problem is : Xi= [1 0 0 0 1 0 1 1 1 1] Yi=[47 0 0 0 401 0 121 413 83 434] Zi=[1 1 0 0 1 0 1 1 1 1] – Atiye Ghorbani May 27 '20 at 13:45
  • Have you got rid of your big M ? – Alex Fleischer May 27 '20 at 14:01
  • I have changed the model as follows to get rid of Big M. The solution is now feasible but not optimal. const5: forall (i in DKPCs){ 0.01*(Ki[i]-Di[i])+0.01<=Zi[i];} const7: forall (i in DKPCs){ 0.01*Yi[i]<=Zi[i];} const8: forall (i in DKPCs){ (Di[i]-Ki[i])*Zi[i]*0.01<=Xi[i];} – Atiye Ghorbani May 27 '20 at 14:26
  • I have changed coefficients and the model is now working correctly. thanks. – Atiye Ghorbani May 31 '20 at 13:55