Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Accessing Sequence in Postprocessing

    Posted Thu February 17, 2011 04:28 PM

    Originally posted by: Dogdog


    Hi all.

    I want to know how to access a sequence variable in post processing.
    This is an excerpt from my code:

    int nbJobs = ...;
    range Jobs = 1..nbJobs;
     
    int duration[Jobs] = ...;
     
    dvar interval task[j in Jobs] size duration[j];
    dvar interval opttask[j in Jobs][m in Machines] optional size duration[j];
    dvar sequence schedule[m in Machines] in all(j in Jobs) opttask[j][m];
     
    execute {
      writeln(schedule[1]);
    };
    


    In the last execute box, I want to access the "schedule" variable. I tried to search in the ILOG CPLEX Help, but in there there are only two methods for accessing sequence variable, i.e. ".first()" and ".last()". I want to access the "position" and "declaredPosition" in the sequence variable.

    Thanks before for helping.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Accessing Sequence in Postprocessing

    Posted Mon February 21, 2011 03:27 PM

    Originally posted by: GuangFeng


    This is the example shown in the documentation of IloIntervalSequenceVar

    using CP;
     
    range R = 1..3;
     
    dvar interval tia[i in R] size i;
    dvar sequence seq in tia;
     
    subject to {
      noOverlap(seq);
     
      before(seq, tia[2], tia[3]);
      prev(seq, tia[1], tia[3]);
    }
     
    execute {
      writeln(seq);
      writeln(seq.first() );
      writeln(seq.next(seq.first() ) );
      writeln(seq.last() );
     
      writeln("loop"); 
      var s=seq.first(); 
      for(var i in R) 
      {
       writeln(s); 
       s=seq.next(s) ; 
      } 
      writeln(s); 
    }
    


    Is it sufficient for your purpose?
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Accessing Sequence in Postprocessing

    Posted Mon February 21, 2011 04:14 PM

    Originally posted by: Dogdog


    Actually, I want to access the "position" and "declaredPosition" values for a particular element in the given sequence.
    For example, something like: sequence[1].declaredPosition = ....
    Is it possible? Thanks.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Accessing Sequence in Postprocessing

    Posted Tue February 22, 2011 02:01 PM

    Originally posted by: GuangFeng


    Can you explain what you mean by "position" and "declaredPosition"? What are the differences between "position" and "declaredPosition"?
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Accessing Sequence in Postprocessing

    Posted Fri February 25, 2011 04:09 AM

    Originally posted by: Dogdog


    I actually don't know much about them. What I understood is, "Position" and "declaredPosition" are values in the sequence type variable. I think of them just like "Start" and "End" in interval type variable, which can be accessed by methods namely, "xxxx.start" and "xxxx.end".
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Accessing Sequence in Postprocessing

    Posted Tue March 01, 2011 02:28 AM

    Originally posted by: GuangFeng


    My bad. Now I know where you read them, but I don't have an answer now.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: Accessing Sequence in Postprocessing

    Posted Wed March 02, 2011 03:19 PM

    Originally posted by: Dogdog


    Anyway, thanks you for answering.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer