Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
Expand all | Collapse all

[Solved] ForAll not available for int

  • 1.  [Solved] ForAll not available for int

    Posted Fri May 08, 2015 10:43 AM

    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


  • 2.  Re: [Problem] ForAll not available for int

    Posted Fri May 08, 2015 01:24 PM

    Hi

    don t you think you have a parenthesis issue and you could write

    forall(i,j in ClusterSet)
    forall(u in Node)
    sum(v in Intermediate: u!=v)z2[i][j][u][v]<=a[i][j][u];

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: [Problem] ForAll not available for int

    Posted Sat May 09, 2015 10:36 AM

    Originally posted by: TikiBlue


    Hello Alex!

     

    Thank you very much! The parenthesis was the reason it didn't accept the code!

     

    Grüße


    #DecisionOptimization
    #OPLusingCPLEXOptimizer