I have a task Z that can only be completed once either task X or task Y is completed. Also:
% The length of task Z depends on which of X or Y is completed:
% If task X is completed, task Z takes 4 hours
% If task Y is completed, task Z takes 7 hours
% Task X takes 5 hours to complete
% Task Y takes 3 hours to complete
% Task X and task Y are exclusive: you can't do both (but that's probably irrelevan开发者_StackOverflowt, since that would never be optimal)
The question: what's the quickest I can complete task Z?
In this case, the answer is obviously 9 hours (X then Z), but my real problem has many cases like this.
Can taskjuggler help me? Can another tool? Additional notes:
% This is an extension of the "traveling salesman problem", and thus NP-hard. I'd be happy with a good-but-non-optimal solution.
% In the actual problem, some tasks are "milestones" which have a non-negative value. My goal is to maximize the sum of these values. However, I'm more than happy to solve the minimum time problem first. Additionally, the values may be equal for all milestones, simplifying the problem.
NB: since Mathematica has a function to quickly (but non-optimally) solve the TravelingSalesman problem, adding it as a tag.
You should look into dynamic programming. Basically, you'll reuse the solutions to subproblems to build a solution for your whole problem. You can do this in Mathematica or most any programming language.
精彩评论