1I'm trying to write the OPL of the CLuVRP(clusterd VRP ) optimisation problem . where the m vehicules must visit one or more clusters of citites .
I'm struggling to write the following constraint Constraints (7) establish that each cluster is visited exactly once by one vehicle. let δ+(Z) be the set of edges (i, j) ∈ Z × V \ Z and δ−(Z) the set of edges (i, j) ∈ V \ Z × Z .Consider Z to be any subset of V that is different from V. Where V is the set of vertices.
I just dont know what is the syntaxe to generate the sets delta+ , delta- and Z
Powerset in OPL can be a good starting point
{string} s={"A","B","C","D"};
range r=1.. ftoi(pow(2,card(s)));
{string} s2 [k in r] = {i | i in s: ((k div (ftoi(pow(2,(ord(s,i))))) mod 2) == 1)};
execute
{
writeln(s2);
}
and with your example that gives
{int} V=asSet(1..3);
range r=1.. ftoi(pow(2,card(V)))-2;
{int} Z [k in r] = {i | i in V: ((k div (ftoi(pow(2,(ord(V,i))))) mod 2) == 1)};
tuple t
{
int a;
int b;
}
{int} VdiffZ[k in r]=V diff Z[k];
{t} deltaplus[k in r]={<i,j> | i in Z[k], j in VdiffZ[k]};
{t} deltaminus[k in r]={<i,j> | j in Z[k], i in VdiffZ[k]};
execute
{
writeln(Z);
writeln(deltaplus);
writeln(deltaminus);
}