Lecture5 - Computational Optimization ISE 407 Lecture 5 Dr...

Info icon This preview shows pages 1–9. Sign up to view the full content.

Computational Optimization ISE 407 Lecture 5 Dr. Ted Ralphs
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

ISE 407 Lecture 5 1 Reading for this Lecture Aho, Hopcroft, and Ullman, Chapter 1 Miller and Boxer, Chapters 1 and 5 Fountain, Chapter 4
Image of page 2
ISE 407 Lecture 5 2 Problems and Instances Roughly, a problem specifies what output is desired for each given input. In more rigorous mathematical terms, solving a problem can be equated to evaluating a (mathematical) function . A problem instance is to evaluate the given function for a specific input (argument). An algorithm is a procedure for converting the inputs to an output of the desired form (called a solution ).
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

ISE 407 Lecture 5 3 Simple Example Consider the following simple problem: Input : x R and n Z . Output : x n . What is the most straightforward algorithm for solving this problem? Is there a better algorithm?
Image of page 4
ISE 407 Lecture 5 4 A More Efficient Algorithm Let’s assume that n = 2 m for m Z . We can use repeated squaring: def pow(x, n): for i in range(log(n, 2)): x *= x Questions : Is this algorithm correct? How much more efficient is it? What do we mean by efficiency ? Why don’t we call it speed ? How do we modify it for the general case?
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

ISE 407 Lecture 5 5 Algorithms An algorithm is a procedure for evaluating the function associated with a given problem. In general, a problem will have more than one algorithm. How do we compare? Correctness (accuracy) Efficiency An algorithm that is guaranteed to result in a solution for every instance is said to be correct . In some cases, it is not possible to produce the solution exactly (problems with irrational solutions). In such cases, we generally want know how close the approximate solution is to the true solution. This is the domain of numerical analysis , which we will later in the course.
Image of page 6
ISE 407 Lecture 5 6 Example: Log Function in Python >>> math.log10(1000) 3.0 >>> math.log(1000, 10) 2.9999999999999996 Here, we are using two different algorithms for calculating the logarithm base 10 of 1000. One is more accurate than the other. We will look at issues of floating point error later in the course.
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

ISE 407 Lecture 5 7 Analyzing Algorithms The goal of analyzing algorithms is to determine the resources required to execute the algorithm in practice. Generally speaking, time and space are the two most important resources to consider. A simple approach to evaluating performance in practice would be to do an empirical analysis . Rigorous empirical analyses are more difficult than they appear because of factors that are difficult to take into account. What instances should we use to do the testing? How should we measure performance (CPU time, wallclock time)? How should we take into account performance variability?
Image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '13
  • TedRalphs
  • Optimization, Analysis of algorithms, Computational complexity theory, ISE

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern