Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Alternative modes with alternative resources

    Posted 06/13/18 10:10 AM

    Originally posted by: Tunemelo


    Hello everybody,

    I have the following problem:

    There are different products with 3 main production steps (1,2(a,b),3) and alternative resources at each production step. The number of production steps depends on the resource used at one specific production step (= variable). Meaning that, if resource x at production step 2a is used, then production step 2b becomes necessary.

    I was thinking to assume that there are always 4 production steps and to include the problem by defining two modes.

    Mode 1 declares the alternative resources for production steps 1,2(a,b),3 if the resource at production step 2a makes production step 2b on an extra resource necessary. And Mode 2 declares the alternative resources for production steps 1,2,3 if the production step 2b is already included in 2a and therefore 2b does not need to be carried out anymore (then there is a dummy resource for 2b with a duration of 0). The alternative resources for production step 1 and 3 are the same in both modes, only the resources for production step 2a and 2b differ.

    In the first place it should be decided if Mode 1 or Mode 2 is taken. And in the second place it should be decided which alternative resources in each process step should be chosen.

    Is it possible "to define an alternative in an alternative"? Or is there a better way of expressing this problem in CP?

     

    Thanks a lot:)


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: Alternative modes with alternative resources

    Posted 06/14/18 07:39 AM

    Originally posted by: PhilippeLaborie


    Hello,

    First, there is absolutely no problem in defining alternative of alternative in CP Optimizer. Constraint alternative(x,[y1,...,yn]) is a constraint like any other so it can be defined between any interval variable x and any set of interval variables yi.

    Now, for your problem, in your description is seems that there is no constraints between the resources allocated to steps 1 and 3 from one side and the resources allocated to steps 2a (and 2b).

    In this case, you could focus on the complex step 2 only (and have 'usual' alternative for the steps 1 and 3).

    If I understand well, this step2 can be executed in different modes, some of them require 1 interval (let's call these intervals a_i for a mode i in 1..n), some of them 2 intervals (let's call them b_j -> c_j for a mode j in 1..m). You could define the step2 as being the alternative of n+m intervals, for modes i in 1..n, these are directly the a_i intervals, for modes j in 1..m, these intervals are a set of m additional intervals s_j that span [b_j,c_j] and have the same presence status (presenceOf(s_j)==presenceOf(b_j), presenceOf(s_j)==presenceOf(c_j)).

    Another option is indeed to use alternative of alternatives: you say that you have 2 main modes for step 2: either using 1 interval 'a' or 2 intervals (by introducing a new interval s spanning 'b->c') and you say that 'a' is the alternative of the 'a_i', 'b' is the alternative of the 'b_j' and 'c' is the alternative of the 'c_j'.

    Philippe

     

     


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: Alternative modes with alternative resources

    Posted 06/14/18 04:45 PM

    Originally posted by: Tunemelo


    Hi Philippe,

    Thanks for your reply😊 Do you mean something like this:

     

    // Step 2 Variable
    dvar interval Step_2 [p in Products];

     

    // Mode 1 - no breakdown of Step 2
    // Ressource 1 for Step 2

    dvar interval Step2 [p in Products] optional size Duration2[p]; 

     

    // Ressource 2 for Step 2

    ...  

     

    // Mode 2 - breakdown of Step 2

    dvar interval Step2ab [p in Products] optional;

     

    // Mode 2 - Step 2a and Step 2b
    // Ressource 1 for Step 2a
    dvar interval Step2a [p in Products] optional size Duration2a[p];

     

    // Ressource 2 for Step 2a

    ...

    // Ressource 1 for Step 2b
    dvar interval Step2b [p in Products] optional size Duration2b[p];


    // Mode 1 or Mode 2 as alternatives for Step 2
    forall (p in Products)

    alternative (Step_2[p], all (p in Products) [Step2[p],Step2ab[p]]);

     

    // Span 2ab over 2a and 2b
    forall (p in Products)

    span (Step2ab[p], all(p in Products) [Step2a[p],Step2a[p]));

     

    // Step 2a before Step 2b
    forall (p in Products)

    endBeforeStart(Step2a[p],Step2b[p]);

     


    forall (p in Products)

      {

    presenceOf(Step2ab[p])== presenceOf(Step2a[p]);

    presenceOf(Step2ab[p])== presenceOf(Step2b[p]);

    };

    The alternative and the span constraints are not working like this as I tried to include both variables. Obviously that's not correct how I did it. Do I need to include an additional interval variable for this (to cumulate Step2 and Step2ab first)?

    Did I understood you correct that you suggest to establish one interval variable for each resource in each mode (Mode 1: Step2, Mode 2: Step2a --> Step2b)? (There are completely different alternative resources for Step2, Step2a and Step2b= 10 in total)

    Thank's for your help!😊


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 4.  Re: Alternative modes with alternative resources

    Posted 06/15/18 02:59 AM

    Originally posted by: PhilippeLaborie


    I think that you are doing something wrong here:

    // Mode 1 or Mode 2 as alternatives for Step 2
    forall (p in Products)
      alternative (Step_2[p], all (p in Products) [Step2[p],Step2ab[p]]);
    
    // Span 2ab over 2a and 2b
    forall (p in Products) 
      span (Step2ab[p], all(p in Products) [Step2a[p],Step2a[p]));
    

    Why do you need to iterate over the products inside the alternative constraints?

    I think it should rather be:

    forall (p in Products)
      alternative (Step_2[p], [Step2[p],Step2ab[p]]);
    
    // Span 2ab over 2a and 2b
    forall (p in Products)
      span (Step2ab[p], [Step2a[p],Step2a[p]));
    

     

     


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 5.  Re: Alternative modes with alternative resources

    Posted 06/15/18 06:58 AM

    Originally posted by: Tunemelo


    I see. But it is still not working like this. It's telling me that the add-on syntax is not supported when I try to run the model with these both constraints...

     

    forall (p in Products)

    alternative (Step_2[p], [Step2[p],Step2ab[p]]);

     

    // Span 2ab over 2a and 2b
    forall (p in Products)

    span (Step2ab[p], [Step2a[p],Step2a[p]]);


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 6.  Re: Alternative modes with alternative resources

    Posted 06/15/18 07:29 AM

    Originally posted by: PhilippeLaborie


    Right. In OPL the syntax is rather: alternative(Step_2[p], append(Step2[p],Step2ab[p]));

     


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 7.  Re: Alternative modes with alternative resources

    Posted 06/20/18 04:58 AM

    Originally posted by: Tunemelo


    Thanks, that works!:)


    #DecisionOptimization
    #OPLusingCPOptimizer