How to define cost objective function

119 Views Asked by At

I want to make objective function to minimize impact due to the difference progress with schedule plan because the real progress was late. and I want make it some with the plan minimize the external resources external resourcesdurationcost

tuple Precedence {
  key int id;
  {int}   succs;
  int RelDate;
  int VolCost;
}
{Precedence} Precedences = ...;

tuple Mode {
  key int taskId;
  key int id;
  int pt;
  int costprod;
  int dmdIntRes [IntRes];
  int dmdExtRes [ExtRes];
  int Extcost ; 
}
{Mode} Modes = ...;

dvar interval Tasks [p in Precedences]in p.RelDate..EndMax   ; //in p.RelDate..EndMax in 0..EndMax
dvar interval mode[m in Modes] optional  size m.pt;


cumulFunction IntResUsage[r in IntRes] = 
  sum (m in Modes: m.dmdIntRes[r]>0) pulse(mode[m], m.dmdIntRes[r]);
  
cumulFunction ExtResUsage[r in ExtRes] = 
  sum (m in Modes: m.dmdExtRes[r]>0) pulse(mode[m], m.dmdExtRes[r]);
 
execute {
        cp.param.FailLimit = 10000;
}
 
minimize sum( m in Modes)
(100000 * maxl ());

subject to {
  forall (p in Precedences, m in Modes) {
    alternative(Tasks[p], all(m in Modes: m.taskId==p.id) mode[m]);
}
 forall (p in Precedences, m in Modes)
   (sum(m in Modes) m.costprod * m.pt >= 559717712 in 1..7)== presenceOf(mode[first(Modes)]);
  forall (r in IntRes)
    IntResUsage[r] <= CapIntRes[r];
  forall (r in ExtRes)
    ExtResUsage[r] <= CapExtRes[r];    
  forall (p1 in Precedences, p2id in p1.succs)
    startBeforeEnd (Tasks[p1], Tasks[<p2id>]); 
}

Thank you

1

There are 1 best solutions below

0
Philippe Laborie On

I take it that there are two questions:

  1. Minimize the “impact due to the difference progress with schedule plan because the real progress was late”
  2. Minimize “the external resources”

1- I understand that there is a plan that is currently being executed and that is late compared to the initial schedule. But it is not clear wether (a) you want to reschedule the remaining task from scratch in order to see if there is room for improvement (and in this case you want to minimize the same criterion as in the original plan, for instance the makespan) or (b) you want to reschedule the remaining tasks so as to minimize a mix of the original criterion and a new criterion that consists of finding a solution that is “not too far” from the previous one in order to also minimize the disruption of the plan.

In case (a), you only need to identify which tasks have already been executed and “freeze” them in the model (by fixing their start time: startOf(Task[t])==STARTED_AT[t]), or even better, remove them from the model (but then you need to write some constraints at the executed frontier of the schedule (availability profile of the resources, minimal stat time of tasks).

In case (b) you additionally need to modify the objective function. And you need to formalize the criterion measuring the distance between the plan currently being executed and the new plan. An (maybe too naive) example could be to minimize a sum of the individual distance of tasks to their original date:

dexpr int impact = sum(t in Tasks) abs(startOf(Task[t])-START_IN_ORIGINAL_SCHEDULE[t]))

And you can mix this new criterion with the original one (using a weighted sum, or a lexicographical objective)

By the way, I would rename the tuple Precedence in your model, it is really misleading, this tuple does not represent a precedence but a task …

2- You should formalise what you mean by minimizing the external resources. In the current model, I see that the individual usage of external resources by tasks in a given mode is fixed and that you have a ExtCost field in the tuple of the model. So I assume that you want to minimize the total external resource cost of the schedule, that is something like:


dexpr int totalExtCost = sum(m in Modes) presenceOf(mode[m])*m.Extcost;