Can Any One Convert This Pseudo Code in Matlab Code
Show older comments
Convert pseudo code to matlap and this is the code :
Algorithm 3 Iterative Target-Oriented Algorithm (ITOA)
Input: S= set of cameras; T = set of targets; P= set of discrete pans;
K= No. of set covers Output: C=Collection of Set Covers C1, C2....CK
1: SENSORS= S
2: /*SENSORS keeps track of the list of unused sensors */
3: k = 0
4: while SENSORS 6= ∅ do
5: /* a new set cover Ck will be formed */
6: k= k + 1
7: Ck=∅
8: TARGETS= T
9: /*TARGETS contains the uncovered targets */
10: while TARGETS 6= ∅ do
11: /* more targets have to be covered */
12: Find Dmin = minD(t) : t ∈ T
13: if |Dmin| = 0 then
14: /*TARGETS contains some uncoverable targets*/
15: goto marker
16: else
17: S ′ = ∅
18: Find the targets having cardinality equals Dmin and create a set T ′
19: for each t ∈ T ′
20: for each (si , pj) ∈ Φ −1 (t)
21: S ′ = S ′ ∪ {(si , pj)}
22: Find the most contributing (su, pv) such that:
23: (su, pv)←argmaxsu∈S’,1≤v≤qΦuv∩TARGETS
24: /* selects (su, pv) covering maximum targets */
25: In case of tie, create a subset S ′′ ⊆ S ′ with all sensor-pan pairs having same contribution
26: Let (si , pj ) ∈ S ′′ has the maximum force F ′ ij among all sensor-pan pairs in S ′′, i.e.:
27: F ′ ij = argmaxvFuv; ∀su ∈ S; ∀pv ∈ P; ∀si ∈ S; ∀pj ∈ P;
28: Ck = Ck ∪{(si , pj )}
29: SENSORS = SENSORS \ {si}
30: TARGETS = TARGETS \ {Φij}
31: end if
32: end while
33: C = C ∪ Ck
34: end while
35: marker: return the collection of set covers C
3 Comments
Rik
on 25 Mar 2019
Have a read here (or here for more general advice). It will greatly improve your chances of getting an answer.
Image Analyst
on 25 Mar 2019
Can't you tackle it one line at a time.
Also, what do you think "SENSORS 6= ∅ do 5" means? I have no idea.
madhan ravi
on 26 Mar 2019
This is not a homework service.
Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!