Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Height Parameter as a Function of Variables in the Pulse Function

  • 1.  Height Parameter as a Function of Variables in the Pulse Function

    Posted Mon June 22, 2015 02:32 AM

    Originally posted by: SergeyPolyakovskiy


    Dear All,

    In my problem, I would like to have a flexible duration, yet a flexible contribution dependent on a set of variables for a job used in the cumulative function. For example, let interval variable a be of size 10 and consume 10 units of a resource when variable x in {0,1} takes the value of 1. Otherwise, when x=0, let a be of size 5 and consume 5 units.

    Is there any smart way to implement this case without using any additional variables?

    All the best,

    Sergey


    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Height Parameter as a Function of Variables in the Pulse Function

    Posted Mon June 22, 2015 05:24 AM

    Originally posted by: rdumeur


    Dear Sergei,

     

    I think you could use two optional interval vars (One with size 10 and another with size 5).

    Each interval var would be associated with a pulse (with height 10 and 5 respectively).

    You can then use the 'alternative' constraint to represent such a choice, and then use presenceOf(resource_10) instead of having an additional variable x as in the following example:

    dvar interval resource_5 optional size 5;
    dvar interval resource_10 optional size 10;
    dvar interval resource_choice;
    
    cumulFunction c = pulse(resource_5, 5) + pulse(resource_10, 10);
    dexpr int x = presenceOf(resource_10);
    
    subject to {
            alternative(resource_choice, append(resource_5, resource_10));
    }
    
    execute {
            writeln("resource_5 " + resource_5);
            writeln("resource_10 " + resource_10);
            writeln("x " + x);
            writeln("c " + c);
    }
    

    Cheers,

     

     


    #CPOptimizer
    #DecisionOptimization