Lecture IV - Modelling with JuMP

Applied Optimization with Julia

Author
Affiliation

Dr. Tobias Vlćek

University of Hamburg - Fall 2024

Quick Recap from last Week

Functions

  • Functions are reusable blocks of code
  • Define functions using the function keyword
  • Functions can take arguments and return values
  • Use return to specify the output of a function

. . .

Tip

You can create anonymous functions using the -> syntax for quick, one-off operations.

Packages

  • Packages extend Julia’s functionality
  • Use using Pkg to access package management
  • Install packages with Pkg.add("PackageName")
  • Import packages with using PackageName or import PackageName

DataFrames

  • DataFrames are used for working with tabular data
  • Create DataFrames using the DataFrame constructor
  • Access columns using dot notation or square brackets
  • Perform operations on columns and rows

. . .

Tip

Use describe(df) to get a quick summary of your DataFrame.

Input/Output (IO)

  • IO operations allow reading from and writing to files
  • Reading and writing CSV files can be done with the CSV package
  • Use CSV.read() to read a CSV file into a DataFrame
  • Use CSV.write() to write a DataFrame to a CSV file

Plots

  • Plotting in Julia is done through packages like Plots.jl
  • Create basic plots with functions like plot(), scatter(), bar()
  • Customize plots with attributes like title, xlabel, ylabel

. . .

Tip

Explore different plot types and in the long term even backends for various output formats and interactivity.

Solutions from last Week

  • The tutorials from last week will again be available on Friday
  • You can access them in the project folder on Github
  • Click on the little cat icon on the bottom right

. . .

Tip

You can ask questions anytime in class or via email!

Five Tutorials for this Week

Topics of the Tutorials

  • JuMP: Learn how to use JuMP to define optimization problems
  • Variable Bounds: Learn how to set variable bounds
  • Constrains: Learn how to add constraints to your model
  • Advanced Modeling: Learn how to model more complex problems
  • Transport Problem: Learn how to solve a transportation problem

Get started with the tutorials

  • Download this weeks tutorials and start with the first one
  • Remember, you can ask questions anytime!

. . .

And that’s it for this lecture!

The remaining time we will already start working on the problems of the fourth lecture. From next week, we will start with different optimizations problems and topics, that we address together in the course.

Literature

Literature

For more interesting literature to learn more about Julia, take a look at the literature list of this course.