Decision Optimization

Decision Optimization

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


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

Not ordered and repeated solution array written to Excel

  • 1.  Not ordered and repeated solution array written to Excel

    Posted 05/20/16 12:12 AM

    Originally posted by: Yusuf_OR


    Hi, 

    I just realized that OPL had not written values of a decision variable to Excel sheet correctly. Indexes are not ordered from smallest to largest and some of them are repeated. Here are a couple of lines (sorted before posted): 

     

    Index Value
    5684 7
    5684 34
    5685 2
    5686 5
    5686 6
    5687 2
    5687 2
    5688 2
    5688 2
    5688 6
    5691 1
    5691 1
    5691 1
    5692 1
    5692 1
    5692 1
    5693 1
    5693 1
    5693 1
    5694 1
    5694 1
    5694 1

     

    The OPL script to get these values are as follows:

    tuple FLYNUMBER { 
        int r;
        int flyTimesV; 
        }; 
        setof(FLYNUMBER) f = { <r,flyTimes[r]> | r in route: flyTimes[r]>0};
        
        int sizeFlyTimes = card(f) + 1;   
        string array1;
    

         

    I need to get this array in a correct way because I use this solution array as an input for further steps in my own program. 

    What the problem could be and how can I fix it? 

    Thanks in advance!

    Yusuf


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Not ordered and repeated solution array written to Excel

    Posted 05/20/16 10:08 AM

    Hi,

    about  "from smallest to largest", have you had a look at the keyword sorted ?

    do not hesitate to attach your .mod and .dat so that other users may help you

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer