PART A

Consider the NLP formulation below

  • Decision variables: $x_1,x_2$
  • Objective value: $z$

Formulation:

$$ \left.\begin{array}{rrcl} \min & 100(x_2-(\frac{1}{2}+x_1)^2)^2 + (1-x_1)^2 \\ \text {s.t.:} & & & \\ \text{(1)} & x_1 \geq 0\\ \text{(2)} & x_2 \geq 0 \end{array}\right\} $$

What is the (rounded) optimal solution?


In [24]:
using JuMP
m = Model()

# Adding variable
@variable(m, x[1:2] >= 0)
# Adding objective 
@NLobjective(m, Min, 100 * (x[2] - (1/2 + x[1])^2)^2 + (1 - x[1])^2)

solve(m)

@printf "Optimal Value: %0.2f\n" getobjectivevalue(m)
@printf "Optimal Solution: (%0.2f, %0.2f)\n" getvalue(x)[1] getvalue(x)[2]


Optimal Value: 0.00
Optimal Solution: (1.00, 2.25)

PART B

Consider the NLP formulation below

  • Decision variables: $x_1,x_2,x_3$
  • Objective value: $z$

Formulation: $$ \left.\begin{array}{rrcl} \min & (2x_1 + 3x_2 + 4x_3)^2 \\ \text {s.t.:} & & & \\ \text{(1)} & 10x_1 + 11x_2 + 12x_3 \leq 60\\ \text{(2)} & 21x_1 + 22x_2 + 23x_3 \leq 150\\ \text{(3)} & 21x_1 + 22x_2 -23x_3 \geq 110\\ \text{(4)} & 19x_1 + 34x_2 -32x_3 = 180 \\ \text{(5)} & x_1,x_2,x_3 \geq 0 \end{array}\right\} $$

What is the (rounded) optimal solution?


In [37]:
using JuMP
nm = Model()

@variable(nm, x[1:3] >= 0)

@constraints nm begin
    10x[1] + 11x[2] + 12x[3] <= 60
    21x[1] + 22x[2] + 23x[3] <= 150
    21x[1] + 22x[2] - 23x[3] >= 110
    19x[1] + 34x[2] - 32x[3] == 180
end

@NLobjective(nm, Min, (2x[1] + 3x[2] + 4x[3])^2)

solve(nm)

@printf "Optimal Value: %0.3f\n" getobjectivevalue(nm)
@printf "Optimal Solution: (%0.2f, %0.2f, %0.2f)\n" getvalue(x)[1] getvalue(x)[2] getvalue(x)[3]


Optimal Value: 252.249
Optimal Solution: (0.00, 5.29, 0.00)

PART C

Consider the maximization of the same NLP formulation

  • Decision variables: $x_1,x_2,x_3$
  • Objective value: $z$

Formulation:

$$ \left.\begin{array}{rrcl} \max & (2x_1 + 3x_2 + 4x_3)^2 \\ \text {s.t.:} & & & \\ \text{(1)} & 10x_1 + 11x_2 + 12x_3 \leq 60\\ \text{(2)} & 21x_1 + 22x_2 + 23x_3 \leq 150\\ \text{(3)} & 21x_1 + 22x_2 -23x_3 \geq 110\\ \text{(4)} & 19x_1 + 34x_2 -32x_3 = 180 \\ \text{(5)} & x_1,x_2,x_3 \geq 0 \end{array}\right\} $$

What is the rounded optimal solution?


In [38]:
using JuMP
nm = Model()

@variable(nm, x[1:3] >= 0)

@constraints nm begin
    10x[1] + 11x[2] + 12x[3] <= 60
    21x[1] + 22x[2] + 23x[3] <= 150
    21x[1] + 22x[2] - 23x[3] >= 110
    19x[1] + 34x[2] - 32x[3] == 180
end

@NLobjective(nm, Max, (2x[1] + 3x[2] + 4x[3])^2)

solve(nm)

@printf "Optimal Value: %0.3f\n" getobjectivevalue(nm)
@printf "Optimal Solution: (%0.2f, %0.2f, %0.2f)\n" getvalue(x)[1] getvalue(x)[2] getvalue(x)[3]


Optimal Value: 269.651
Optimal Solution: (0.00, 5.37, 0.08)

In [ ]: