Tape file storage Optimization

Source: Internet
Author: User

tape file storage optimization
the algorithm provided in the book 4.5
is a greedy algorithm. The most important thing about greedy algorithms is to prove their correctness.
1. Prove greedy and selective.
set X = {x1, x2, X3 ,..., Xn} is an optimal solution. The length of job Xi is L [XI], and the probability of access is P [XI].
set Y = {y1, Y2, Y3 ,..., Yn} is a greedy solution. Where p [Yi]/L [Yi]> = P [Y (I + 1)]/L [Y (I + 1)].
If X and Y are identical, the greedy solution is an optimal solution.
If X and Y are different, set XI and Yi as the first different job. Set Yi to XJ in X.
X = x1, x2, X3,..., XI ,..., XJ ,..., XN
insert XJ to the front side of Xi, then x becomes
x' = x1, x2, X3 ,..., XJ, XI ,..., XN
the cost of X is E (x), and the cost of X is E (x ').
E (x')-E (x) = (P [XI] + P [x (I + 1)] +... P [x (J-1)]) * l [XJ]-(L [XI] + L [x (I + 1)] +... + L [x (J-1)]) * P [XJ] =
set xi <= XK <= x (J-1 ). According to the greedy solution of y, we can see that P [XJ]/L [XJ]> = P [XK]/L [XK], that is:
P [XJ] * l [XK]> = L [XJ] * P [XK]
E (x')-E (X) = Σ (P [XK] * l [XJ]-l [XK] * P [XJ]), xi <= XK <= x (J-1)
<= 0
therefore, x' is an optimal solution.
2. Verify the sub-structure
set X = {x1, x2, X3 ,..., Xn} is the optimal solution obtained by greedy algorithms. The optimal solution for the sub-problem after removing the last XN is subx = {x1, x2, X3 ,..., X (n-1 )}. If subx is not the optimal solution of a subproblem, assume that the optimal solution of the subproblem is y ', E (Y '0000xn) = E (y ') + (L [X1] + L [X2] +... + L [XN]) * P [XN]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.