Skip to content

Instantly share code, notes, and snippets.

@will3216
Created September 19, 2011 19:13
Show Gist options
  • Save will3216/1227307 to your computer and use it in GitHub Desktop.
Save will3216/1227307 to your computer and use it in GitHub Desktop.
def earliest_start_time(task: Int, solution: Solution): Int = {
var current_earliest = 0
solution.task_list.filter(p => p.task_id == task).foreach{p =>
p.precedence_constraint.foreach{r =>
solution.task_list.filter(y => y.task_id == r).foreach{t =>
if (t.precedence_constraint.isEmpty == true) {
if (t.empty_start_time == true){
return 0
}else{
return t.start_time
}
}
if (t.empty_start_time == true) {
XXX if (current_earliest < t.duration + earliest_start_time (t.task_id, solution)){
XXX current_earliest = t.duration + earliest_start_time (t.task_id, solution)
}else{return current_earliest}
}else{
if (current_earliest < t.duration + t.start_time) {
current_earliest = t.duration + t.start_time
}else{return current_earliest}
}
}
}
}
current_earliest
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment