【问题标题】:what is the error in my code ? I have not set the data already我的代码有什么错误?我还没有设置数据
【发布时间】:2020-07-23 01:48:06
【问题描述】:

我试图在 cplex 中解决这个运输问题 enter image description here

这是我的 OPL 代码

int p=...;

int q=...;

范围 i=1..p;

float a[i];

范围 j=1..q;

float b[j];

浮点数 c[i][j];

dvar boolean x[i][j];

最小化 sum(l in i,m in j)x[l][m]*c[l][m];

以{

为准

forall (l in i) sum(m in j) x[l][m]

forall (m in j) sum(l in i) x[l][m] >= b[m];

}

enter image description here 这是我的 .dat

我不断收到此错误“数据元素“a”已设置”。

【问题讨论】:

    标签: linear-programming cplex opl operations-research


    【解决方案1】:

    因为您在 .dat 中声明了 a,所以您应该替换

    float a[i];
    

    通过

    float a[i]=...;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-18
      • 1970-01-01
      • 2010-12-26
      • 2018-02-23
      • 2018-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多