Applied Optimization with Julia
University of Hamburg
After this lecture, you will:
= operatorYou can use the typeof function to check the type of a variable.
[ and ] operatorsYou can use the push! function to add elements to a vector or the pop! function to remove elements from a vector.
== checks if two values are equal!= checks if two values are not equal< and > check if one value is smaller or greater than the other<= and >= also allow the two values to be equal&& is true if both conditions are true|| is true if at least one of two conditions is truefor loop repeats code for a fixed number of timeswhile loop repeats code as long as a condition is trueif executes code if a condition is trueelseif checks a further condition if the previous one was falseelse executes code if none of the conditions were trueConditionals are not loops: they decide whether code runs, while loops decide how often it runs.
keys and values return all keys and valuesElio's ID: 1001
Later in the course, we will use dictionaries to store and look up the data of our optimization models.
You can ask questions anytime in class or via email!
Question: Do we have to write all code ourselves?
DataFrames.jl for tables or Plots.jl for chartsPkg installs them for us:DataFrames.jl stores tabular data, like a spreadsheet in code| Row | product | price | sold |
|---|---|---|---|
| String | Float64 | Int64 | |
| 1 | apple | 0.5 | 120 |
| 2 | banana | 0.3 | 90 |
| 3 | cherry | 2.0 | 30 |
And that’s it for this lecture!
The remaining time we will already start working on this week’s tutorials.
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 III - Packages and Data Management | Dr. Tobias Vlćek | Home