Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  not simultaneity constraint

    Posted 03/12/09 08:57 PM

    Originally posted by: SystemAdmin


    [deborah said:]

    Hi!!!
    I have to model a "not simultaneity constraint": given two job [i]i[/i] and [i]j[/i], they can not be executed together!!

    I've thougth the following constraint, but I've obtained a wrong result:


    endBeforeStart(tasks[i],tasks[j]) || endBeforeStart(tasks[j],tasks[i]);


    How could I express this constraint?

    Thanks to all.

    Deborah
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: not simultaneity constraint

    Posted 03/13/09 06:20 PM

    Originally posted by: SystemAdmin


    [jfk said:]

    Hello,
    A. using the latest version (6.1)
    precedence constraints can't be used in composing meta-constraints so what you do is not valid.
    But you can
    1.

    using CP;
    int horizon = 100;
    int n = 2;
    range Range = 1..n;
    int dur[Range] = [3,15];
    dvar interval task[i in Range] in 0..horizon size dur[i];

    subject to {
    //  endOf(task[1])>= 14;
      endOf(task[1]) <= startOf(task[2]) || endOf(task[2]) <= startOf(task[1]);<br />}


    2.
    also you have the constraint for sequence with noOverlap:

    dvar interval A[i in 1..n] size d[i];
    dvar sequence p in A types T;

    subject to {
      noOverlap(p, M);
    };

    T are the types and M is the transition time matrix, if you want types or transition, otherwise you can omit them.

    B. if by any chance you are using 3.7 in the help you have the example of non-overlapping for packing squares which goes like

    forall(ordered i, j in Squares)
      x[i].end <= x[j].start \/ x[j].end <= x[i].start \/ <br />  y[i].end <= y[j].start \/ y[j].end <= y[i].start; <br />

    which is very similar to the endOf, endStart kind of solution above under A/1


    I hope it helps
    cheers
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: not simultaneity constraint

    Posted 03/14/09 08:05 PM

    Originally posted by: SystemAdmin


    [deborah said:]

    Hi Katai,

    thank you for your help. I use OPL 6.1 so your first suggestion is really useful.

    Bye!!

    Deborah
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 4.  Re: not simultaneity constraint

    Posted 03/18/09 01:32 AM

    Originally posted by: SystemAdmin


    [shaw said:]

    Hello Deborah,

    The noOverlap constraint is made for this.  If you have n tasks that
    cannot overlap in time, you should group them all together in one
    noOverlap constraint.  If only two, you can do:

    noOverlap(all (z in {i,j}) tasks[z]);

    and if none of tasks can overlap, simply:

    noOverlap(tasks);


    Paul
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 5.  Re: not simultaneity constraint

    Posted 03/18/09 07:46 PM

    Originally posted by: SystemAdmin


    [deborah said:]

    Hi paul,

    your solution likes very good, but sorry, I don't understand so well the code:

    noOverlap(all (z in {i,j}) tasks[z]);

    If I have many tasks that can't run concurrently, and I know the several copple of this tasks, how can I express this constraints??


    forall (i in 1..n, j in 1..n : noSimultaneously[i][j] == 1)
            noOverlap( ?????? );


    Thanks

    Deborah

    #DecisionOptimization
    #OPLusingCPOptimizer


  • 6.  Re: not simultaneity constraint

    Posted 03/19/09 09:32 PM

    Originally posted by: SystemAdmin


    [dgravot@noos.fr said:]

    The "all" keyword allows you to collect the relevant pairs i,j

    In the following sample, I also use the keyword "append" to append two collections (actually two singleton)


    /*********************************************
    * OPL 6.1.1 Model
    * Author: dgravot
    * Creation Date: 19 Mar 2009 at 17:51:53
    http://forums.ilog.com/optimization/index.php?action=post;topic=1014.0
    *********************************************/
    using CP;

    int nbtasks = 5;
    range rtasks = 1..nbtasks;


    int noSimultaneously[i in rtasks][j in rtasks] = ((i+j) % 3==0) ? 1 : 0;

    tuple Clique
    {
    {int} nodes;
    }

    {Clique} cliques;

    execute FIND_CLIQUES
    {
    //TODO !!
    }



    dvar interval task[r in rtasks] size r;


    constraints
    {
    //1. post one constraint for each "no-simultaneous" pair
    forall(i in rtasks,j in i+1..nbtasks : noSimultaneously[i][j]==1)//j>i avoids posting twice the constraint
    noOverlap( append( all(k in i..i) task[k] , all(q in j..j) task[q]) );

    //2. less and more efficient constraints using cliques
      forall(c in cliques)
    noOverlap( all(i in c.nodes) task[i] );

    }


    Instead of posting only pairwise constraints, it is more efficient to collect the maximum cliques , that is if 1 and 2 are incompatible, 2 and 3 are incompatible, and 1 and 3 are also incompatible, we have a no-overlap of intervals 1,2,3 together.
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 7.  Re: not simultaneity constraint

    Posted 03/20/09 01:00 PM

    Originally posted by: SystemAdmin


    [deborah said:]

    Hi David,

    thank you for your replay, it was very useful. Moreover, it is more clear how I should use the construct all.

    Regards

    Deborah


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 8.  Re: not simultaneity constraint

    Posted 03/20/09 05:35 PM

    Originally posted by: SystemAdmin


    [shaw said:]

    Hello Deborah,

    As David says, it is more efficient to group cliques of no-overlaps together and there
    are ways that you can use CP Optimizer to do that.  However, I want to make sure that
    there is not a more direct way of modelling your problem in CP Optimizer.  Can you tell
    me where this no-overlap graph comes from?  What is the reason that some of the
    activities cannot overlap in time.  If possible, it may be better to model that reason explicitly.

    Thanks,


    Paul
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 9.  Re: not simultaneity constraint

    Posted 03/20/09 09:05 PM

    Originally posted by: SystemAdmin


    [deborah said:]

    Hi Paul!

    Given the task positions and the machine characteristics (they are crane), certain pairs of tasks cannot be performed simultaneously. A safety distance between movements must be observed to avoid collisions, which translates into additional constraints between pairs of tasks.

    Regards

    Deborah
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 10.  Re: not simultaneity constraint

    Posted 03/02/12 08:09 AM

    Originally posted by: qtbgo


    can we add a transition time M in noOverlap( append( all(k in i..i) task[k] , all(q in j..j) task[q]) );?
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 11.  Re: not simultaneity constraint

    Posted 03/02/12 09:32 AM

    Originally posted by: GGR


    Hi gtbgo

    No, Transition Time is given by a function of the types array argument in the constructor of sequence variable. You need to declare the sequence out of the model constraint declaration scope.

    Hope that helps
    #DecisionOptimization
    #OPLusingCPOptimizer