Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  2D array declaration

    Posted 01/02/14 10:55 AM

    Originally posted by: davidoff


     range criterias = 1..6;
     float R0[solutionPairs][criterias]  =[p : [crit : R1[p]] | p in solutionPairs,crit in criterias];
     float R00[solutionPairs][criterias]  =[p : [ R1[p],R2[p],R3[p],R4[p],R5[p],R6[p ] | p in solutionPairs];
    

    Hello

    I want to bi-index an array, first axis is the collection solutionPairs and second one is 1..6 since I already calculated some values R1, R2 ..., R6 for each pair

    The first try with R0 compiles but is not what I want since I will have at the end a matrix with duplicated R1

    I tried R00 but it does not compile

    Any hint ?

    Thanks


    David


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: 2D array declaration

    Posted 01/03/14 04:42 AM

    hi,

    in R0, duplicates are normal because of :R1[p] which does not depend on crit.

     

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: 2D array declaration

    Posted 01/03/14 05:11 AM

    Originally posted by: davidoff


    thanks,

     

    What I really want to do is R00, that is for each p, returns an array of size 6 consisting in R1[p],R2[p],R3[p],R4[p],R5[p],R6[p]

    The only workaround I have is to do pattern matching :

     

     float R[solutionPairs][criterias]  =[p : [crit : 
         crit==1?R1[p]:
            crit==2?R2[p]:
            crit==3?R3[p]:
            crit==4?R4[p]:
            crit==5?R5[p]:
            R6[p]
            ] | p in solutionPairs,crit in criterias];
    

     

    Something less cumbersome would fancy me !


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: 2D array declaration

    Posted 01/27/14 01:26 PM

    Originally posted by: davidoff


    Same problem with a similar declaration : is there a less cumbersome way to declare :

     int D[tv in tripVehicles][ty in ttrip] = ty==innerTrip?tv.distInTrip:tv.distInterTrip;
    

    I would like something declared explicitely when I know the size of ttrip (here 2) Here something like

    int D[tripVehicles][ttrip] = [ tv : [tv.distInTrip , tv.distInterTrip] | tv in tripVehicles];
    

    But this latter declaration does not compile in 12.5 : "Formal parameter "tv" not supported in this context, can not have iterated expression.   "
     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer