Decision Optimization

Decision Optimization

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


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

Subset Or Sub İndicies OPL

  • 1.  Subset Or Sub İndicies OPL

    Posted 05/02/14 10:08 AM

    Originally posted by: htbirihan


    Hi Guys;

    I need a subset indicies of cities. I have 81 cities and 11 potential hub locations. 

    Cities : 1,2,3,4....81

    //{int} Hubs = {1,  6, 16, 21,  25, 27,  34,  35, 38, 42, 61}; subset of these cities.

     

    I have trouble, i want to just loop these subset but i wasn't define these subset and indices for all these pairs. 

    How can i do these? tuple or setof ... Would you explain how to solve these problem with CPLEX OPL.

    X[1][1]<= 10

    X[1][6] <= 10 

    X[1][16] <= 10  etc...

     

     

     

    int hub=...;
    int city=...;
    int T=...;
    {int} subhub = ...;
    range rhub=1..hub;
    range rcity=1..city;
    float alfa=...;
    //{int} Hubs = {1,  6, 16, 21,  25, 27,  34,  35, 38, 42, 61};
    //{int} HubSet = asSet( 1..dugum ) ;
     
     
     
    int   UlastirmaMaliyeti[rcity][rcity]=...;
    float Travel[rcity][rcity]=...;
    float Link_Cost[rcity][rcity]=...;
    float Hub_Cost[rcity]=...;
    //setof(int) Pos = { i | i in HubSet }; 
     
     
    dvar boolean x[rcity][rhub];
    dvar boolean z[rhub][rhub];
    dvar boolean y[rhub][rhub][rhub][rhub];
    dvar float+ r[rhub];
     
    minimize sum(i in rcity, j in rhub : j>i ) Link_Cost[i,j]*z[i,j] 
    + sum(k in rhub)Hub_Cost[k]*x[k][k];
     
    subject to 
    {
    // Begining of Constraint 2
      forall( i in rcity)
        sum(k in rhub)x[i][k]==1;  
    // End of Constraint 2
     
    // Begining of Constraint 3
       forall( i in rcity, k in rhub )
        x[i][k]<=  x[k][k];  
    // End of Constraint 3 

    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Subset Or Sub İndicies OPL

    Posted 05/02/14 03:40 PM

    Hi

    do you want the Euclidian product of cities by hubs ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer