7

I'm working on an interactive job scheduling application. Given a set of resources with corresponding capacity/availabilty profiles, a set of jobs to be executed on these resources and a set of constraints that determine job sequence and earliest/latest start/end times for jobs I want to enable the user to manually move jobs around. Essentially I want the user to be able to "grab" a node of the job network and drag that forwards/backwards in time without violating any of the constraints.

The image shows a simple example configuration. The triangular job at the end denotes the latest finish time for all jobs, the connecting lines between jobs impose an order on the jobs and the gray/green bars denote resource availabilty and load.

You can drag any of the jobs to compress the schedule. Note that jobs will change in length due to different capacity profiles.

I have implemented an ad-hock algorithm that kinda works. However there are still cases where it'll fail and violate some constraints. However, since job-shop-scheduling is a well researched field with lots of algorithms and heuristics for finding an optimal (or rather good) solution to the general NP-hard problem - I'm thinking solutions ought to exist for my easier subset. I have looked into constraint programming topics and even physics based solutions (rigid bodies connected via static joints) but so far couldn't find anything suitable. Any pointers/hints/tips/search key words for me?

user
  • 5,335
  • 7
  • 47
  • 63
BuschnicK
  • 5,304
  • 8
  • 37
  • 49
  • 1
    I do not understand the problem fully, sorry. Why would the lengths of jobs change? What do you mean when you say grab and move the node? Is a job a node? Thanks. – Hamish Grubijan Jan 04 '10 at 01:14
  • The network as shown above can be modified via interactive drag and drop operations. Click on a job (the nodes in the graph labelled "job") and move it elsewhere. Since the job duration depends on available capacity (the gray/green bars) the job lengths will change while moving. – BuschnicK Jan 04 '10 at 09:47
  • I don't understand either. Is it that you want other jobs to move around to satisfy a particular job movement - say if you drag job032 left, job029 and job031 somehow reschedule themselves so job031 still finishes before job032 starts? If so, you'll need to tell us what we're allowed to do to the other jobs - move in time, change resources, etc? Do resources share simply (i.e. two unit-work jobs running on the same resource take 2 units of time to finish)? – Keith Randall Jan 05 '10 at 06:21
  • Yes, job029 and job031 need to reschedule in your example. Changing resources is allowed. I don't know what "share simply" means. We do have complex cases where the duration of one job depends on it's predecessor or multiple jobs may run in parallel on one resource or one job drags another or must be executed in a limited time slot after another job etc. Anyways, my primary concern is satisfying the precedence constraints implied by the links (lines). – BuschnicK Jan 05 '10 at 14:45
  • A diagram of a single job node would help. I assume it can have N jobs incoming (must complete beforehand), and N jobs outgoing (which depend on this job). Your example seems not so much "graph theory" and doesn't seem to care that resource 2 is going to be idle during job 031. A proper solution would only leave resource 2 idle if that were the most efficient way to achieve the stated goal. "resource" shouldn't be represented in this way; instead you should present dynamic nodes that behave visually as you describe. "hard constraints" like start time "lock down" a dynamic trait. – reechard Jan 10 '10 at 10:03
  • Physics simulations are well beyond what you need here, assuming your jobs can't bounce off each other, transfer intertia, or launch each other in a direction vector with some force F. – reechard Jan 10 '10 at 10:05
  • Why do you feel constraint programming is inappropriate? Unless you need to handle quite large problems and therefore start facing very large search-spaces, CP would be my first thought. – Larry OBrien Jan 18 '10 at 20:19

4 Answers4

1

I highly recommend you take a look at Mozart Oz, if your problem deals only with integers. Oz has excellent support for finite domain constraint specification, inference, and optimization. In your case typically you would do the following:

  1. Specify your constraints in a declarative manner. In this, you would specify all the variables and their domains (say V1: 1#100, means V1 variable can take values in the range of 1--100). Some variables might have values directly, say V1: 99. In addition you would specify all the constraints on the variables.

  2. Ask the system for a solution: either any solution which satisfies the constraints or an optimal solution. Then you would display this solution on the UI.

  3. Lets say the user changes the value of a variable, may be the start time of a task. Now you can go to step 1 to post the problem to the Oz solver. This time, solving the problem most probably will not take as much time as earlier, as all the variables are already instantiated.

    It may be the case that the user chose a inconsistent value. In that case, the solver returns null. Then, you can take the UI to the earlier solution.

If Oz suits your need and you like the language, then you may want to write a constraint solver as a server which listens on a socket. This way, you can keep the constraint solver separate from the rest of your code, including the UI.

Hope this helps.

prp
  • 61
  • 1
  • 3
  • Thanks for the pointer. I did a quick scan of it and I'm a bit sceptical about: 1) learning a new language requiring me to restate/reformulate the problem 2) the Mozart Oz stuff looks like a heuristic optimization framework looking for optimal job schedules. I'm just looking for one that satifisfies all constraints when manually editing the network 3) real-time interactive performance? – BuschnicK Jan 04 '10 at 10:00
  • 1) That's a valid concern, I guess. 2) You can just do "constraint satisfaction". You can do optimization only if you want. Please take a look at "Send more money" example. 3) For constraint satisfaction (not optimization), interactive performace shouldn't be a problem. – prp Jan 05 '10 at 09:21
1

I would vote in favor of constraint programming for several reasons:

1) CP will quickly tell you if there is no schedule that satifies your constraints

2) It would appear that you want to give you users a feasible solution to start with but allow them to manipulate jobs in order to improve the solution. CP is good at this too.

3) An MILP approach is usually complex and hard to formulate and you have to artificially create an objective function.

4) CP is not that difficult to learn especially for experienced programmers - it really comes more from the computer science community than the operations researchers (like me).

Good luck.

Grembo
  • 1,223
  • 7
  • 6
0

You could probably alter the Waltz constraint propagation algorithm to deal with changing constraints to quickly find out if a given solution is valid. I don't have a reference to hand, but this might point you in the right direction: http://www.sciencedirect.com/science?_ob=ArticleURL&_udi=B6TYF-41C30BN-5&_user=809099&_rdoc=1&_fmt=&_orig=search&_sort=d&_docanchor=&view=c&_searchStrId=1102030809&_rerunOrigin=google&_acct=C000043939&_version=1&_urlVersion=0&_userid=809099&md5=696143716f0d363581a1805b34ae32d9

mo-seph
  • 6,073
  • 9
  • 34
  • 35
0

Have you considered using an Integer Linear Programming engine (like lp_solve)? It's quite a good fit for scheduling applications.

vicatcu
  • 5,407
  • 7
  • 41
  • 65