mTSP with time window

Can solve the problem that the number of nodes is within 20.

The number of nodes is out of 20 and cannot be solved.

No problem with the model.

I feel that it is mainly used in =>.

Use in the model in load weight constraints and time window constraints =>.

I feel that there may be some problems in this logic.

MOD as below:

/*********************************************
 * OPL 12.9.0.0 Model
 * Author: 86131
 * Creation Date: 2019年5月24日 at 下午10:17:34
 *********************************************/

int     n       = …;
int     K       = …;
{int}   A  = asSet(1..n);//配送网点与客户点
{int}   N  = asSet(2..n);
{int}   Trucks  = asSet(1..K);//一组同质的车辆(人员) 
float   T  =…;//单次收派的最大工作时间
float   Z  =…;//一个极大正数
float        Q[Trucks] = …;//载重量上限
float        d[N] = …;//收件重量
float        v[N] = …;//派件重量

float CC[1..n*n*K] = …;
float c[i in 1..n, j in 1..n,k in 1..K] = CC[k+K*(j-1)+n*K*(i-1)];//行走成本(时间)
float        t[N][Trucks] =…;//客户 i的服务时间
float        a[N] = …;//客户 i要求的最早到达时间
float        b[N] = …;//客户 i要求的最晚到达时间*/
dvar boolean x[A][A][Trucks];//车辆 k 是否访问过客户 i 和客户 j 所构成的弧
dvar float+ q[A][Trucks];//车辆 k 离开客户i时所装载重量
dvar float+ w[A][Trucks];//收派员 k 达到客户 i的时间,原文文中是k,这里符号冲突了

dexpr float time[k in Trucks] =sum(i,j in A:j!=i)(c[i][j][k]*x[i][j][k])+sum(i in A,j in N:j!=i)(t[j][k]*x[i][j][k]);
/************************************************/
// Objective
minimize sum (i,j in A:i!=j,k in Trucks) c[i][j][k]*x[i][j][k];
subject to {
    forall(i in N)
      ct1:sum(j in A:j!=i,k in Trucks)(x[i][j][k])==1;
    forall(j in N)
      ct2:sum(i in A:i!=j,k in Trucks)(x[i][j][k])==1;
    forall(k in Trucks)
      ct3:sum(j in N)(x[1][j][k])==1;      
    forall(k in Trucks)
      ct4:sum(i in N)(x[i][1][k])==1; 
    forall(j in N)
      ct5:sum(k in Trucks)(x[1][j][k])<=1;  
    forall(i in N)
      ct6:sum(k in Trucks)(x[i][1][k])<=1;
    forall(k in Trucks,h in N)
      ct7:sum(i in A:i!=h)(x[i][h][k])-sum(j in A:j!=h)(x[h][j][k])==0;//改了A
    forall(k in Trucks)
      ct8:time[k]<=T;
    forall(k in Trucks) 
      ct9:q[1][k]==sum(j in N)(v[j]*sum(i in A:i!=j)(x[i][j][k])); 
       forall(i in A,j in N:j!=i,k in Trucks)
      ct10:x[i][j][k]==1=>(q[j][k]-q[i][k])==-(d[j]+v[j]);//不用考虑回原点 
    //forall(i in A,j in N:j!=i,k in Trucks)
      //ct10:(q[j][k]-q[i][k])>=-(d[j]+v[j])-Z*(1-x[i][j][k]);//不用考虑回原点  
    forall(i in A,j in A:j!=i,k in Trucks)
      ct11:x[i][j][k]==1=>q[i][k]<=Q[k];//之前有问题,q意思是离开客户i的载重量   
    forall(i in N,j in A:j!=i,k in Trucks)
      ct12:x[i][j][k]==1=>maxl(0,-d[i])<=q[i][k];      
    forall(j in N,k in Trucks)
         ct13:x[1][j][k]==1=>w[j][k] >= w[1][k]+c[1][j][k];//这里 w[1][k]表示离开原点1的时间     
    forall(i in N,j in N:j!=i,k in Trucks)
        ct14:x[i][j][k]==1=>w[j][k] >= w[i][k]+t[i][k]+c[i][j][k];   
     //forall(j in N,k in Trucks)
         //ct13:w[j][k] >= w[1][k]+c[1][j][k]-(1-x[1][j][k])*Z;//这里 w[1][k]表示离开原点1的时间 
     //forall(i in N,j in N:j!=i,k in Trucks)
         //ct14:w[j][k] >= w[i][k]+t[i][k]+c[i][j][k]-(1-x[i][j][k])*Z;//这里 w[1][k]表示离开原点1的时间  
    forall(i in A,j in N:j!=i,k in Trucks)
         ct15:x[i][j][k]==1=>a[j]<=w[j][k]; 
     forall(i in A,j in N:j!=i,k in Trucks)
         ct16:x[i][j][k]==1=>w[j][k]<=b[j];
         ct18:sum(i in A,k in Trucks)x[i][i][k]==0;    
  }

Personal feeling problems mainly appear in the load weight constraint ct10-ct12 and time window constraint ct13-ct16.

I don’t know if => is correct, if not, how to represent the above constraints.

In addition, with similar constraints such as adding an infinite number Z, the model does not apply.

Thanks for solving my problem.

 

Source: mTSP with time window