[Solved]105753581 Courses Comp202 201 819 Programm Ng Assignment 3 281 29 Pdf Https Vital Acuk Bbc Q37242060
In java please




← → α 105753581/courses/COMP202-201 819/Programm ng Assignment 3%281%29 pdf ☆ ǐ https:/ vital. ac.uk/bbcswebdav/pid 184 1 166 dt content-r d Progra 3(1).pdf Problem Description I introduce here a problem of a paritioning type, which I will call Grouping Monotone Se Yon are given as input a sequence of n positive inte- gers a1,a…..an and a posilive integerks We assue that the iuput serInence. is sorted in non-decresing order, that is, α1- -…-an. Given a group ol cosecutive mbers a,,a+. a for a starting index i and end index j, with ij. we call the cost of group a,, ,aj, ,1, is the average of gronp ai,ai+1…。,aji note that j i,at1.aj. Your task is to i i 1 ís the size of group ,an into k groups of consocutive numbers, that is, as they appear in the input order group these numbers α1.a2 a1,a2,… ,a, s that total sum of costs of all k groups is minimsed 1 cutting positions 1 More formally, yon have to decide the k i2 < i1 < «ik-1-n-1, where (we assume below that io = 1): group Ci is defined s Gi a1,a2ai and its cost is eost(G) group Gj, for j = 2,3, . .. , k-1, is defined as and its ust is costG)ii, a, where wei-i +1 Gk is defined as G- (m-i+1, a4-M. an) and its cost is Then, this grouping has the value of the objective function (the total cost) equal to 07:02 L/ 4- ENG 23/04/2019 ← → α 105753581/courses/COMP202-201819/Programm ng Assignment 3%281%29.pdf ☆ ǐ https:/ vital. ac.uk/bbcswebdav/pid 184 1 166 dt content-r d Programming_Assignment 3(1).pdf Then, this roupng has he value ol e oelie funclion (lhe tolal co) equal to j-1 Your goal is to find such grouping into k (non-empty) groups so that this objective function is minimised, and then output the vale of this objectivn function (which will be non-negative). Suppose, for instance, that n = 5 and k = 3 and that the input sequence is: 45711 21 that is, a-4,,7,a4 11,21. Then, or example, setting the k-12 ing positions as follows 4 57 11 21, defines the following grouping into k 3 groups Gi4), G2 Gs = {7, 11, 21). The costs of these groups are as follows: 5) 07:02 L 4-さENG 23/04/2019 ← → α 105753581/courses/COMP202-201819/Programm ng Assignment 3%281%29.pdf ☆ ǐ https:/ vital. ac.uk/bbcswebdav/pid 184 1 166 dt content-r d Programming Assignment 3(1).pdf Suppose, for instan, that 5 and k 3 ad that the input sequence is: 15 7 11 21 that is. 41 = 4.02 = 5.as = 7-04 = 11, as = 21. Then. for example, setting the k-1-2 cutting positions as follows 113 7 11 21 defines the following grouping into k3 groups G4), G2f5] Gs = {7, 11, 21). The costs of these groups are as follows: Gi:ave114,cost(G) (4-4)0 G2 : ตสาม = 5.ost(,) = (5-5). O Gs: aves(7+11+21)/3 13, cost (Gs) (7-13)2+(11-13)2+(21-13)2 so the objective vale of this grouping (the total cost of the grouping) is cost G1)+cost G2)+cost(Gs) (7-13)+(11-13)+(21-13)2 36+464 104. Observe that there is a much better grouping solution here, with the following grouping 45 7 11 21, where the k3 groups are Gi 4,5,7GG321). The costs of tlbese groups are as follows: G:aveLa- 16/3, cost(G)-(4-16/3)+5-16/3)+(7-16/3)2-14/3 G2:av4 11, cost(Ga) (1 1) o Ga:aes 21, cost(G3)-(21-21)-0, 1 so the objective value (the total cost) of this grouping is cost Gi) +cost(G2) +cost(Ga) 14/3 R 4.6666… It can be cbecked that this is the optimal grouping, tat i 14/3 is the smallest poesible value of the objective function among all possible groupings 07:02 L 4-จั; ENG 23/04/2019 ← → α 105753581/courses/COMP202-201819/Programm ng Assignment 3%281%29 pdf ☆ ǐ https:/ vital. ac.uk/bbcswebdav/pid 184 1 166 dt content-r d Programming Assignment 3(1).pdf dataOne.txt and in dataTwo.txt (dataTwo.txt contains also solutions). Obeerve that the input scqucnoe a…..a st be sorted and that the same consecutive integers are also allowed. You are not supposed to change the order of these numbers, but only find appropriate k 1 cut points that define the kgroups (each group must be non-empty, that is, must contain at least one number). The task is, given any sorted soquence of n (strictly) positive integers and kn, find the grouping that has the smallest possible objective function value. Also obscrve that it is possible that kn in thoe input to this problen it is impossible that k> hough In that c there only cxists a single grouping and the oost of this grouping is 0 (zcro). You should write a procedure that for any given inputequence of n sorted positive integersultiple indentical numbers allowed) and any given finds a grouping with mini value of the objective function value Your procedure should ouly output the value of the objective of this optimal solution (grouping) that only is the integral part of this value. That is, it slhould compute the grouping with minimu possible value of the objective function among all possible groupings, and then output the objective value (its integral part) of this optimal grouping. Additionally, you should include a brief idea of your solution in the commented text in your code and yon should also include a short analysis and justification o the running time of your procedure. These descriptious are part of the assessment of your solution Hints You are supposed to solve the Grouping Monotoue Sequence problem by dynamic programming. Observe that in this problem we have two kinds of objects to maintain: the numbers an and groups Gi…. G which suggests that the dynamic programming solution should involve two kinds of indices. Let CU,) denote the minimum objertive function vale of the grouping of ,a,a into groups. Try to express Cj,) by using values C(,) for some values j’ <je<. These hints should lead to an appropriale rcurrece solution othe problem which hen you should translate into a sequentinl solution that fills in this dynamic programming lable in au appropriale way. Programming Language L 4-さENG 23/04/2019 Show transcribed image text ← → α 105753581/courses/COMP202-201 819/Programm ng Assignment 3%281%29 pdf ☆ ǐ https:/ vital. ac.uk/bbcswebdav/pid 184 1 166 dt content-r d Progra 3(1).pdf Problem Description I introduce here a problem of a paritioning type, which I will call Grouping Monotone Se Yon are given as input a sequence of n positive inte- gers a1,a…..an and a posilive integerks We assue that the iuput serInence. is sorted in non-decresing order, that is, α1- -…-an. Given a group ol cosecutive mbers a,,a+. a for a starting index i and end index j, with ij. we call the cost of group a,, ,aj, ,1, is the average of gronp ai,ai+1…。,aji note that j i,at1.aj. Your task is to i i 1 ís the size of group ,an into k groups of consocutive numbers, that is, as they appear in the input order group these numbers α1.a2 a1,a2,… ,a, s that total sum of costs of all k groups is minimsed 1 cutting positions 1 More formally, yon have to decide the k i2
Expert Answer
Answer to ← → α 105753581/courses/COMP202-201 819/Programm ng Assignment 3%281%29 pdf ☆ ǐ https:/ vital. ac.uk/bbcswebdav/… . . .
OR

