If Direction

advertisement
EE5900 Advanced Embedded
System For Smart Infrastructure
Advanced Theory
1
3DM to Numerical 4DM
• First show that numerical 4DM is NPcomplete. Reduce from 3DM.
• 4DM problem says that given four sets
S1,S2,S3,S4, each of which consists of
q distinct elements, and a collection
C=S1⨯S2⨯S3⨯S4, one asks whether
there exists a subcollection C’ to partition
the union of four sets and the sum of
values of each set in C’ is B.
2
Reduce from 3DM to numerical 4DM
•
•
•
•
•
•
•
•
•
Create four elements for each candidate set (xa,yb,zc) in M. e1 in S1, e2 in
S2, e3 in S3 and e4 in S4.
If xa is in the candidate set, create an element e1 with value either
2q3+aq2 (core) or aq2 (dummy).
If yb is in the candidate set, create an element e2 with value either bq
(core) or q3+bq (dummy).
If zc is in the candidate set, create an element e3 with value either c
(core) or q3+c (dummy).
create an element e4 with value 2q3-aq2 -bq-c.
If there is only one occurrence of a variable (e.g., x1) in M, then there is
only one core element generated.
If there are k occurrences (e.g., z7) in M, then there are k elements
generated where contains one core element and k-1 dummy elements.
Note that different elements can have the same value.
Candidate sets in 4DM is created such that it contains either all core
elements or all dummy elements. Enumerate all possible candidate sets.
Set B=4q3.
3
Reduction example
• Suppose that the candidate sets M in 3DM is as follows.
• (x1,y5,z7), (x2,y2,z7), (x2,y5,z5) …
• (x1,y5,z7) produces e11 with value 2q3+q2, e21 with value 5q, e31
with value q3+7, e41 with value 2q3-q2-5q-7.
• (x2,y2,z7) produces e12 with value 2q3+2q2, e22 with value 2q, e32
with value 7, e42 with value 2q3-2q2-2q-7.
• (x2,y5,z5) produces e13 with value 2q2, e23 with value q3+5q, e33
with value 5, e43 with value 2q3-2q2-5q-5.
• If (x1,y5,z7) is picked in M, we pick (e11 e21 e32 e41).
• Since (x2,y2,z7), (x2,y5,z5) are not picked, we pick (2q2 q3+2q e31
e42) and (2q2 e23 e33 e43).
• The elements with values are those generated from other
candidate sets in M.
• e12 e22 e13 are not picked and they will be picked corresponding to
some sets picked in M.
4
If direction
•
•
•
•
•
When there is solution of 3DM problem,
If a set is picked in 3DM, the corresponding core set is picked in
numerical 4DM. Otherwise, the corresponding dummy set is picked.
Each variable is picked exactly once in 3DM, so each core element is
picked exactly once. Note that core elements generated from multiple
sets in M could be combined together and picked (since we enumerate
candidate sets in numerical 4DM).
Given k occurrences of a variable in M, they are in k candidate sets in M.
One of them is picked (so is the corresponding core element), and k-1 of
them is not picked (so the corresponding k-1 dummy elements are
picked). Thus, each generated element is picked exactly once. There is
only one e4 for each set in M, which will be used to make the sum of
values 4q3.
This is the subcollection of sets to partition the union of four sets and
each set with the sum of values to be B.
5
Only if direction
• Given a solution to numerical 4DM, each
core element is covered exactly once.
There exists sets which contain only the
core elements and one can pick the
corresponding sets in M.
6
Numerical 4DM to Numerical 3DM
• Given a numerical 4DM instance, we
have four sets S1, S2, S3, S4. We
create three new sets T1, T2, T3.
– T1 = S1 ⋃ P where P=S3 ⨯ S4 are pairing
elements
– T2= S2 ⋃ S3 ⋃ F where F are
fillers and |F|=q2-q
– T3=S4 ⋃ P’ where P’ are
copairing elements
• Form the collection as follows
7
Form Collection
• (t1,t2,t3) can be formed as the elements from the following sets
through enumeration
– (S1,S2,P’)
– (P,S3,S4)
– (P,F,P’)
• Weighting functions
– w1’(p)=3B-w3(s3)-w4(s4)
– w1’(s1)=w1(s1)
– w2’(s2)=w2(s2)+2B
– w2’(s3)=w3(s3)+4B
– w2’(f)=0
– w3’(s4)=w4(s4)
– w3’(p’)=4B+w3(s3)+w4(s4)
8
Only if direction
• When there is a solution for numerical
4DM, for each selected candidate set
(s1,s2,s3,s4), we pick (t1,t2,t3) as
(s1,s2,p’(s3,s4)) and (p(s3,s4),s3,s4).
• Since |S1|=|S2|=|S3|=|S4|=q, we have
picked 2q sets for numerical 3DM.
• Since |T1|=|T2|=|T3|=q2+q, we need to
pick q2-q sets. They are (p,f,p’).
• The sum of each set is 7B
9
If Direction
• When there is a solution for numerical 3DM, since
there are only q2-q filler elements, we need to pick at
least 2q sets in the form of (s1,s2,p’) or (p,s3,s4) to
cover all elements.
• Note that |S1|=|S2|=|S3|=|S4|=q, so there are only q
sets of (s1,s2,p’) and q sets of (p,s3,s4).
• Since |P|=q2, there are only q sets of (p,s3,s4) which
can be picked since other |P| are picked with fillers.
Similarly, since |P’|=q2, there are only q sets of
(s1,s2,p’) which can be picked.
• One then correspondingly picks (s1,s2,s3,s4)
• Each set has sum 7B in numerical 3DM, and thus
each set has sum B in numerical 4DM
10
Numerical 3DM to 3Partition
• Given a set S of 3m elements where
each element a has a value v(s) and ∑s
∈S v(s)=mB, one asks whether S can be
partitioned into m disjoint subsets
S1,S2,…,Sm such that for each subset ∑ s
∈ Si v(s)=B?
• Reduce from Numerical 3DM with sum
target B’. Form the set S as T1 ⋃T2
⋃T3 and set w(s)=w’(t)+3iB’
where i = 1,2,3. Set B=19B’.
11
Reduction
• When there is a solution for Numerical
3DM, one accordingly partition the sets
and each set has sum 19B’ since the
sum of elements in each set in the
solution for numerical 3DM is B’.
• When there is a solution for 3Partition,
one accordingly picks the sets in
numerical 3DM.
12
3Partition to Nonpreemptive Scheduling
• Given an instance of 3partition, form an
instance of nonpreemptive scheduling problem
which contains 3m+1 tasks, T1,T2,…,T3m+1 as
follows.
• For each element si, create a task Ti with
p=d=mB+m and c=v(si).
• Create a task T3m+1 with p=B+1 and d=c=1.
• We claim that the task set is schedulable if
and only if the 3partition instance is feasible.
13
Only if direction
• When the task set is schedulable
– Task T3m+1 is scheduled at time 0, B+1, 2(B+1), …
– Consider the hyper period mB+m. All of the first 3m tasks
need to be scheduled within it.
– During this hyper period, T3m+1 has run for m times with total
time m.
– Thus, mB time is for all other tasks.
– The available time between the first and the second T3m+1 is
B.
– The task set between them has total time bounded by B. Let
S1 denote the corresponding set in S, so ∑ s ∈ S1 v(s) ≦ B
– Similarly, ∑ s ∈ Si v(s) ≦ B for all 1 ≦ i ≦ m since T3m+1 has run
for m times
– On the other hand, ∑ s ∈ S1 v(s) + ∑ s ∈ S2 v(s) +…+ ∑ s ∈
Smv(s)=mB. One has that each ∑ s ∈ Si v(s)=B.
14
If direction
• When there is a feasible 3partition
solution,
– One can schedule T3m+1 at time 0, B+1,
2(B+1),…
– One then puts the other tasks according to
the 3partition solution
15
Download