CPLEX OPL ERROR RUNTIME:不要键入 lloType ,

Posted

技术标签:

【中文标题】CPLEX OPL ERROR RUNTIME:不要键入 lloType ,【英文标题】:CPLEX OPL ERROR RUNTIME : not to type lloType , 【发布时间】:2022-01-20 13:39:52 【问题描述】:

令人困惑;我不知道是什么问题。有谁知道问题出在哪里?当我在 CPLEX 中运行代码时,我收到此错误,“opl not to type runtime error”,用于我的目标函数中的某些表达式。我正在研究调度问题设计的论文所以它适用于A2是死路,我得到一个错误,我不能用字符串输出结果,请帮我检查代码,我将非常感激我的代码如下:

`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>]);
    

我的数据

     `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;  ` 


 

【问题讨论】:

为什么这个问题被标记为 R? 你能分享 .dat 和 xlk 文件以便其他用户可以帮助你吗? 【参考方案1】:

.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;

工作正常

【讨论】:

你能告诉我怎么写execute Write吗? @Alex Fleischer 在linkedin.com/pulse/…中查看预处理和后处理github.com/AlexFleischerParis/zooopl/blob/master/… 先生,我希望 A2 中每个 i 到 j 的距离,但我不知道如何像 i->j =294; 45,45,34,34,45

以上是关于CPLEX OPL ERROR RUNTIME:不要键入 lloType ,的主要内容,如果未能解决你的问题,请参考以下文章

您好,我看到你之前提的cplex无法启动的问题,您解决了吗?我也遇到同样的问题,不知道怎么办

理解多背包问题 IBM CPLEX 的问题

谷歌 colab 上带有学生版的 CPLEX

运行游戏runtime error怎么解决

为啥不考虑 cplex 中解决方案数量的限制?

有关runtime error的错误怎么解决啊!!!!求救