#### Lectures: Prof. Dr. Moritz Diehl, Exercises: Florian Messerer

The course’s aim is to give an introduction into numerical methods for the solution of optimization problems in science and engineering. The focus is on continuous nonlinear optimization in finite dimensions, covering both convex and nonconvex problems. It is intended for a mixed audience of students from mathematics, engineering and computer science.

The course is organized as inverted classroom and based on four pillars:

- a course manuscript
- lecture recordings, and
- exercises, that are accompanied with solutions and solution recordings, and
- weekly alternating Q&A and exercise sessions to discuss the course contents

*Contact*: moritz.diehl@imtek.uni-freiburg.de, florian.messerer@imtek.uni-freiburg.de

**** This page is intended for the course as taught in the winter semester 2022/23 at the University of Freiburg.** For a timeless version with a focus on self study of the material see here. ****

### Organization of the course

*********************

*The exam date for the summer semester retake exam is August 17, 10am, in G.-Köhler-Allee 101, SR 01-009/13 (Faculty of Engineering)*

Further info see below.

*********************

The course is organized as flipped classroom. We provide recordings of the lecture and will meet once a week to discuss the course contents. This course has 6 ECTS credits. It is possible to do a project to get an additional 3 ECTS, i.e., a total of 9 ECTS for course+project. For more information please contact Florian Messerer.

**Hybrid meetings:** We will meet every **Friday, 14 to 16**. As far as possible, we will use a hybrid format, i.e., it will be possible to attend the meetings both in presence and remotely via Zoom:

- Room
- HS II, Albertstr. 23b (Institutsviertel)

- Zoom
- https://uni-freiburg.zoom.us/j/64027288972?pwd=SHpLa1Fqejd4MGxLbWU0Y1VXVmtydz09
- Meeting ID: 640 2728 8972
- Passcode: numopt2223

These meetings are alternatingly dedicated to either Q&A sessions with Prof. Diehl or exercise sessions with the teaching assistant (see calendar below), and will not be recorded.

**Ilias:** There is also an Ilias course, though most material will be published on the page you are currently viewing. In Ilias, we provide a forum for discussion of any questions you have related to the course, be it organization, content or exercises. Please feel free to open new topics and to answer questions of your fellow students. Further, the mid term quiz will be published on Ilias (see below).

Link to Ilias course:

https://ilias.uni-freiburg.de/goto.php?target=crs_2804374_rcodee59F8AxBbE&client_id=unifreiburg

**Lecture recordings:** The lecture recordings were already created in a past semester. There are 24 lectures of approximately 90 minutes each. You can find the recordings below in the materials section, and a recommended schedule in the calendar.

**Course manuscript:** The lectures are accompanied by a detailed course manuscript, which you may find in the materials section below. We will provide printed versions.

**Exercises:** The exercises are mainly computer based. Computers with (MATLAB or Python) and CasADi installed are required to solve them (see below for details). **The exercises are voluntary** (though of course we **strongly recommend **to solve them). Nonetheless we offer the possibility to hand them in to receive feedback, but for this please respect the deadlines you can find in the calendar below. If you would like feedback on a specific part of the exercise especially, you can state so on your solution sheet. To hand them in, send them in an email to florian.messerer@imtek.de.

**Q&A sessions:** Every second week there will be a virtual Q&A session with Prof. Diehl, where you can ask any questions about the course content. The format is meant to be highly interactive and depends strongly on your participation. We would recommend that while watching the video lectures or reading the course script, you write down any questions that come to your mind, such that you have them readily available for the Q&A sessions.

**Exercise sessions:** Every other week we will meet for the exercise sessions. They will not be used to show the solutions, but to discuss any questions related to the exercises. These can either be questions about the current exercise sheet or questions about the solution to the last sheet. As the Q&A sessions, this format depends heavily on your participation.

**Mid term quiz: **Some time before christmas, we will publish a quiz on Ilias, with questions covering the course contents so far. It is **obligatory** that you pass this quiz** until 9.12.22,** but you have infinitely many trials for doing so and will receive instant feedback by auto-grading. The quiz will be online at least one week before the deadline. Note that the questions will not necessarily be representative of an exam.

**Final evaluation:** The final exam is a written exam. Only pen, paper, a non-programmable calculator and two A4 sheets (i.e., 4 pages) of self-chosen content are allowed (handwritten). For students from M.Sc. MSE / ESE and B.Sc. Math, this exam is graded. Students from the M.Sc. Math need to pass the written exam in order to take the graded 11ECTS oral exam. Unmentioned special cases: Everyone who wants ECTS for this course needs to pass the exam.

**Projects:** *(more detail in a section below)* The optional project (3 ECTS) consists in the formulation and implementation of a self-chosen optimization problem or numerical solution method, resulting in documented computer code, a project report, and a public presentation. Project work starts in the last third of the semester. For students from the faculty of engineering the project is graded independently from the 6ECTS lecture. For students from the B.Sc. Math, the grade for the lecture&project 9ECTS module is solely determined by the written exam. For students from the M.Sc. Math the project is again a prerequisite to the graded 11ECTS oral exam.

### Calendar

Date |
Format |
Content |
Watch this week |
Prepare |
Deadlines |

21.10. | Intro | ||||

28.10. | Ex | Ex 1 | Lec. 1, 2 | one question | |

04.11. | Q&A | up to including Example 4.2 | Lec. 3, 4 | one question | Ex 1 (voluntary) |

11.11. | Ex | Ex 2; sol Ex 1 | Lec. 5, 6 | one question | |

18.11. | Q&A | up to including Chap. 8.1 | Lec. 7, 8 | one question | Ex 2 (voluntary) |

