我正在尝试使用CPLEX确定电动汽车充电站的位置。我创建了 5 个节点,m 辆车在 2 条路线上行驶,经过不同的节点。根据该信息,应确定充电站的最佳位置。基本草图:
这是我编写的 CPLEX 代码的开头:
//sets
int n=...; //nodes
int a=...; //path
int m=...; //set of ES travel on path
int cost=...; //cost of locating a station at node i
float rechargerate=5; //increased riding distance per charge (km/min)
int batterycapacity=5; //full charge range
range N=1..n;
range M=1..m;
range A=1..a;
tuple edge
{int i;
int j;
}
setof(edge) edges = {<i,j> | i,j in N : i!=j};
tuple link {
key string link_id;
string org;
string dst;
}
{link} Links={<"l1","1","2">,<"l2","1","3">,<"l3","3","2">,<"l4","2","5">,<"l4","4","2">};
这里的问题是,我无法定义A 集中的路径,链接起点/终点也应该在edges中定义。如何定义它们以找到 RS 位置的最佳解决方案?泰。