I am trying to decide the location of recharge station for electric vehicles by using CPLEX. I have created 5 nodes and m vehicles are traveling on 2 routes stopping by different nodes. According to that information, optimum location of the recharge stations should be decided. Basic sketch:
Here is the beginning of the CPLEX code I wrote:
//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">};
The problem here is, I could not define the paths in the A set also the links start/end points should be in defined in edges. How can I define them to find an optimal solution for RS locations? Ty.
can transform your Links into edges