25.11. | Ex | Ex 3; sol Ex 2 | Lec. 9, 10 | one question | |

02.12. | Q&A | up to including Chap. 10.3 | Lec. 11, 12 | one question | Ex 3 (voluntary) |

09.12. | Ex | Ex 4; sol Ex 3 | Lec. 13, 14 | one question | mid term quiz (obligatory, until 23:59) |

16.12. | Q&A | up to including Chap. 12.7 | Lec. 15, 16 | one question | Ex 4 (voluntary) |

23.12. | *** | *** Christmas Break *** |
*** | *** | |

30.12. | |||||

06.01. | |||||

13.01. | Proj / Ex | Ex 5; sol Ex 4; proj | Lec. 17, 18 | one question | Project commitments |

20.01. | Q&A | up to including Chap. 14.1 | Lec. 19, 20 | one question | Ex 5 (voluntary) |

27.01. | Ex | sol Ex 5; proj | Lec. 21, 22 | one question | |

03.02. | Q&A | All course content; proj | Lec. 23, 24 | one question | |

10.02. | pres | project presentations |
|||

24.02. | none | no session, just a deadline | project report deadlines |

### Manuscript

The lectures are closely following a course manuscript draft.

Numerical optimization (draft manuscript) by M. Diehl

### Lectures

The video recordings correspond each to approximately 90 minutes, and comprise 24 lectures in total. A recommended schedule for watching can be found in the calendar above.

Lecture |
Content |

Lecture 1 | Introduction to Section 1.3 (Mathematical formulation) |

Lecture 2 | Section 1.4 (Definitions) to 2.7 (Mixed-Integer-Programming) |

Lecture 3 | Section 3.1 (How to check convexity) to 3.5 (Standard form of convex opt. problems) |

Lecture 4 | Section 3.6 (Semidefinite Programming) to Example 4.2 (Dual of LP) |

Lecture 5 | Example 4.3 (Dual decomposition) to Chapter 6 introduction |

Lecture 6 | Section 6.1 (Linear Least Squares) to 6.5 (L1-Estimation) |

Lecture 7 | Section 6.6 (Gauss-Newton method) to 7.2 (Local convergence rates) |

Lecture 8 | Section 7.3 (Newton-Type methods) to 8.1 (Local contraction) |

Lecture 9 | Section 8.2 (Affine invariance) to 9.1 (Line search) |

Lecture 10 | Section 9.2 (Wolfe conditions) to 9.3 (Global convergence of line search) |

Lecture 11 | Section 9.4 (Trust-Region methods) to 9.5 (The Cauchi-Point) |

Lecture 12 | Section 10.1 (Algorithmic Differentiation) to 10.3 (Backward AD) |

Lecture 13 | Section 10.4 to Chapter 11 introduction |

Lecture 14 | Section 11.1 (LICQ and linearized feasible cone) to 11.2 (SONC) |

Lecture 15 | Section 12.1 (Optimality conditions) to 12.5 (Constrained Gauss-Newton) |

Lecture 16 | Section 11.3 (Perturbation analysis) and 12.7 (Local convergence) |

Lecture 17 | Section 12.6 (General constrained NT-Algorithm) to 12.9 (Careful BFGS updating) |

Lecture 18 | Section 13.1 to 13.2 (Active constraints and LICQ) |

Lecture 19 | Section 13.3 (Convex Problems) |

Lecture 20 | Section 13.4 (Complementarity) to 14.1 (QPs via Active Set Method) |

Lecture 21 | Section 14.2 (SQP) to 14.4 (Interior Point methods) |

Lecture 22 | Section 14.4 (Barrier problem interpretation, SCP) to 15.5 (Simultaneous optimal control) |

Lecture 23 | Problem reformulations and useful function approximations |

Lecture 24 | Summary of the course |

### Exercises

The exercises are based partially on pen and paper and partially on (Matlab or Python) and CasADi (see below).

### Further Material

- Books
- Jorge Nocedal and Stephen J. Wright, Numerical Optimization, Springer, 2006
- Stephen Boyd and Lieven Vandenberghe, Convex Optimization, Cambridge Univ. Press, 2004
- Amir Beck, Introduction to Nonlinear Optimization, MOS-SIAM Optimization, 2014.

- sample exam recent
- PDF version of midterm quiz

### Project

You can find the project guidelines here.

### Software

The exercises lean heavily on the open source tool CasADi, which offers an interface to Python, Matlab, and Octave. The computer exercise templates as well as the code solutions will be published in Matlab and Python and we offer support for both. The solution videos however are based on the Matlab version.

**Python **is one of the major programming languages and via libraries such as NumPy and SciPy a common choice for scientific computing. Apart from CasADi, we will use the libraries NumPy, SciPy and Matplotlib. If you are completly new to Python, you may want to check out the Anaconda distribution.

**Matlab **is an environment for numerical computing based on a proprietary language that allows one to easily manipulate matrices and visualize data. The University of Freiburg offers a free-of-cost license to students and staff which can be obtained following the instructions here.

**CasADi** is a symbolic framework for algorithmic differentiation and numerical optimization. In order to install CasADi, follow the instructions here.

Matlab: Download the binaries for your platform and, after having extracted them, add their location to MATLAB's path. To test your installation run the simple example described at the provided link. If successful, save the path by executing the command *savepath*. In this way, the location of the binaries will be known even after restarting MATLAB.

Python: If you are using pip, you can simply *pip install casadi *in your preferred environment*. *If you are using Anaconda / conda for managing your environments, we suggest to first *conda install pip* inside a conda environment, followed by *pip install casadi*.