Tag Archives: 3-Partition

Sequencing to Minimize Weighted Tardiness

Happy New Year, everyone!  I just checked ahead in the appendix, and at my current pace of about 1 problem a week, we should get through appendices A5 (Sequencing and Scheduling), A6 (Mathematical Programming), and possibly A7 (Algebra and Number Theory) this year.  The appendix goes through A12, so it looks like I have plenty of work ahead of me.

The problem: Sequencing to Minimize Weighted Tardiness.  This is problem SS5 in the appendix.

The description: Given a set T of tasks, each task t  has a length l(t), a weight w(t) (which is really a penalty for finishing a task late) and a deadline d(t), and a positive integer K.  Is there a one-processor schedule for all tasks in T where each task is penalized by w(t) for each time unit it goes beyond its deadline, such that the total penalty is K or less?

Example: Suppose I have 3 tasks:

Task Length Deadine Weight
1 3 3 100
2 1 4 3
3 2 4 1

If task 1 is going to not miss its deadline, it needs to start right away.  Since the weight penalty for missing the deadline is pretty disastrous, we should do that.

At time 3, when task 1 is done, we have a choice: Schedule task 2, and have task 2 finish 2 time units late, or schedule task 3, have it finish just 1 time unit late and schedule task 2 afterward.  With these weights, scheduling task 2 first gives a penalty of 2 (task 3 finishes 2 time units late, for a penalty of 1, and 1×2=2).  The other plan would have a penalty of 7 (Task 3 finishes 1 unit late, and task 2 finishes 2 units late).

If the weight of task 2 was 1, and the weight of task 3 was 5, then scheduling task 2 first gives a penalty of 10, but scheduling task 3 first gives a penalty of 6.

Reduction: G&J reference a paper by Lawler, which itself references G&J.  Weird.   Anyway, they reduce from 3-Partition.  Given a 3-Partition instance (a set of 3n elements, and a bound B.  Each element is between B/4 and B/2, and the sum of all elements is m*B), we create 4n jobs.  3n of them will be “A” jobs, each one corresponding to an element in the 3-Partition instance.  We will also have n “X” jobs.

Each “A” job Ai corresponds to an element in the 3-partition instance ai.  These jobs have weight and length B+ai and deadline 0.

The X jobs all have processing time 16B2+n(n+1)/2 + 1.  Call this number L.  The X jobs have weight (L+4B)*(4B)*n(n+1)/2 + 1.  Call this number W. Each X job Xi has deadline iL+(i-1)*4B.    Notice that these X jobs don’t depend on the values in the partition instance at all (they do depend on the size).

Our K value is W-1.

If the original set has a partition, then we can make a schedule of: X1 then the A jobs corresponding to a 3 element partition, then X2, then another set of 3 A jobs corresponding to another 3 element partition, and so on down.  Since we know the  3 elements in a partition sum to exactly B, we know that the processing time of each set of 3 A jobs is exactly 4B.  So each X job will finish at time i*L+(i-1)*4B, and not be tardy.  The A jobs all have deadline 0 and will all be tardy and will pay penalties related to their completion times, but that will sum to less than K.

In the other direction, suppose that we have a legal schedule.  Since all of the X jobs have weight > K, they all have to be scheduled before their deadlines.  Then we can talk about the weights and completion times that the A jobs need to have to fit around these X jobs.  It’s a lot of algebra to make it all work out, but the math isn’t too hard.

Difficulty: 7.  While the algebra is followable, the idea that you’d need to come up with these numbers in the first place is a hard one- I know they’re picked because they “work”, but I feel like there must be an easier way.

Protected: Dynamic Storage Allocation

This content is password protected. To view it please enter your password below:

Protected: Bin Packing Take 2

This content is password protected. To view it please enter your password below:

Protected: Numerical 3-Dimensional Matching

This content is password protected. To view it please enter your password below:

Protected: Intersection Graph For Segments On A Grid

This content is password protected. To view it please enter your password below:

Weighted Diameter

It took over a year (the first problem strictly from the Appendix was Domatic Number, last August), but we’re finally at the end of the Graph Theory section!  And the last problem is one that’s actually good for students to solve.

The problem: Weighted Diameter.  This is problem GT65 in the appendix

The description: Given a graph G=(V,E) a collection C of  |E| not necessarily distinct, non-negative integers, and a positive integer K.  Can we find a one-to-one function f  mapping each edge in E to an element of C such that if f(e) is the length of edge e, then G has a diameter of K or less.

In other words, given a set of edge weights C, can we give each edge in E a (distinct) weight from C such that the resulting weighted graph has a path between any two vertices of length ≤ K?

Example: Suppose I have a graph:

weighted dimater3

And C= {1,2,2,2,3,5}.  I think the best was you can label this is:

weighted dimater2

The Diameter here is 7 (The length of the path from A-D).

The reduction: G&J say to use 3-Partition, so we’ll go with that.  We’re given a set A, with 3m elements, a bound B, and want to split the elements of B into sets of size 3 so that each set adds up to m.  We know several things about A, but the important thing for our purposes is that all of the elements in A add up to m*B.

We’ll also assume that |A| is at least 9.  If it’s smaller than that, we can just brute-force the answer.

What we’re going to do is build a graph that is a tree with 3m+1 vertices.  We have a root, and the root has m chains of length 3 extending from it. This gives us exactly 3*m edges.

We set K = 2*B, and set C = A

If there exists a 3-parition of A, then each of the sets of 3 elements can map onto a different chain in the graph.  This makes the longest path in the graph be between any 2 leaves.  Since the length from a leaf to a root is exactly B, the diameter of the graph is 2B.

If there exists a weighted diameter of the graph of cost 2*B, then we need to show the the cost of each chain is exactly B.  Suppose it wasn’t, and the cost from the root to some leaf v is > B, let’s say B+x.  Then , since there are least 3 chains (since |A| >= 9) and since the sum of all of the weights is m*B exactly), there must exist some leaf w, with the cost of the chain from the root to w > B-x.  The cost of the path from v to w is now > 2B, a contradiction.

If the cost from the root to some leaf is < B, then there must be some other leaf u with the cost from the root to u > B (since the cost of all of the edges add up to m*B) , and we can do the above on u.

Since each chain costs exactly B, we can use the edge weights of each chain as the sets of 3 elements that make our 3-Partition.

Difficulty: 4. G&J does say in the comments that this problem is NP-Complete even for trees, so that may have been a hint.  The proof is a little tricky (getting from “diameter ≤ K” to “set adding up to exactly K” requires some work, and there may be a more elegant way than what I did).  But I think this would make a good homework problem.

Protected: Directed Bandwidth

This content is password protected. To view it please enter your password below:

Protected: 3-Partition

This content is password protected. To view it please enter your password below: