Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

unbound expression in scheduling sequence

  • 1.  unbound expression in scheduling sequence

    Posted Fri August 22, 2014 06:12 AM

    Originally posted by: jako123


    Hi, I wonder if anybody could help with this:

    I declare a number of interval variables that are optional in the solution

    dvar interval job[s in Calls][c in Cabins] optional size duration[s];

    At least 3 must be present in any solution:

    (Constraint 1)  forall(s in Calls, c in Cabins)
      sum(s in Calls, c in Cabins) presenceOf(job[s][c]) == nbCalls;

    To order them I use a sequence variable

    dvar sequence assignment[c in Cabins] in all(s in Calls, c in Cabins) job[s][c];

    First question: what does all mean here: does it enforce the sequence to take all job intervals or can it still be a subset of the jobs?

    Furthermore, I am struggling with various unbound expression, e.g. in this constraint:

     forall(s1,s2 in Calls, c1,c2 in Cabins)
         if(presenceOf(job[s1][c1]) && presenceOf(job[s2][c2]) && s1==s2 ){
               c1==c2;
         }
       

    Anybody an idea why the solver would not pick some job[s][c] and evaluate the presence of it?

     

    many thanks in advance

     

     

     

     


    #ConstraintProgramming-General
    #DecisionOptimization


  • 2.  Re: unbound expression in scheduling sequence

    Posted Mon August 25, 2014 11:49 AM

    Originally posted by: Petr Vilím


    Hello,

    if an interval variable is optional then it is up to CP Optimizer to decide whether it will be present (and in this case CP Optimizer must also assign it a start and end time) or absent (then there's no start or end time).

    To your first question: including an interval variable in a sequence does not really mean much until there's a constraint on the sequence variable. You probably want to use the constraint noOverlap. Anyway, with or without noOverlap constraint, absent intervals are in general ignored (they represent actions that were decided not to be taken in the particular solution). So you may think about the sequence as a sequence of exactly those intervals that will chosen as present. With noOverlap those present intervals will not overlap in time.

    To your second question: The "if" statement in OPL requires "ground" condition (see the doc). I.e. OPL needs to know whether the codition is true or false before it actually solves the model. In your case the condition depends on the interval decision variables and therefore OPL is not able to decide whether the condition is true or not.

    If I understand your code correctly, for one call there cannot be more than one present cabin. This can be written as:

    forall (s in Calls)
      sum(c in Cabins) presenceOf(job[s][c]) <= 1;
    

    Alternatively, depending on your problem, in may be better to declare also optional interval variables to represent the actual job that was choosen for particular call (if any). The constraint above is then replaced by constraint "alternative":

    dvar interval call[s in Calls] optional;
    ...
    forall (s in Calls)
      alternative(call[s], all(c in Cabins) job[s][c]);
    

    This is a preferred model if you have some use for the additinal interval variables 'call'.

    Best regards, Petr


    #ConstraintProgramming-General
    #DecisionOptimization


  • 3.  Re: unbound expression in scheduling sequence

    Posted Wed August 27, 2014 04:50 AM

    Originally posted by: jako123


    Dear Petr,

    thanks a lot this helped. Can I ask another question?

    I need to express a constraint that states the following

    if a job[s][c] is the first in the sequence variable assignment[c]  than startOf(job[s][c]) == x[s,c]

    How do I refer to the elements of a sequence variable (eg the first and last)? I understand that I have constraints to control the sequence, but I do not want to do this. I need to express setup costs x for the first job  in the sequence that depend on the job and the machine.

    For all following jobs I can use the normal transition times only depending on the jobs and the noOverlap constraint.

    many thanks in advance

    Jana

     


    #ConstraintProgramming-General
    #DecisionOptimization


  • 4.  Re: unbound expression in scheduling sequence

    Posted Fri September 19, 2014 11:32 AM

    Originally posted by: PhilippeLaborie


    Hello,

    I don't know if you got an answer to your last question. Here it is.

    I would add an additional "setup" interval variable at the beginning of the sequence (fixed date, ends at 0, constrained to be first using constraint first(seqVar,setup)) and then define a specific transition time between this setup interval and the interval variables representing the real jobs. If you really need a variable to constrain this setup time, you can use expression startOfNext(setup,seqVar) to get the start time of the first job in the sequence.

    Philippe


    #ConstraintProgramming-General
    #DecisionOptimization