#### PhD Thesis: Julia code in Chapter 1

Throughout my thesis I use JuMP, a modeling language for mathematical optimization embedded in Julia. On this page I present the code for two examples that I use in the introduction of my thesis. The material below is free to use in other lectures or programs with reference to the original source.

The raw code from the small robust optimization example is also given below to copy-paste.
``````
# Models for introduction thesis Frans de Ruiter, 2017 CC.

# Load packages JuMP and wrapper for Gurobi
using JuMP, Gurobi

ro = Model(solver=GurobiSolver())           # Define robust optimization model with solver
@variable(ro, x[1:2] >= 0)                  # Add variable
@objective(ro, Max, 5*x + x)          # Add objective
@constraint(ro, 21.94174*x + 4.38476*x
+ 1/sqrt(2)*norm(x) <= 200)                # Add (robust counterpart) constraint
solve(ro)                                   # Solve the model
obj_ro  = getobjectivevalue(ro)             # Obtain the objective value and solution
x_ro    = getvalue(x)

#----------------------------------------
# The same as above, but now for the nominal model
nom = Model(solver=GurobiSolver())          # Define nominal optimization model with solver
@variable(nom, xnom[1:2] >= 0)              # Add variable
@objective(nom, Max, 5*xnom + xnom)   # Add objective
@constraint(nom, 21.94174*xnom +
4.38476*xnom <= 200)                     # Add nominal constraint
solve(nom)                                  # Solve the model
obj_nom  = getobjectivevalue(nom)           # Obtain the objective value and solution
x_nom    = getvalue(xnom)
``````
For questions, see contact details on the homepage.