doulian1852 2013-11-08 05:12
浏览 20
已采纳

根据前任结束日期更新任务开始日期

I would like to develop a program with the following algorithm in mind:

Task A and Task B are the predecessor of Task C. They all have Start date and End date. If the End date of Task B is delayed, then the Task C Start date will also be delayed. This is the most simple case. However, in most case, the graph will be more and more complex.

What algorithm should I use to update the each task's start date and end date but not only recursively checking?

Thanks

  • 写回答

1条回答 默认 最新

  • dousi6701 2013-11-08 05:46
    关注

    You need to solve the problem described in http://en.wikipedia.org/wiki/Longest_path#Acyclic_graphs_and_critical_paths.

    At the start of your program, do a topological sort to establish an order in which predecessor tasks come before successor tasks, and work out an initial set of task timings. When a task end date is delayed, use the order from the topological sort to check the successors of that task, and then the successors of those successors, and so on. You could keep a list of successors not yet checked that may be delayed, checking the earliest from this list in the original order, and inserting new successors if it turns out that a task must have its end date modified. You can finish without checking all nodes in the graph if this list becomes empty - that tells you that no further nodes are affected by the slip.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据