Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  setof/tuple/ordered .DAT data format

    Posted 02/09/17 07:32 AM

    Originally posted by: sapopt


    Hello,

    I found some code here: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.6.1/ilog.odms.ide.help/examples/html/opl/models/TravelingSalesmanProblem/tsp.mod.html

    for solving a classic TSP.  I understand the subtour elimination constraints, the model, etc.  I'm altering the model for a modified TSP, and I feel fine with that.

     

    My question is about feeding in data.  In particular, the linked .mod file contains these lines:

     

    
    024: 
    // Cities
    025: 
    int     n       = ...;
    026: 
    range   Cities  = 1..n;
    027: 
    028: 
    // Edges -- sparse set
    029: 
    tuple       edge        {
    int i; 
    int j;}
    030: 
    setof(edge) Edges       = {<i,j> | 
    ordered i,j 
    in Cities};
    031: 
    int         dist[Edges] = ...;
    

    I'm trying to understand how I should feed in the data.

    In my .DAT file, I've tried a trivial (fully connected) 2-node example:

    n=2;

    dist =[0,1,1,0];

    and I've tried:

    n=2;

    dist ={0,1,1,0};

     

    I know this question is quite basic, but what would a proper input format look like in the .DAT file?  The mix of tuple, setof, and ordered has gotten me a bit mixed up.

     

    Best regards,

    sapopt


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: setof/tuple/ordered .DAT data format

    Posted 02/10/17 12:24 AM

    Originally posted by: ShaCplex


    Hi,

    your .dat will be like this;

    n=2;

    dist={1,2,...};

    Edges={<i1,j1>,<i2,j2>,....};

    I think you have not initialized Edges well. a condition like i,j <10 should be given. otherwise you may have to initialize like i did in the .dat file

     

     

    Regards,

    shahul


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: setof/tuple/ordered .DAT data format

    Posted 08/27/18 11:46 PM

    Originally posted by: csfab


    And if I wanted to fetch distances in an excel file, which is an array of 1382 rows by 1382 columns, could they help me better setof and edge?

     

    thank you.

    Hugs

     

    Fernando


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: setof/tuple/ordered .DAT data format