Target audience

Academic/industrial CasADi users that want to get a deeper understanding of CasADi, in order to speed up existing applications or create advanced implementations. Unlike the Hands-on CasADi course on optimal control, there is no focus on mathematics.


CasADi?

Originating from KU Leuven’s “Optimization in Engineering Center” under guidance of prof. Moritz Diehl, CasADi [1] is an open-source software framework for nonlinear optimization and algorithmic differentiation. It facilitates rapid - yet efficient - implementation of different methods for numerical optimal control, both in an offline context and for nonlinear model predictive control.


Tutor

Joris Gillis obtained his PhD in electrical engineering at KU Leuven in 2015. Currently a post-doc at MECO, KU Leuven and part-time freelancer through Yacoda, he pursues large-scale applications in optimal control and is highly active as a main developer of CasADi since 2010.

[1] Joel A. E. Andersson, Joris Gillis, Greg Horn, James B. Rawlings, M. Diehl, “CasADi – A software framework for nonlinear optimization and optimal control,” Mathematical Programming Computation, 2018.


Covered topics

SX and MX expression graphs - benchmarking and debugging - thread-safety and parallelisation - code generation API and C API - memory/speed trade-offs and algorithmic differentiation

Format

This self-paced online course is a 1-to-1 reflection of the live course taught in Leuven, Belgium. Seminars paired with computer exercises. The seminars provide a view on advanced CasADi techniques. The computer exercises aim to internalize these techniques, and leave the participants well-equipped to apply them on their own applications.

Prerequisites

Basic programming skills are assumed. Exercises will build upon boilerplate codes in Python/Matlab, C and C++. Familiarity with CasADi is assumed.


Practicalities

You may use the comments in each module to ask questions on the course content. Following the course properly (i.e. doing the exercises and watching all 10 hours of video material) will take approximately 3 days.

A working installation of either Matlab or Python is needed, as well as a C compiler, and either Virtualbox or VMware Workstation Player.

Enrolling


For a 200 EUR academic discount at checkout, drop us a mail at [email protected] from your academic address.

Questions about the course? Contact us at [email protected] - certificates available upon request.

Prices excluding VAT.

Preview

Visit module 2 on "debugging" to see if the teaching style matches your expectations.

Module 1: CasADi expression graphs and Functions: recap and internals

  • Get a clear mental image on basic CasADi concepts
  • Get acquainted with a consistent vocabulary to talk about CasADi concepts

Module 2: Debugging CasADi expression graphs and Functions

  • Learn how to introspect the numerical evaluation of symbolic expression graphs

Module 3: CasADi for-loop equivalents: map and mapaccum

  • Learn how expression graph sizes can be reduced with map and mapaccum
  • Learn how to apply a CasADi Function on a range of inputs (broadcasting)
  • Learn the different flavours of the map command

Module 4: Saving and loading CasADi objects

  • Learn how to load/save CasADi Functions
  • Learn how to load/save expression graphs
  • Learn how to load/save objects of your class with CasADi members

Module 5: Internals of CasADi expressions graphs and Functions

  • Get an initimate understanding of MX versus SX
  • Learn how the CasADi virtual machine works
  • Get a basic understanding of CasADi source code structure

Module 6: Benchmarking: how to identify computational bottlenecks in your CasADi code

  • Understand how non careful benchmarking can easily lead to wrong conclusion
  • Learn how to hunt for computational bottlenecks in CasADi expression graphs

Module 7: Representation of sparse matrices in CasADi

  • Understand how compressed column storage works
  • Understand how CasADi encodes sparsity

Module 8: Using code generated by CasADi in third-party applications

  • Understand the API of CaADi generate code
  • Practice the usage of generated code with concrete compilation
  • Learn to use generated code with dependencies

Module 9: Calling the CasADi virtual machine from C

  • Understand the differnce between code generation and C API
  • Learn how to use the C API from a concrete example

Module 10: Parallelization of CasADi computations

  • Learn how to call CasADi Functions in parallel
  • Learn how to parallelize parts of a CasADi expression graph

Module 11: Algorithmic differentiation of algorithms

  • Derive reverse mode from scratch using only high-school level insight
  • Get acquainted with forward and reverse mode sensitivity functions
  • Understand how forward and reverse mode sensitivity functions can be used to construct Jacobians
  • Understand the impact of CasADi concepts on the cost of a Jacobian
  • Get an idea of heuristics in CasADi governing the choice between forward and reverse mode

Module 12: Using CasADi callbacks for embedding custom code

  • Learn how to deal with code that is not compatible with CasADi
  • Learn how to use finite differences for custom code
  • Learn how to specify extact derivatives for custom code

Module 13: Linking CasADi to compiled C code

  • Learn how to introduce compiled C code into a CasADi graph
  • Understand how CasADi reads meta-data from shared libraries
  • Understand how meta-data can impact performance
  • Learn to use 'jit' option for simple speed-ups

Module 14: A synthesis exercise of advanced CasADi concepts

  • Understand how derivatives of maps are computed
  • Understand how the use of a hierarchy of Funcitons impacts the runtime of derivatives.


Related courses


Prefer attending a physical event? Check the events page.