Applied Optimization with Julia
University of Hamburg
After this lecture, you will have:
To prepare for the upcoming lectures, we start by installing the Julia Programming Language and an Integrated Development Environment (IDE) to work with Julia.
juliaupIf you are ever asked to add something to your “PATH”, do so!
brew install --cask zed (or the installer from zed.dev)curl -f https://zed.dev/install.sh | shOn Windows, Zed needs a DirectX-11-capable GPU. If it only shows a blank window, use VS Code with the “Julia (Julia Language Support)” extension instead: everything in this course works there too.
Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS)Hello World!
julia test.jlHello World! → perfect!Don’t worry if it is not running right away. We will fix this together!
Question: What will your savings be worth in 10 years?
Value after 10 years: 1343.92
.jl file in Zed, run cell by cellIf you use .jl files, you can also put them under version control with Git, as you will see later in this lecture.
Julia on the right.jl file and save it# %% markers, ready to run cell by celltutorial_v1.jl and tutorial_v2.jlIf you have any questions, feel free to ask!
Git is not required for the course, but strongly recommended: once you get used to it, it becomes invaluable, especially if you are working with a lot of code!
git init in a terminal in that folderYou can also synchronize your repository with GitHub or other hosting services. Then, your code is saved in a remote location, making it accessible from anywhere and allowing collaboration with others.
.jl file)Cmd+Enter (macOS) or Ctrl+Enter to commitStart using Git from day one! Even for small projects, it’s a good habit to develop.
You would rather work alone? That is fine too: you are then a group of one.
.jl files and keep their file namesDon’t forget to save your files before uploading them to Moodle!
The assignments are not mandatory, but highly recommended!
The full rules are in the AI policy on the course website.
Dictionaries will become important later: they are how we will store and look up the data of our optimization models.
And that’s it for this lecture!
The remaining time we will already start working on the first problems.
Lauwens, B., & Downey, A. B. (2019). Think Julia: How to think like a computer scientist (First edition). O’Reilly®. Link to the free book website.
For more interesting literature to learn more about Julia, take a look at the literature list of this course.
Lecture II - First Steps in Julia | Dr. Tobias Vlćek | Home