ArticleslgStudy

computer science

Line search

Line search is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Line search rather than just read about it. In short: In optimization, line search is a basic iterative approach to find a local minimum x ∗ {\displaystyle \mathbf {x} ^{*}} of an objective function f : R n → R {\displaystyle f:\mathbb {R} ^{n}\to \mathbb {R} } . It first finds a descent direction along which the objective function f {\displaystyle f} will be reduced, and then computes a step size that determines how far x {\displaystyle \mathbf {x} } should move along…

Key takeaways

  • Line search belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Line search to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Line search from memory before moving on to harder problems.

Reference excerpt

In optimization, line search is a basic iterative approach to find a local minimum x ∗ {\displaystyle \mathbf {x} ^{*}} of an objective function f : R n → R {\displaystyle f:\mathbb {R} ^{n}\to \mathbb {R} } . It first finds a descent direction along which the objective function f {\displaystyle f} will be reduced, and then computes a step size that determines how far x {\displaystyle \mathbf {x} } should move along that direction. The descent direction can be computed by various methods, such as gradient descent or quasi-Newton method. The step size can be determined either exactly or inexactly.

One-dimensional line search Suppose f is a one-dimensional function, f : R → R {\displaystyle f:\mathbb {R} \to \mathbb {R} } , and assume that it is unimodal, that is, contains exactly one local minimum x* in a given interval [a,z]. This means that f is strictly decreasing in [a,x*] and strictly increasing in [x*,z]. There are several ways to find an (approximate) minimum point in this case.

Zero-order methods Zero-order methods use only function evaluations (i.e., a value oracle) – not derivatives:

Ternary search: pick some two points b,c such that a<b<c<z. If f(b)≤f(c), then x* must be in [a,c]; if f(b)≥f(c), then x* must be in [b,z]. In both cases, we can replace the search interval with a smaller one. If we pick b,c very close to the interval center, then the interval shrinks by ~1/2 at each iteration, but we need two function evaluations per iteration. Therefore, the method has linear convergence with rate 0.5 ≈ 0.71 {\displaystyle {\sqrt {0.5}}\approx 0.71} . If we pick b,c such that the partition a,b,c,z has three equal-length intervals, then the interval shrinks by 2/3 at each iteration, so the method has linear convergence with rate 2 / 3 ≈ 0.82 {\displaystyle {\sqrt {2/3}}\approx 0.82} . Fibonacci search: This is a variant of ternary search in which the points b,c are selected based on the Fibonacci sequence. At each iteration, only one function evaluation is needed, since the other point was already an endpoint of a previous interval. Therefore, the method has linear convergence with rate 1 / φ ≈ 0.618 {\displaystyle 1/\varphi \approx 0.618} . Golden-section search: This is a variant in which the points b,c are selected based on the golden ratio. Again, only one function evaluation is needed in each iteration, and the method has linear convergence with rate 1 / φ ≈ 0.618 {\displaystyle 1/\varphi \approx 0.618} . This ratio is optimal among the zero-order methods. Zero-order methods are very general – they do not assume differentiability or even continuity.

First-order methods First-order methods assume that f is continuously differentiable, and that we can evaluate not only f but also its derivative.

The bisection method computes the derivative of f at the center of the interval, c: if f'(c)=0, then this is the minimum point; if f'(c)>0, then the minimum must be in [a,c]; if f'(c)<0, then the minimum must be in [c,z]. This method has linear convergence with rate 0.5.

Curve-fitting methods Curve-fitting methods try to attain superlinear convergence by assuming that f has some analytic form, e.g. a polynomial of finite degree. At each iteration, there is a set of "working points" in which we know the value of f (and possibly also its derivative). Based on these points, we can compute a polynomial that fits the known values, and find its minimum analytically. The minimum point becomes a new working point, and we proceed to the next iteration:

Newton's method is a special case of a curve-fitting method, in which the curve is a degree-two polynomial, constructed using the first and second derivatives of f. If the method is started close enough to a non-degenerate local minimum (= with a positive second derivative), then it has quadratic convergence. Regula falsi is another method that fits the function to a degree-two polynomial, but it uses the first derivative at two points, rather than the first and second derivative at the same point. If the method is started close enough to a non-degenerate local minimum, then it has superlinear convergence of order φ ≈ 1.618 {\displaystyle \varphi \approx 1.618} . Cubic fit fits to a degree-three polynomial, using both the function values and its derivative at the last two points. If the method is started close enough to a non-degenerate local minimum, then it has quadratic convergence. Curve-fitting methods have superlinear convergence when started close enough to the local minimum, but might diverge otherwise. Safeguarded curve-fitting methods simultaneously execute a linear-convergence method in parallel to the curve-fitting method. They check in each iteration whether the point found by the curve-fitting method is close enough to the interval maintained by safeguard method; if it is not, then the safeguard method is used to compute the next iterate.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Line search

Start with the simplest possible case. Write down what Line search claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Line search before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Line search ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Line search

In research
Line search appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Line search in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Line search is common in secondary-school and first-year university syllabi. It links to neighbouring topics Optimization algorithms and methods, so understanding it makes those chapters shorter.
In everyday life
Look for Line search outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Line search in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Line search means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Line search out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Line search in simple terms?

In optimization, line search is a basic iterative approach to find a local minimum x ∗ {\displaystyle \mathbf {x} ^{*}} of an objective function f : R n → R {\displaystyle f:\mathbb {R} ^{n}\to \mathbb {R} } . It first finds a descent direction along which the objective function f {\displaystyle f}…

Why does Line search matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Line search?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Line search.

Tags

  • Optimization algorithms and methods

Keep exploring