# 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[1] + x[2]) # Add objective @constraint(ro, 21.94174*x[1] + 4.38476*x[2] + 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[1] + xnom[2]) # Add objective @constraint(nom, 21.94174*xnom[1] + 4.38476*xnom[2] <= 200) # Add nominal constraint solve(nom) # Solve the model obj_nom = getobjectivevalue(nom) # Obtain the objective value and solution x_nom = getvalue(xnom)