Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Element method for interval variables

    Posted 07/05/19 08:36 AM

    Originally posted by: istenc


    Hi,

    I have two decision variable A and B that are interval and integer variable respectively. I am trying to  use element method so as to define a variable like Ak such that k=Bi. In other words, I am trying to use a decision variable as a subscript of another but I fail.

    I would be very glad if you can help me.

    Best,

    İstenç


    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Element method for interval variables

    Posted 07/08/19 02:48 AM

    Hi,

    indeed today you cannot write

    using CP;

    int n=5;

    dvar interval A[i in 1..n] in i..i+1 size 1;

    dvar int B[i in 1..n] in 1..n;

    subject to
    {
    allDifferent(B);

    forall(i in 1..n-1) startOf(A[B[i]])>=startOf(A[B[i+1]]);
    }

    but you could manage by using elements within an array:

    using CP;

    int n=5;

    dvar interval A[i in 1..n] in i..i+1 size 1;
    dvar int startA[i in 1..n];
    dvar int B[i in 1..n] in 1..n;

    subject to
    {
    allDifferent(B);

     

    forall(i in 1..n) startA[i]==startOf(A[i]);
    forall(i in 1..n-1) startA[B[i]]>=startA[B[i+1]];
    }

    Could that help ?

     

    regards


    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: Element method for interval variables

    Posted 07/08/19 04:03 AM

    Originally posted by: istenc


    Yes, it totally helps. I have tried to use element method like "element(all(i in 1..n) A[i],B[i])" but i think this method is incompatible with interval variables.

    Thanks a lot.

    Best,

    İstenç


    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: Element method for interval variables

    Posted 07/08/19 11:24 AM

    Originally posted by: GGR


    Hi istenc

     

    Actually you're right, the element expression is an integer expression. 

     

    Is it possible you told us why you need it for a scheduling problem?

     

    Cheers


    #CPOptimizer
    #DecisionOptimization


  • 5.  Re: Element method for interval variables

    Posted 07/09/19 04:18 AM

    Originally posted by: istenc


    Hi,

    I need it for a scheduling problem with batch delivery. At the end of some orders, a batch is delivered in our problem. So,  let a batch be delivered immediately after order 1 is completed. If order 2 is also in this batch, i should ensure that order 1 is completed after order 2; at this point, i should ensure that  endOf(A[2]])<endOf(A[1]). In a closed form, it would be  like

    endOf(A[i])<endOf(A[B[i]]) where B[i] is the order that has the maximum completion time in the batch by which order i is delivered.

     

    Thanks to the post by Alex Fleischer, i can model this constraint easily.

     

    Best,

    İstenç

     

     


    #CPOptimizer
    #DecisionOptimization


  • 6.  Re: Element method for interval variables

    Posted 07/09/19 10:17 AM

    Originally posted by: GGR


    Hi

     

    Thanks a lot for the model issue.


    #CPOptimizer
    #DecisionOptimization