0% found this document useful (0 votes)
15 views

MSML604_Homework_5

The document contains a homework assignment focused on convex optimization problems, including checks for convexity of objective functions and constraints. It also discusses the formulation of optimization problems related to infection and curing rates, as well as dual functions and Lagrange multipliers. The analysis includes mathematical proofs and Python code for optimization using the SciPy library.

Uploaded by

peeyu704
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

MSML604_Homework_5

The document contains a homework assignment focused on convex optimization problems, including checks for convexity of objective functions and constraints. It also discusses the formulation of optimization problems related to infection and curing rates, as well as dual functions and Lagrange multipliers. The analysis includes mathematical proofs and Python code for optimization using the SciPy library.

Uploaded by

peeyu704
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

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

• The objective function is convex.


• The inequality constraints are convex.
• the equality constraints are affine.

We know that the first condition is satisfied.


Now, checking whether the objective function is convex: Given, the cost
function is a quadratic function. So, to prove its convexity, we need to prove
P ⪰ 0 =⇒ xT P x ≥ 0 ∀x ∈ Rn . For that, checking the eigenvalues of P

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.2 Question 1.b


1 im po rt s c i p y a s sp
2 im po rt numpy a s np
3 from s c i p y . o p t i m i z e im por t m i n i m i z e

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 )

1 message : Optimization terminated successfully


2 success : True
3 status : 0
4 fun : 9 . 6 1 2 9 0 3 2 2 8 7 5 4 1 3 5
5 x : [ 9 . 6 7 7e - 0 2 9 . 0 3 2e - 0 1 -2 . 7 4 0e - 1 2 ]
6 nit : 2
7 jac : [ 8 . 8 0 6 e + 0 0 1 . 2 8 1 e + 0 1 2 . 0 1 3 e + 0 1 ]
8 nfev : 8
9 njev : 2
 
9.677e − 02
Reference: Google Colab The value of x =  9.032e − 01 
−2.740e − 12

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

minw1 ,w2 ,...,wn λmax (B − ∆ − W )


Xn
subject to wi ci − bT ≤ 0
i=1
− wi ≤ 0 ∀i ∈ [n]

This problem is convex because


• The weights wi ∈ [0, ∞) lives in convex set.
• The objective function is a convex function because B − ∆ − W is sym-
metric.

• Inequality constraints are affine. Proof:


Pn T
 T
– i=1 wi ci − bT = c w − bT , where c = c1 c2 . . . cn
– −wi = 1Ti w where 1i is an n × 1 matrix which contains only 1 in the
ith position and rest are all zeros.

2.2 Question 2.b


Consider the lagrange multipliers λ0 , λ1 , λ2 , . . . , λn . Now the dual function be-
comes
 X n 
maxλ infw∈D λmax (B − ∆ − W ) + (λ0 ci − λi )wi − λ0 bT
i=1
subject to λi ≥ 0 ∀i ∈ {0} ∪ [n]

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

max infx∈D L(x, λ, v) = f0 (x) + λT (Ax − b) + v(1T x − 1)


subject to λi ≥ 0 ∀i ∈ [n]

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
λ
)

Now, substituting the values in L(x, λ, v), we get

L(x, λ, v) = xT (−AT λ − (1 + v)1) + λT (Ax − b) + v(1T x − 1)


= −λT b − v − xT · 1
λ−(1+v)1
= −λT b − v − 1T · e−A
T

= −λT b − (−1 + log(1T · e−A


T
λ
)) − 1
= −λ b − log(1 · e
T
T T −A λ
)

Now, the dual problem is

maxλ − λT b − log(1T · e−A


T
λ
)
subject to − λi ≤ 0 ∀i ∈ [n]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy