title: Robust VRP in CPLEX - Increasing uncertainty budget
body: <p>The following model shows a robust VRP that provides a robust solution for one deviation in demand and one deviation in transportation time, respectively. So far, however, I have failed to extend the model to account for more than one deviation. Do you have any ideas? It was created according to the concept of the Uncertainty Budget by Bertsimas and Sim and written with OPL for the CPLEX optimization program.</p>
  <pre><code> // parameters &amp; sets
      int n = ...; // amount of customers 
  
  {int} N = asSet(1..n);  // set of customers
  
  {int} N0 = {0} union N union {n+1}; // set of customer incl. depots
  
  int m = ...; // amount of vehicles
  
  {int} M = asSet(1..m); // set of vehicles
  
  float Q = ...; // capacity
  
  float r[N]= ...; // demand
  
  float b[N]= ...;// deadline 
  
  tuple Kanten {int i ; int j;};
  
  {Kanten} A  = {&lt;i,j&gt; | i in N0, j in N0}; // set of arcs A
  
  // unidirectional edges
  {Kanten} A_unidirected = {&lt;i,j&gt; | i in N0, j in N0: i&lt;j};
  
  // Kardinalität A_unidirected
  int cAu = card(A_unidirected);                      // amount of routes that can be delayed
  
  // Kanten-Indexmenge
  {int} subsets_1 = asSet(1..cAu);                    // set of routes that can be delayed
  
  Kanten B1[x in subsets_1];
  
  execute{for (var f in subsets_1)
              for (var edge in A_unidirected)
                  if (Opl.ord(A_unidirected,edge) == f-1){B1[f]= edge;};
            writeln(&quot;B1= &quot;+ B1);
  }
  
  int u[N0,N0,subsets_1];
  
  execute{for (var edge in A_unidirected)
              for (var x in subsets_1)
                  if (edge == B1[x]) {u[edge.i][edge.j][x] = 1;
                                      u[edge.j][edge.i][x] = 1;};
      }       
  
  int K = 999;    // large number
  
  float d[N0,N0]= ...;            // max deviation of travel time
  
  float o [N]= ...;           // max deviation of demand
  
  float G = ...;  // uncertainty budget of travel time                
  
  float L = ...;  // uncertainty budget of demand
  
  float t[N0,N0] = ...;               // travel time matrix
  
  float c[N0,N0] =...;                // distance matrix
  
  
   // optimization model
  // decision variables
  dvar boolean x[A, M];                       
  dvar float+ s[N0, M, subsets_1];
  dvar float+ p[N,M];
  dvar float+ z[M];
  
  // objective function
  minimize sum(k in M) sum(i in N0) sum(j in N0) c[i,j]*x[&lt;i,j&gt;,k];
  
  // constraints
  subject to {
    // (2)
    NB2:forall (i in N) {
    sum (k in M) sum (j in N0: j!=i) x[&lt;i,j&gt;,k] == 1;
    };
    
    // (3) 
    NB3:forall (k in M) {
     sum (j in N0: j !=0) x[&lt;0,j&gt;,k] == 1;
    };
  
    // (4)
    NB4:forall (i in N, k in M) {
     sum (j in N0: j!=i) x[&lt;i,j&gt;,k] - sum (j in N0: j!=i) x[&lt;j,i&gt;,k] == 0;
    };   
    
    // (5)
    NB5:forall (k in M) {
       sum (i in N0: i!=n+1) x[&lt;i,(n+1)&gt;,k] == 1;
    };
    
     // (11)
    NB11: forall (k in M) {
      sum (i in N) r[i] * sum (j in N0: j!=i) x[&lt;i,j&gt;,k] + L*z[k] + sum (i in N) p[i,k] &lt;= Q ;
    };    
    // (12)
    NB12: forall (k in M, i in N,j in N: i!=j) {
      z[k] + p[i,k] &gt;= o[i] * r[i] * sum (j in N0: j!=i) x[&lt;i,j&gt;,k];
    };    
    // (13)
    NB13: forall (i in N0,j in N0: i!=j, k in M, f in subsets_1) {                                            
      s[i,k,f] + t[i,j] + d[i,j] * u[i,j,f] * t[i,j] - K * (1 - x[&lt;i,j&gt;,k]) &lt;= s[j,k,f]   ;       
    };
    
    // (14)
    NB14: forall (i in N, k in M, f in subsets_1) {                                   
      0 &lt;= s[i,k,f] &lt;= b[i];  
    };    
    // (15)                                                                           
      NB15: forall (k in M, i in N0, j in N0: i==j) {
     x[&lt;i,j&gt;,k] == 0;  
    };
      // (16)
      NB16: forall (i,j in N0, k in M){
        x[&lt;0,n+1&gt;,k] ==  0;
      }
  };
  </code></pre>