Question 4 (Pseudo-Code of Two-Opt Algorithm) (24 points) (8 points each) 2-opt Pseudo Code (Time Critical...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 4 (Pseudo-Code of Two-Opt Algorithm) (24 points) (8 points each) 2-opt Pseudo Code (Time Critical Part) // city [i] is ith city (permutation array) #define dist (a, b) dmat [city [a]] [city [b]] do { Distance matrix: 0(n) time and space minchange = 0; for (i = 0; i < cities-2; i++) { Doubly-nested for loop for (j=i+2; j change) { minchange = change; mini= i; minj = j; } } } // apply mini/minj move while (minchange < 0); It suffices to compute change in length: O(1) time O(n) iterations needed to reach local minimum: overall algorithm is O(n) A) How can you terminate the algorithm that is given above. List at least 2 different termination conditions. B) Suppose the first two-opt move that improves the objective function value can be directly adopted at each iteration of the algorithm. That is we do not need to find the best two-opt as it is given in the pseudo code. How should we update the algorithm to do that? C) We want to adopt two-opt moves that improves objective function value at least 5% at each two- opt iteration of the algorithm. How should we update the algorithm to do that? Question 4 (Pseudo-Code of Two-Opt Algorithm) (24 points) (8 points each) 2-opt Pseudo Code (Time Critical Part) // city [i] is ith city (permutation array) #define dist (a, b) dmat [city [a]] [city [b]] do { Distance matrix: 0(n) time and space minchange = 0; for (i = 0; i < cities-2; i++) { Doubly-nested for loop for (j=i+2; j change) { minchange = change; mini= i; minj = j; } } } // apply mini/minj move while (minchange < 0); It suffices to compute change in length: O(1) time O(n) iterations needed to reach local minimum: overall algorithm is O(n) A) How can you terminate the algorithm that is given above. List at least 2 different termination conditions. B) Suppose the first two-opt move that improves the objective function value can be directly adopted at each iteration of the algorithm. That is we do not need to find the best two-opt as it is given in the pseudo code. How should we update the algorithm to do that? C) We want to adopt two-opt moves that improves objective function value at least 5% at each two- opt iteration of the algorithm. How should we update the algorithm to do that?
Expert Answer:
Answer rating: 100% (QA)
A Two different termination conditions for the algorithm 1 Set a maximum number of iterations after ... View the full answer
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
Histogram. Suppose that the standard input stream is a sequence of double values. Write a program that takes an integer n and two real numbers lo and hi as command-line arguments and uses StdDraw to...
-
When a charged balloon sticks to a wall, the downward gravitational force is balanced by an upward static friction force. The normal force is provided by the electrical attraction between the charged...
-
Collins Computer Timeshare entered into the following transactions during May 2020. 1. Purchased computers for R$20,000 from Digital Equipment on account. 2. Paid R$4,000 cash for May rent on storage...
-
What is the primary source of directional stability in an aircraft?
-
Omar Marquez is the audio engineer for Summer Musical Enterprises. The group is considering the purchase of a new sound system consisting of five separate components. The components are arranged in...
-
Describe how organizations, utilize approaches and methods that drive forward the design of the employee experience, improve productivity, and enable high-performing talent practices to be...
-
Question 1 A manufacturer of mens shirts determines that her costs will be $500 for overhead plus $9 for each shirt made. Her accountant has estimated that her selling price p should be determined by...
-
Explain Develops financial documentation for organizational decision-makers and interpret large amounts of accounting reports for future financial decisions.
-
How black lives matter movement relates to recruitment and selection of employees
-
In the new normal, companies may become more innovative by building an Agile foundation. This crisis has proven that adaptability is a key element for operational function and survival. write...
-
What is the purpose of the cashbooks in an agency trust account System? Describe what information must be recorded in the cashbooks and what the relationship is to the deposit-taking institutions...
-
Question 1) List 2 planned experience you do that will foster creativity in children you are required to allow children to be exposed to Aboriginal and/or Torres Strait Islander peoples' art forms...
-
Terminal velocity of a solid spherical particle falling in fluid media can be expressed by the equation 49(p,-p)D, 3Cpp where v is the terminal velocity (m/s), g is gravitational acceleration (m/s"),...
-
If a and b are positive numbers, find the maximum value of f ( x ) = x a (9 x ) b on the interval 0 x 9.
-
A mergeable heap supports the following operations: MAKE-HEAP (which creates an empty mergeable heap), INSERT, MINIMUM, EXTRACT-MIN, and UNION. 1 Show how to implement mergeable heaps using linked...
-
Many divide-and-conquer algorithms that operate on graphs require that the graph be bisected into two nearly equal-sized subgraphs, which are induced by a partition of the vertices. This problem...
-
Draw the binary tree rooted at index 6 that is represented by the following attributes: index key left right 1 12 7 3 2 15 8 NIL 3 4 10 NIL 4 10 5 9 2 NIL NIL 18 1 4 7 7 NIL NIL 8 14 2 9. 21 NIL NIL...
-
a. Assume that \(y_{1}, \ldots, y_{n}\) are i.i.d. with a negative binomial distribution with parameters \(r\) and \(p\). Determine the maximum likelihood estimators. b. Use the sampling mechanism in...
-
For the data in Table 12.1, confirm that the Pearson statistic in equation (12.3) is 41.98 . Table 12.1 (12.3) Count Observed (j) (nj) Fitted Counts Using the Poisson Distribution (np;) 01234 6,996...
-
Show that the log-likelihood in equation (12.2) has a maximum at \(\widehat{\mu}=\bar{y}\). n L() Inf(y,) = (-+y; In - In y;!). i=1 i=1 (12.2)
Study smarter with the SolutionInn App