Home > Software engineering >  CPLEX OPL ERROR RUNTIME : not to type lloType ,
CPLEX OPL ERROR RUNTIME : not to type lloType ,

Time:12-21

It is confusing; I do not what the problem is. Does anyone know what the problem is?I get this error,"opl not to type runtime error", for some expression in my objective function when I am running the code in CPLEX.i'm working on a thesis with a scheduling problem design so that it's suitable for A2 is deadhead trip, I'm getting an error that i can't output the result with string, please help me review the code, I'll be very grateful My code is as follow:

`int numLocomotive=...;
range RangeLocomotive=1..numLocomotive;
{string} Pij=...;
{string} Node=...;
{string} Locomotive=...;{string} Vd=...;
{string} Va=...;
{string} Vs=...;
{string} Vf=...;
{string} Exp= Va union Vs;
{string} Exp= Va union Vs;
{string} Exp= Va union Vs;
{string} V= Vd union Va union Vs;
int ckm=...;
int cloc=...;
tuple A{
string I;
string j;
}
  {A} A2 ={<i,j> | ordered i,j in Node};
  int dis=...;
  dvar boolean x[<i,j> in A2];
  dvar boolean s[Locomotive];
 dvar boolean q[Node][Locomotive];


  execute PRE_SETUP
 {
  cplex.epgap = 0.001;
  cplex.tilim = 21600;
  }

  dexpr float Totalcost = sum(<i,j> in A2)(dis*x[<i,j>])*ckm   sum(k in Locomotive)s[k]*cloc;
  minimize Totalcost;

  subject to{
 ct01:
forall(j in Vd)
 sum(<i,j> in A2) x[<i,j>] == 1;

ct02:
 forall(i in Exp)
  sum(<i,j> in A2) x[<i,j>] == 1;

 ct03:
 forall(j in Vf)
   sum(<i,j> in A2) x[<i,j>] == numLocomotive;   

 ct04:
 forall(<i,j> in A2, k in Locomotive)

   s[k]   x[<i,j>] == 1;

 ct05:
 forall(i in Node, k in Locomotive)
  q[i][k] == 1;

  ct06:
 forall(i in V)
 sum(k in Locomotive, i in Node) q[i][k] == 1;

ct07:
forall(i in Node, j in Node, k in Locomotive: k in Pij)
   q[i][k] == q[j][k];
  forall(i in Node, j in Node, k in Locomotive: k not in Pij)  
   q[i][k]   q[j][k] == 0;  

  ct08:
    forall(<i,j> in A2, k in Locomotive)
   q[j][k] >= q[i][k] - (1-x[<i,j>]);
}    

My data

     `numLocomotive=2;
      ckm=10;
       cloc=300;
       Node={"S","K","V","Vi","Va","B","E"};
      Locomotive={"L1","L2"};
       Vd={"S","K","V"};
      Va={"V","Vi","Va","B"};
       Vs={"S";"K"};
       Vf={"E"};
       Pij={<L1 L2> <L1 L2> <L1 L2> <L1 L2>};
    
    A1
    i  S   K   V   S 
    j  V   Vi  Va  B

    A2
    i  S   S   S    k   k   k
    j  S   Vi   K   S   K   V
 Dis   50  45  40  56  50   59
    ckm=10;
    cloc=300;  ` 


 

CodePudding user response:

.mod

int numLocomotive=...;
range RangeLocomotive=1..numLocomotive;

{string} Node=...;
{string} Locomotive=...;{string} Vd=...;
{string} Va=...;
{string} Vs=...;
{string} Vf=...;
{string} Exp= Va union Vs;

{string} V= Vd union Va union Vs;
int ckm=...;
int cloc=...;
tuple A{
string I;
string j;
}

{A} Pij=...;

{string} ij={k.I | k in Pij} union {k.j | k in Pij};


  {A} A2 ={<i,j> | ordered i,j in Node};
  int dis=...;
  dvar boolean x[<i,j> in A2];
  dvar boolean s[Locomotive];
 dvar boolean q[Node][Locomotive];


  execute PRE_SETUP
 {
  cplex.epgap = 0.001;
  cplex.tilim = 21600;
  }

  dexpr float Totalcost = sum(<i,j> in A2)(dis*x[<i,j>])*ckm   sum(k in Locomotive)s[k]*cloc;
  minimize Totalcost;

  subject to{
 ct01:
forall(j in Vd)
 sum(<i,j> in A2) x[<i,j>] == 1;

ct02:
 forall(i in Exp)
  sum(<i,j> in A2) x[<i,j>] == 1;

 ct03:
 forall(j in Vf)
   sum(<i,j> in A2) x[<i,j>] == numLocomotive;   

 ct04:
 forall(<i,j> in A2, k in Locomotive)

   s[k]   x[<i,j>] == 1;

 ct05:
 forall(i in Node, k in Locomotive)
  q[i][k] == 1;

  ct06:
 forall(i in V)
 sum(k in Locomotive, i in Node) q[i][k] == 1;

ct07:
forall(i in Node, j in Node, k in Locomotive: k in ij)
   q[i][k] == q[j][k];
  forall(i in Node, j in Node, k in Locomotive: k not in ij)  
   q[i][k]   q[j][k] == 0;  

  ct08:
    forall(<i,j> in A2, k in Locomotive)
   q[j][k] >= q[i][k] - (1-x[<i,j>]);
} 

.dat

numLocomotive=2;
      ckm=10;
       cloc=300;
       Node={"S","K","V","Vi","Va","B","E"};
      Locomotive={"L1","L2"};
       Vd={"S","K","V"};
      Va={"V","Vi","Va","B"};
       Vs={"S","K"};
       Vf={"E"};
       Pij={<L1 L2> <L1 L2>, <L1 L2> <L1 L2>};
       dis=2;

work fine

  • Related