Topic
  • 5 replies
  • Latest Post - ‏2013-09-26T11:16:52Z by PhilippeLaborie
Emad-Metu
Emad-Metu
3 Posts

Pinned topic RLP (Resource Leveling)....

‏2013-09-04T09:08:44Z |

Hi all

I am new in IBM ILOG and I started to implement Resource allocation modeling (Resource Leveling) on OPL.

Could I make changes in the Resource constrained model (RCP) to change it into resource leveling model?

Actually it will solve the first part of my problem to make a fixed CPM. After that I should to develop my own objective function for my model.

Also how could I define a daily resource usage variable into my code?

Regards....

  • PhilippeLaborie
    PhilippeLaborie
    68 Posts

    Re: RLP (Resource Leveling)....

    ‏2013-09-09T09:46:35Z  

    Hello,

    In general, Resource Leveling is a set of heuristics to ensure that the limited capacity of resources is satisfied at every time-point in a project.  There is no real optimization in the process. In contrast, the classical usage of CPLEX Optimization Studio is to produce optimal (or, at least, "optimized") solutions given a formal description of the objective function. What is in your case the objective function you want to optimize? The CP Optimizer sched_rcpsp, which you seem mention here, aims at minimizing the project makespan. You can of course model other types of objective functions in CP Optimizer.

    Some more specific answers to your questions:

    - To compute the CPM which boils down to computing the earliest and latest start times for the sub-problem only involving temporal constraints, if you really need that, you can model those sub-problems by removing the resource capacity constraints from the original RCPSP model and minimizing (resp. maximizing) the sum of activity end times.

    - Defining a resource usage variable for each day (so I suppose for each time-point in the model) is something we avoid in CP Optimizer scheduling models because we usually can use much more efficient constructs. For instance the cumulFunction to limit the maximal capacity of resources. Do you really need this type of variable in your scheduling model? What do you want to do with these variables? It is possible to define those variables in the model for instance by using overlapLength(act, d,d+1) that will return a 0-1 expression saying whether interval variable act overlaps day d; then you could use some expressions sum_i overlapLength(act_i,d,d+1)*q_i to sum up the total resource use for a given day. But again, doing that you will loose most of the advantages of the CP scheduling model (and, in case you really need that, you could also consider using a MIP model).

    Philippe

  • Emad-Metu
    Emad-Metu
    3 Posts

    Re: RLP (Resource Leveling)....

    ‏2013-09-11T13:55:06Z  

    Hello,

    In general, Resource Leveling is a set of heuristics to ensure that the limited capacity of resources is satisfied at every time-point in a project.  There is no real optimization in the process. In contrast, the classical usage of CPLEX Optimization Studio is to produce optimal (or, at least, "optimized") solutions given a formal description of the objective function. What is in your case the objective function you want to optimize? The CP Optimizer sched_rcpsp, which you seem mention here, aims at minimizing the project makespan. You can of course model other types of objective functions in CP Optimizer.

    Some more specific answers to your questions:

    - To compute the CPM which boils down to computing the earliest and latest start times for the sub-problem only involving temporal constraints, if you really need that, you can model those sub-problems by removing the resource capacity constraints from the original RCPSP model and minimizing (resp. maximizing) the sum of activity end times.

    - Defining a resource usage variable for each day (so I suppose for each time-point in the model) is something we avoid in CP Optimizer scheduling models because we usually can use much more efficient constructs. For instance the cumulFunction to limit the maximal capacity of resources. Do you really need this type of variable in your scheduling model? What do you want to do with these variables? It is possible to define those variables in the model for instance by using overlapLength(act, d,d+1) that will return a 0-1 expression saying whether interval variable act overlaps day d; then you could use some expressions sum_i overlapLength(act_i,d,d+1)*q_i to sum up the total resource use for a given day. But again, doing that you will loose most of the advantages of the CP scheduling model (and, in case you really need that, you could also consider using a MIP model).

    Philippe

    Dear Philippe Laborie

    Thanks a lot for your comprehensive reply to my question.

    Actually I gave some answers about my problem.

    As you mentioned I need to create a "daily resource usage" variable for my project because my objective functions would be:

    1) "minimizing the max resource usage" by assuming the fixed finish time (not like rcpsp problems which tries to minimize makespan) and no constraint in the capacity of the resource(s). 

    OR

    2) "minimizing the sum of squares of daily resource usage" again by assuming the fixed finish date and no limitation in resource availability.  

    I also have another question from you :

    how could I make a constraint to force the CPM not to be changed and the finish time be fixed?

     

    with king regards

    emad rezvan

  • Emad-Metu
    Emad-Metu
    3 Posts

    Re: RLP (Resource Leveling)....

    ‏2013-09-16T07:01:23Z  

    Hello,

    In general, Resource Leveling is a set of heuristics to ensure that the limited capacity of resources is satisfied at every time-point in a project.  There is no real optimization in the process. In contrast, the classical usage of CPLEX Optimization Studio is to produce optimal (or, at least, "optimized") solutions given a formal description of the objective function. What is in your case the objective function you want to optimize? The CP Optimizer sched_rcpsp, which you seem mention here, aims at minimizing the project makespan. You can of course model other types of objective functions in CP Optimizer.

    Some more specific answers to your questions:

    - To compute the CPM which boils down to computing the earliest and latest start times for the sub-problem only involving temporal constraints, if you really need that, you can model those sub-problems by removing the resource capacity constraints from the original RCPSP model and minimizing (resp. maximizing) the sum of activity end times.

    - Defining a resource usage variable for each day (so I suppose for each time-point in the model) is something we avoid in CP Optimizer scheduling models because we usually can use much more efficient constructs. For instance the cumulFunction to limit the maximal capacity of resources. Do you really need this type of variable in your scheduling model? What do you want to do with these variables? It is possible to define those variables in the model for instance by using overlapLength(act, d,d+1) that will return a 0-1 expression saying whether interval variable act overlaps day d; then you could use some expressions sum_i overlapLength(act_i,d,d+1)*q_i to sum up the total resource use for a given day. But again, doing that you will loose most of the advantages of the CP scheduling model (and, in case you really need that, you could also consider using a MIP model).

    Philippe

    Dear Philippe,

    Sorry but I have some more questions....

    1)

    I tried to make a function with "overlapLength" but I could  not ! always I face with the syntax error ( unexpected "(" , expecting "=" ) ; whereas I follow the format of this function from the Language Quick Reference. Could you please give more details about this function?

    2)

    should I use it with "dexpr int" phrase before it or not? also should I use directly "d" and "d+1" to show the time period or other alternatives? ( I mean, I should to calculate daily resource usage so could I use "1" and "1+1" instead of "d" and "d+1" ?)

    Best Regards

    Emad Rezvan

  • jonsonleou
    jonsonleou
    3 Posts

    Re: RLP (Resource Leveling)....

    ‏2013-09-18T04:45:37Z  

    Hello,

    In general, Resource Leveling is a set of heuristics to ensure that the limited capacity of resources is satisfied at every time-point in a project.  There is no real optimization in the process. In contrast, the classical usage of CPLEX Optimization Studio is to produce optimal (or, at least, "optimized") solutions given a formal description of the objective function. What is in your case the objective function you want to optimize? The CP Optimizer sched_rcpsp, which you seem mention here, aims at minimizing the project makespan. You can of course model other types of objective functions in CP Optimizer.

    Some more specific answers to your questions:

    - To compute the CPM which boils down to computing the earliest and latest start times for the sub-problem only involving temporal constraints, if you really need that, you can model those sub-problems by removing the resource capacity constraints from the original RCPSP model and minimizing (resp. maximizing) the sum of activity end times.

    - Defining a resource usage variable for each day (so I suppose for each time-point in the model) is something we avoid in CP Optimizer scheduling models because we usually can use much more efficient constructs. For instance the cumulFunction to limit the maximal capacity of resources. Do you really need this type of variable in your scheduling model? What do you want to do with these variables? It is possible to define those variables in the model for instance by using overlapLength(act, d,d+1) that will return a 0-1 expression saying whether interval variable act overlaps day d; then you could use some expressions sum_i overlapLength(act_i,d,d+1)*q_i to sum up the total resource use for a given day. But again, doing that you will loose most of the advantages of the CP scheduling model (and, in case you really need that, you could also consider using a MIP model).

    Philippe

    Hi Philippe:

    In the above answer, I am interesting your suggestion that using much more efficient constructs to smooth resource usage.

    I meet the similar RLP in my job too, to decide the weekly average resource usage subject to work/sales order due date by days,
    but the advantage of CP usually schedules tasks constrained by fixed resources capacity,
    can you further explain how to model the resource planning?

    Thank you in sincerely,

    Jonson

  • PhilippeLaborie
    PhilippeLaborie
    68 Posts

    Re: RLP (Resource Leveling)....

    ‏2013-09-26T11:16:52Z  

    Hi Philippe:

    In the above answer, I am interesting your suggestion that using much more efficient constructs to smooth resource usage.

    I meet the similar RLP in my job too, to decide the weekly average resource usage subject to work/sales order due date by days,
    but the advantage of CP usually schedules tasks constrained by fixed resources capacity,
    can you further explain how to model the resource planning?

    Thank you in sincerely,

    Jonson

    Hello,

    The easiest way to smooth cumulative resource usage in CP Optimizer is to minimize the resource capacity. Let 'usage' denote the cumul function representing the resource usage over time, you can do :

     

    cumulFunction usage = sum(...) ...;

    int CapacityMax = ...;

    dvar int peakUsage in 0..CapacityMax;

    minimize peakUsage;

    subject to {

      usage <= peakUsage;

       // ...

    }

     

    The strength of the CP model is that in the above model, you never need to explicit the time dimension and in particular you do not need to create decision variables for each time-point.

    If you want a more fine grain control on how the resource is smoothed, you can get the maximal usage of the resource over a particular time window [t1,t2) by:

    • creating a fixed interval variable "hole" on the time window, then
    • having this fixed interval variable "hole" requiring the resource with a variable quantity
    • use the quantity of resource used by "hole" in the objective

    The quantity of resource used by "hole" represents a quantity of resource that is not used by the actual activities on the resource.

    dvar interval hole in t1..t2 size t2-t1; // Fixed interval variable

    cumulFunction f = usage + pulse(hole, 0, CapacityMax);

    dexpr int peakUsage12 = CapacityMax - heightAtStart(f, hole);

    minimize peakUsage12;

    subject to {

     // ...

    f <= CapacityMax;

    }

    That way, you can create one fixed interval variable per time-window and combine the local peak usages in the objective function to smooth the resource (for instance minimizing the sum of the squares of these local peak usages). This should work fine if you do not define too many time-windows.

    Concerning tht syntax of the overlapLength expression, it takes as parameter either two interval variables or one interval variable and a time-window and returns the length of the overlap between the intervals.

    dvar interval a ...;

    dvar interval b ...;

    int t1 = ...;

    int t2 = ...;

    dexpr int ov1 = overlapLength(a,b);

    dexpr int ov2 = overlapLength(a, t1,t2);

     

    Philippe