Originally posted by: TikiBlue
Hello Guys!
i just started programming with OPL and am stucked with an error in a ForAll function:
The code is much longer but the code below are the lines causing this error.
Basically i want to create a network with vertices and edges. The vertices consist of 2 sets,ClusterSet and Intermediate.
To make sure that the decision variable z2 can only flow through activated intermediate Nodes i have to set another decision variable "a" up which guarantees that every intermediate node "u" of the path " i to j "is activated.
The formulation of this constraint is attached as a file.
However OPL does not like my first constraint and complains that "FORALL is not available for int" in the line "forall(u in Node)", although the forall function above uses integers as well. Can someone help?
Code--------------------------------------------
int m = ...;
range Clusters = 1..m;
{int} ClusterSet = asSet(Clusters);
int g = ...;
range IntermediateRange = m..(m+g);
{int} Intermediate = asSet(IntermediateRange);
{int} Node = Intermediate union ClusterSet;
dvar float+ z2[ClusterSet][ClusterSet][Intermediate][Node]
dvar float+ a[ClusterSet][ClusterSet][Intermediate]
subject to {
ct1:
forall(i,j in ClusterSet)
forall(u in Node)
sum(v in Intermediate: u!=v)(z2[i][j][u][v]<=a[i][j][u]); /*** To make sure IS is created when path leads through it**/
ct2:
/** An addition is necessary for the first constraint **/
forall(i,j in ClusterSet)
forall(u in Intermediate)(a[i][j][u]<=x[u]);
}
-----------------------------------------------------
#DecisionOptimization#OPLusingCPLEXOptimizer