Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  problem with preprocessing data

    Posted 03/14/12 04:53 PM

    Originally posted by: HuiD


    Hi, I want to preprocess the input the data. Like I have the code below

    int N = ...; // the number of demands
     tuple demand {
            int index; //from 1 to N
            int ts;
            int te;
     }
     
     {demand} Dem = ...;
     int overlap[1..N][1..N] = ...;
     
     //preprocessing
     execute {
            for(var p, q in Dem) {
                    if( (p.ts<=q.ts) && (p.te>q.ts)) {
                            overlap[p.index][q.index] = 1;
                    }
                    else {
                            overlap[p.index][q.index] = 0;
                    }
            }
     }
    


    When I run it, there is this "Bad declaration syntax." at "for(var p, q in Dem)". I don't know how to correct this, any ideas? Thanks,

    Hui
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: problem with preprocessing data

    Posted 03/14/12 05:14 PM

    Originally posted by: SystemAdmin


    you need two seperate for loops, for p and q...
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: problem with preprocessing data

    Posted 03/14/12 05:16 PM

    Originally posted by: HuiD


    Right, problem solved.

    Thank you.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer