Originally posted by: Crubal
Hi,
During writing the code, I want to define sets (described in the attachment); where I have the initial code:
int Resources = ...; // Number of Stations to select;
range Stations = 1..Resources;
float charge_stations[Stations];
range Interchanges = 1..Resources; // Number of Interchanges to be covered;
// 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] = ...;
tuple stations {
float charge_stations;
}
tuple traffic_flow {
float distance_flow;
}
float Budget;
float Safety_distance;
dvar int Build[Stations];
dvar boolean FlowsInSet1[Flows];
dvar boolean Cover[<i,j> in Flows];
Thanks a lot!
#DecisionOptimization#OPLusingCPLEXOptimizer