Minizinc错误:检测到模型不一致

时间:2018-08-16 16:56:29

标签: constraint-programming minizinc

我正在开发用于旅行修理工问题的MiniZinc模型,并且遇到检测到的模型不一致错误。我不太热衷于使用Minizinc进行建模,也不了解问题的原因。对于如何解决该问题,我将不胜感激。 这是模型:

    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;

0 个答案:

没有答案