Search code examples
constraintscplex

CPLEX give me this error " V23 has never been used"


A part of input is:

  tuple copie_macchine {

      int macchina;

      int copia1;

      int copia2;

      int copia3; 

   }

   {copie_macchine} copie = ...;

   int macc [I1][J] = ...;

   {int} s = {1,2,4,5,7,11,12,13,14,15,16,17,18,19};

   macc = [[1, 10],
    [1, 1],
    [3, 3],
    [0, 4]];

    copie = {<3,3,4,0>,
     <6,7,8,9>,
     <8,11,12,0>,
     <9,13,14,0>,
     <10,15,16,0>,
     <20,26,27,28>};

     dvar boolean y[I][J][M];

and I write in Cplex this code: the algorithm assigns to the variable y 1 if the value macc [i] [j] is in the set s otherwise it must choose to assign the value 1 either to copy 1 or to copy 2 or to copy

forall (j in J)

forall (i in I1 : macc [i][j] in  s)
  
  forall (i1 in I : i1==i)
  
    forall (m in M)
        
 V22:  y[i1][j][m] == 1;


  forall (j in J)
    
    forall (c in copie : c.copia3!=0)
    
     forall (i in I1 : macc[i][j] == c.macchina)
                   
             forall (i1 in I : i1==i)
       
                 forall (m in M)
       
   V23:  y[i1][j][c.copia1] == 1 ||  y[i1][j][c.copia2] == 1 ||  y[i1][j][c.copia3] == 1;   

but I have the error "V23 has never been used". How can I solve?


Solution

  • your line that contains V23 is never used.

    Let me share a smaller example which replicates this warning:

    dvar int+ x;
    
    subject to
    {
      x<=10;
      forall(i in 1..2:i>=5)
        
        {
          
           ct:(x==2) ;
       }  
    }
    

    gives

    ct has never been used