Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

hourly duration into day

  • 1.  hourly duration into day

    Posted Fri March 01, 2019 04:08 AM

    Originally posted by: JKRATHORE


    Dear All, 

    I am working on a problem similar like RCPSP, I got stuck into scale the integer (hour) duration into float duration (days). My interval variable is

    mdl = CpoModel()
    tasks = [mdl.interval_var(name = "T{}".format(i + 1), size = DURATIONS[i]) for i in range(NB_TASKS)]
    

    where

    DURATIONS = [2, 15, 9, 30, 5, 6, 1, 4, 8, 12, 4, 2, 20, 5, 27, 90] in hours
    NB_TASKS = Number of Tasks
    
    

    here 10 hours = 1 day

    Since I also have few other constraints which are in day dimension ( e.g. number of people available in a day, maximum man-hours allowed in a day) and I am modeling them using cumulative functions, that why I want to convert hourly size of interval variable into day.  I have tried to convert it through dexpr , but it is throwing error

    scale = 10;
    dexpr float z = 1/scale*for(i in range(NB_TASKS) DURATIONS[i];
    

    Any thought on this would be appreciated, thank you

     

    Jitendra


    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: hourly duration into day

    Posted Fri March 01, 2019 04:30 AM

    Hi,

    you seem to mix Python docplex and OPL modeling language.

    "dexpr" is a keyword in OPL. In docplex that s

    docplex.cp.expression

    regards

    https://www.linkedin.com/pulse/what-optimization-how-can-help-you-do-more-less-zoo-buses-fleischer/


    #CPOptimizer
    #DecisionOptimization