如何解决铁路线规划问题?

时间:2019-06-12 14:29:24

标签: cplex opl

我正在写有关铁路客运线路规划问题的论文。我想看看在铁路网络中计算鲁棒性的不同方法。由于我没有使用OPL的经验,因此在求解模型时遇到了一些问题。我的主管无法帮助我,我急切地寻找可以帮助我正确设定模型的人。该模型应确定隐含的线路,以及火车的班次和车厢数量,同时将成本保持在最低水平。

我有以下两个问题: 我有一组边线(E)和一组势线(L)。我该如何告诉OPL,例如,第1行包含边1和2。我发现很难链接这些变量。

我正在使用二进制决策变量x [L] [F] [C]来分别代表线路,线路频率和车架数量。我该如何告诉模型值只乘以F的值。例如第3个约束,我想将F和C的值乘以capC。

int nv = ...;
range V = 1..nv;            //set of stations.

int ne =...;
range E =1..ne;                 //set of edges.

int nf = ...;
range F = 1..nf;            //set of possible frequencies.

int nc = ...;   
range C = 1..nc;            //set of possible carriages.

int nl = ...;
range L = 1..nl;            //set of potential lines.

//Parameters

int capC = ...;             //Capacity per carriage

int w[L] = ...;             //cost for using line l

int fmin[E] = ...;          //min freq per line l 

int fmax[E] = ...;          //max freq per line l

int h[E] = ...;             //Demand edge e

//Decision variable

dvar boolean x[L][F][C];                        

//Objective function
minimize sum(l in L, f in F, c in C) w[l] * x[l][f][c]; 

//Constraints

subject to {
forall (e in E)
  sum(l in L, f in F, c in C) x[l][f][c] >= fmin[e];        //Min edge freq

forall (e in E)
  sum(l in L, f in F, c in C) x[l][f][c] <= fmax[e];        //Max edge freq 

forall (e in E)
  sum(l in L, f in F, c in C) x[l][f][c] * capC >= h[e];  //Transfer all passengers

forall (l in L)
  sum(f in F, c in C) x[l][f][c] <= 1;              //Per line at most 1

1 个答案:

答案 0 :(得分:0)

关于“我想将F和C的值与capC相乘”,您是否尝试过

forall (e in E) sum(l in L, f in F, c in C) x[l][f][c] * capC >= h[e]; //Transfer all passengers

进入

forall (e in E) sum(l in L, f in F, c in C) f*c*x[l][f][c] * capC >= h[e]; //Transfer all passengers