MSML604_Homework_5
MSML604_Homework_5
Peeyush Dyavarashetty
07 March 2025
1 Question 1
1.1 Question 1.a
To check whether it is a convex optimization problem, we need to check 3 things
• The optimization variables are in Rn
det(P − λI) = 0
2−λ 4 6
=⇒ 4 6−λ 15 =0
6 15 32 − λ
=⇒ (2 − λ)((6 − λ)(32 − λ) − 225) − 4(4(32 − λ) − 90) + 6(60 − 6(6 − λ)) = 0
=⇒ λ3 − 40λ2 − 9λ + 74 = 0
The roots for this problem are λ ≈ −1.44, 1.27, 40.178, meaning that the eigen-
values are not convex, implying that the problem is not a convex optimization
problem.
Reference for roots: Wolfram alpha
1
4
5 P = np . a r r a y ( [ [ 2 , 4 , 6 ] , [ 4 , 6 , 1 5 ] , [ 6 , 15 , 3 2 ] ] )
6 q = np . a r r a y ( [ 5 , 7 , 6])
7 A = np . a r r a y ( [ [ 4 , 0.9 , 2] , [1.3 , 0.6 , 6 ] ] )
8 b = np . a r r a y ( [ 1 . 2 , 0.8])
9
10 # 0 . 5 ∗ xˆT P x + qˆT x
11 def objective (x) :
12 return 0 . 5 ∗ x .T @ P @ x + q .T @ x
13
14 # Ax − b <= 0
15 def inequality 1 (x) :
16 return − A @ x + b
17
18 # x >= 0
19 def inequality 2 (x) :
20 return x
21
22 # x 1 + x 2 + x 3 = 1
23 def equality (x) :
24 r e t u r n np . o n e s ( shape=x . shape ) . T @ x − 1
25
26 bound = (−np . i n f , np . i n f )
27 min values = minimize (
28 f u n=o b j e c t i v e ,
29 x0= 1 . 0 ∗ np . o n e s ( shape =3) ,
30 bounds =[bound , bound , bound ] ,
31 c o n s t r a i n t s =({ ’ t y p e ’ : ’ eq ’ , ’ f u n ’ : e q u a l i t y } ,
32 { ’ type ’ : ’ ineq ’ , ’ fun ’ : i n e q u a l i t y 1 } ,
33 { ’ type ’ : ’ ineq ’ , ’ fun ’ : i n e q u a l i t y 2 })
34 )
35 print ( min values )
2 Question 2
2.1 Question 2.a
Given, Infection matrix = B
Curing rate matrix = ∆ = diag(δi )
2
Spreading rate ∝ λmax (B − ∆)
Budget in increase of curing rate = bT
Curing rate increment cost for an individual = ci
Now, consider the weights wi , which mean an increase in the curing rate of
individual i. The increments can be wi ≥ 0 and W = diag(wi , i ∈ [n]). Now,
the problem becomes
3 Question 3
T
Consider the lagrange multipliers λ = λ1 λ2 . . . λn and v
T
For x = x1 x2 . . . xn and f0 (x) = xT log(x), where
T
log(x) = log(x1 ) log(x2 ) . . . log(xn ) , Now, the dual function is
3
Now,
∇x L(x, λ, v) = log(x) + 1 + AT λ + v 1 = 0
=⇒ log(x) = −AT λ − (1 + v)1
T
λ−(1+v)1
=⇒ x = e−A
a1
a2
. ea1
..
ea2
where e am = . . Here, we know that
.
.
eam
1T · x = 1
λ−(1+v)1
=⇒ 1T · e−A
T
=1
=⇒ e(1+v) = 1T · e−A
T
λ
=⇒ v = −1 + log(1T · e−A
T
λ
)