Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  array element as set?

    Posted 12/20/12 04:33 AM

    Originally posted by: qtbgo


    Hi, I want to define an array a i, the element of the array is set type. So that I can implement a constraint like:

    x ik != 1 forall i,k: k in a i

    It seems that OPL doesn't support this. Can you help me achieve my purpose?
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: array element as set?

    Posted 12/20/12 04:59 AM

    Originally posted by: SystemAdmin


    Hello,
    I think it works in OPL:

    
    
    
    int n=10; 
    {
    
    int
    } A[i in 1..n] = 
    { k | k in 1..i 
    };   dvar 
    
    int x[i in 1..n][j in 1..n] in 0..1;   constraints 
    { forall(i in 1..n, k in A[i]) 
    { x[i][k] != 0; 
    } 
    }
    


    Is it something like that you want to do ?
    Philippe
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: array element as set?

    Posted 12/20/12 05:28 AM

    Originally posted by: qtbgo


    thank you very much. it works.

    I want to initialize A in .dat file, and the values doesn't depend on i, Could you give correct format to initialize A in dat file? thanks.

    in mod:
    
    
    {
    
    int
    } A[i in 1..2] = ...;
    


    in dat:

    A = ?;
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 4.  Re: array element as set?

    Posted 12/20/12 05:41 AM

    Originally posted by: SystemAdmin


    
    A = [ 
    { 1 
    } 
    {1 2 
    } ];
    

    #DecisionOptimization
    #OPLusingCPOptimizer


  • 5.  Re: array element as set?

    Posted 12/31/12 10:04 AM

    Originally posted by: GGR


    Hi gtbgo

    You must declare a tuple class <i, k> and then defines a tuple set of <i, k> that gives the valid k associated with an i.

    Hope that helps
    #DecisionOptimization
    #OPLusingCPOptimizer