Originally posted by: Crubal
Hi,
I am defining the sets when building the mathematical model:
set1: a station (built) k is built on a path from nodes i to j; such that d(i, k) <= safety_distance /2 ;
set2: a station (built) k is built on a path from nodes i to j; such that d(k, j) <= safety_distance /2 ;
Where i, j are interchanges
I have the initial code:
// Define Stations and related parameter
int Resources = ...;
range Stations = 1..Resources;
range Interchanges = 1..Resources;
// Define Traffic Flow sets, distance and related binary variable
tuple flow {int i; int j;}
setof(flow) Flows = {<i,j> | ordered i,j in Interchanges};
float distance_flow[Flows] = ...;
float Safety_distance;
// Binary variable is defined this way whether a station is built or not
dvar int Build[Stations];
setof(flow) set1 = [<i,j> in Flows, k in Build[Stations] | distance_flow[<i,k>] <= 0.5 * Safety_distance];
In the last line, it has errors, and actually I don't know how to define this type of sets.
Besides, I am not sure how to define a binary variable: Cover[<i,j> in Flows]
Where Cover[<i,j> in Flows] = 1 means in round trip (i, j), the flow is covered by a fueling station (Build[Stations] = 1); and 0 otherwise.
In my way, I just write : dvar int Cover[<i,j> in Flows];
Thank you for your help!
#DecisionOptimization#OPLusingCPLEXOptimizer