Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

how to express set with subscript?

  • 1.  how to express set with subscript?

    Posted 09/12/13 01:35 AM

    Originally posted by: qtbgo


    Hi, How to express something  like the following in OPL:

    forall( i in 1..n)

       sum(j in M[i]) x[j] >=1;

     

    Where M[i] is a set dependent on i.

     

    Thanks in advance.

     

     

     

     


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: how to express set with subscript?

    Posted 09/12/13 02:18 AM

    Hi,

     

    what you wrote is correct and let me give you a full example that works fine:

     

    int n=10;
     {int} M[i in 1..n]={1,i};
     
     
     dvar int x[1..10] in 1..10;
     
     subject to
     {
     forall( i in 1..n)

       sum(j in M[i]) x[j] >=1;
       
     } 

     

    regards


    #DecisionOptimization
    #OPLusingCPOptimizer