0

I'm developing a MiniZinc model for the traveling repairman problem and I'm obtaining the error of model inconsistency detected. I not really keen on modelling with Minizinc and I don't understand the reason of the problem. I would be grateful for any hints on how to solve it. Here is the model:

    int:n;                        %number of nodes
    int:v;                        %number of repairmen                
    set of int : F=1..v;          %set of repairmen

     set of int :custom=1..n;              %set of customers
     set of int :nodes=1..n+2*v;           %set of nodes with the v start 
     nodes and the v dummy end nodes
     set of int :nStart=n+1..n+v;          %set of start nodes
     set of int :nEnd= n+v+1..n+2*v;       %set of end nodes

     array[1..n+1,1..n+1] of int:time;     
     array [nodes] of var F : vehicle;         
     array [nodes] of var int: arrivalTime;     
     array [nodes] of var nodes:succ;           %successor
     array[nodes] of var nodes:pred;            %predecessor   

     constraint forall (i in nStart)(
               arrivalTime[i]=0);

      % successors of end nodes are start nodes
     constraint forall(i in (n+v+1..n+2*v-1)) (
          succ[i] = i-v+1 
            );
     constraint succ[n+2*v] = n+1;

    constraint redundant_constraint (
         forall(i in nodes)          
           (succ[pred[i]]=i) 
                 /\
            forall (i in nodes)(
              pred[succ[i]]=i) 
                  );

      %vehicle
       constraint  forall (i in nStart)(
          vehicle[i]=i-n);

      constraint  forall(i in nEnd)(
          vehicle[i]= i-n-v);

        constraint  forall (i in nodes)(
            vehicle[succ[i]]=vehicle[i]);

      constraint redundant_constraint (
      forall (i in nodes)(
           vehicle[pred[i]]=vehicle[i]));

     %time constraints     
      array[nodes,nodes] of int:t=array2d(nodes,nodes,[
       if i<= n /\ j<=n                    
         then time[i+1,j+1]
      elseif i>= n+1 /\ j<=n                
         then time [1,j+1]
       elseif i<=n /\ j>=n+1               
           then time [i+1,1]        
        else time[1,1]                      
        endif |i,j in nodes]);


     constraint  forall (i in nStart) (
          arrivalTime [succ[i]] >= t[i,succ[i]] + arrivalTime[i]);    

     constraint  forall (i in custom)  (                                           
          t[i,succ[i]] + arrivalTime [i] <=arrivalTime [succ[i]]);        

   constraint subcircuit(succ);
       constraint latency = sum (i in nodes) (arrivalTime [i]);
         solve minimize latency;
  • I can not recreate your problem. I found that latency didn't didn't have a declaration. To recreate the problem we will need the data as well. – Dekker1 Aug 16 '18 at 22:50
  • I skip the declaration of the latency variable by mistake.It would be: `var int:latency;` and related to the data, I'm working with n=5;v=2 and time=[|0,4,8,1,3,10,|4,0,12,3,5,9,|8,5,0,4,14,2,|1,9,16,0,8,1,|3,10,8,4,0,5,|10,4,6,8,6,0|]. – ralamillos Aug 17 '18 at 08:53

0 Answers0