SlideShare ist ein Scribd-Unternehmen logo
1 von 42
CVXOPT:
A Python Based Convex
Optimization Suite

11 May 2012
Industrial Engineering Seminar
Andrew B. Martin
Easy and Hard
• Easy Problems - efficient and reliable
solution algorithms exist
• Once distinction was between
Linear/Nonlinear, now
Convex/Nonconvex

2
Outline
• What is CVXOPT?
• How does CVXOPT solve problems?
• What are some interesting applications
of CVXOPT?
3
Convex Sets
• For any x,y
belonging to the set
C, the chord
connecting x and y
is contained within
C.

4
Convex Functions
• A real valued
function mapping a
set X to R where X
is a convex set and
for any x, y
belonging to X

f (tx + (1 − t ) y ) ≤ tf ( x) + (1 − t ) f ( y )
0 ≤ t ≤1
5
Convex Programming
Minimize f 0 ( x)
subject to f i ( x) ≤ 0 i = 1,..., m
T

ai x = bi

i = 1,..., p

• Convex objective
• Convex inequality constraint functions
• Affine equality constraint functions

6
Linear Programming

• Supply Chain Modeling (Forestry)

7
Quadratic Programming

• Least Squares and Constrained Least
Squares
• Quantitative Finance
8
Second Order Cone
Programming

• Robust Linear Programming
• Truss design, robotic grasping force, antenna
design
9
Example: Robust LP
Minimize cT x
subject to aiT x ≤ bi ∀ai ∈ Ε i i = 1,..., m
_

Ei = {a i + Pi u | u 2 ≤ 1} Pi ∈ ℜ nxn
sup{aiT x | ai ∈ Ε i } ≤ bi
_T

sup{aiT x | ai ∈ Ε i } = a i x + Pi T x

2

Minimize cT x
_T

subject to a x + Pi T x ≤ bi i = 1,..., m
2

10
Semidefinite Programming

• Structural optimization, experiment design

11
Geometric Programming
Minimize

f 0 ( x)

Subject to

f i ( x) ≤ 1 i = 1,..., n
h j ( x) = 1 j = 1,..., m

• Posynomial objective and inequality
constraint functions.
• Monomial equality constraint functions
12
Globally Optimal Points
• Any locally optimal point is globally
optimal!
• No concern of getting stuck at
suboptimal minimums.
Overview CVXOPT
• Created by L. Vandenberghe and
J. Dahl of UCLA
• Extends pythons standard libraries
– Objects matrix and spmatrix

• Defines new modules e.g. BLAS,
LAPACK, modeling and solvers
14
cvxopt.solvers
•
•
•
•

Cone solvers: conelp, coneqp
Smooth nonlinear solvers: cp, cpl
Geometric Program solver: gp
Customizable: kktsolver

15
Cone Programs

• s belongs to C, the Cartesian product of a
nonnegative orthant, a number of second
order cones and a number of positive
semidefinite cones
16
Cone Solvers
• Apply Primal-Dual Path following
Interior Point algorithms with NesterovTodd Scaling to the previous problem
• Specify cone dimension with variable
dims
• Separate QP and LP solvers

17
solvers.coneqp
• coneqp(P, q, G, h, A, b, dims, kktsolver)
• Linearize Central Path Equations
(Newton Equations)
• Solving these is the most expensive step

• Transform N.E. into KKT system
18
solvers.coneqp
Central Path Equations
0   P
0  +  A
  
 s  G
  

G T   x  − c 
   
0   y  =  b , ( s, z )  0, z = − µg ( s )
0  z   h 
   

AT
0
0

Newton Equations

P

A
G


AT
0
0

  x  a 
   
0   y  = b 
− W TW   z   c 
   
GT

19
solvers.coneqp
KKT System

 P

 A
W −T G


T

A
0
0

T

G W
0
−I

−1

 x   a 
  
y = b 


 Wz  W −T c 

  

20
Constrained Regression

21
>> from cvxopt import matrix, solvers
>> A = matrix([ [ .3, -.4, -.2, -.4, 1.3 ], [ .6, 1.2, -1.7, .3, -.3 ], /

-.3, .0, .6, -1.2, -2.0 ] ])
>> b = matrix([ 1.5, .0, -1.2, -.7, .0])
>> m, n = A.size

>>> I = matrix(0.0, (n,n))
>> I[::n+1] = 1.0
>> G = matrix([-I, matrix(0.0, (1,n)), I])
>> h = matrix(n*[0.0] + [1.0] + n*[0.0])
>> dims = {'l': n, 'q': [n+1], 's': []}
>> x = solvers.coneqp(A.T*A, -A.T*b, G, h, dims)['x']
>> print(x)
7.26e-01]
6.18e-01]
3.03e-01]

22
solvers.conelp
• Coneqp demands strict primal-dual
feasibility. Conelp can detect
infeasibility.
• Embeds primal and dual LPs into one
LP
• Algorithm similar to coneqp except two
QR factorizations used to solve KKT
System
23
solvers.conelp
Self-dual Cone LP
Minimize 0
0  0
0 
  = − A
s −G
   T
κ  − c


AT
0
0
− bT

GT
0
0
− hT

C x
 
b  y
, ( s, κ , z ,τ )  0
h  z 
 
0  τ 


24
dims = {'l': 2, 'q': [4, 4], 's': [3]}
25
Nonlinear Solvers

• Solvers.cpl for linear objective problems
• User specifies F function to evaluate
gradients and hessian of constraints
• Solvers.cpl(F, G, h, A, b, kktsolver)
26
solvers.cpl
KKT System


H
A
~
G


T

A
0
0
m


G  u x  bx 
0  u y  = by ,
   
− W T W  u z  bz 
   

~
T

~

H = ∑ z k ∇ f k ( x), G = [∇f1 ( x) ... ∇f m ( x) G T ]T
2

k =0

27
solvers.cp

• For problems with a nonlinear objective
function
• Problem transformed into epigraph form and
solvers.cpl algorithm applied
28
solvers.cp
Robust Least Squares
from cvxopt import solvers, matrix, spdiag, sqrt, div
def robls(A, b, rho) :
m, n = A.size
def F(x = None, z = None) :
if x is None : return 0, matrix(0.0, (n,1))
y = A*x -b
w = sqrt(rho + y * *2)
f = sum(w)
Df = div(y, w).T * A
if z is None : return f, Df
H = A.T * spdiag(z[0] * rho * (w * * - 3)) * A
return f, Df, H

Minimize

m

∑ φ((Ax-b) )
k =1

k

where φ (u ) = ρ + u 2

return solvers.cp(F)[' x' ]

29
Geometric Solver

• GP transformed to equivalent convex form
and solvers.cp is applied
• Solvers.gp(F, G, h, A, b)
30
Exploiting Structure
• None of the previously mentioned
solvers take advantage of problem
structure
• User specified kktsolvers and python
functions allow for customization
• Potential for better than commercial
software performance
31
Exploiting Structure
M

N

CVXOPT

CVXOPT/BLAS

MOSEK 1.15

MOSEK 1.17

500

100

0.12

0.06

0.75

0.40

1000 100

0.22

0.11

1.53

0.81

1000 200

0.52

0.25

1.95

1.06

2000 200

1.23

0.60

3.87

2.19

1000 500

2.44

1.32

3.63

2.38

2000 500

5.00

2.68

7.44

5.11

2000 1000

17.1

9.52

32.4

12.8

•

L1-norm approximation solution times for six randomly
generated problems of dimension mxn (ref)
32
Interlude: iPython
• Interactive Programming Environment
• explore algorithms, and perform data
analysis and visualization.
• It facilitates experimentation - new ideas
can be tested on the fly
33
iPython - Features
• Magic Commands - e.g. %run
• Detailed Exception Traceback
• OS Shell Commands
• Extensive GUI support
34
Facility Layout Problem
• As Nonlinearly Constrained Program
• As Geometric Program
• As Quadratic Program

35
Nonlinearly Constrained
Facility Layout Problem
Minimize W + H
Subject to wk hk ≤ Areamin
x k + wk ≤ x j
x k + wk ≤ W
yk + hk ≤ y j
yk + hk ≤ H
1 / α ≤ wk / hk ≤ α
36
200 Modules
Geometric Program
Minimize W * H
Subject to x j * xi−1 + w j * xi−1 ≤ 1
x j *W −1 + w j *W −1 ≤ 1
y j * yi−1 + h j * yi−1 ≤ 1
y j * H −1 + h j * H −1 ≤ 1
Areamin * w−1 * h −1 ≤ 1
j
j
1 / α ≤ w j * h −1 ≤ α
j
38
Quadratic Program
Minimize

∑∑
i

j

xi − x j
flowi , j *
yi − y j

2

+ β (W + H )
2

subject to x j + w j ≤ xi
x j + wj ≤ W
y j + h j ≤ yi
y j + hj ≤ H
− w j ≤ − Areamin
− h j ≤ − Areamin
1/ α ≤ wj / hj ≤ α

39
65 Modules
Closing
• CVXOPT: Software for Convex
Optimization
• How will you use it?
• andrew.b.martin@dal.ca
41
References

42

Weitere ähnliche Inhalte

Was ist angesagt?

統計的学習の基礎 5章前半(~5.6)
統計的学習の基礎 5章前半(~5.6)統計的学習の基礎 5章前半(~5.6)
統計的学習の基礎 5章前半(~5.6)Kota Mori
 
正規表現に潜む対称性 〜等式公理による等価性判定〜
正規表現に潜む対称性 〜等式公理による等価性判定〜正規表現に潜む対称性 〜等式公理による等価性判定〜
正規表現に潜む対称性 〜等式公理による等価性判定〜Ryoma Sin'ya
 
セミパラメトリック推論の基礎
セミパラメトリック推論の基礎セミパラメトリック推論の基礎
セミパラメトリック推論の基礎Daisuke Yoneoka
 
PRML 上 2.3.6 ~ 2.5.2
PRML 上 2.3.6 ~ 2.5.2PRML 上 2.3.6 ~ 2.5.2
PRML 上 2.3.6 ~ 2.5.2禎晃 山崎
 
bayesplot を使ったモンテカルロ法の実践ガイド
bayesplot を使ったモンテカルロ法の実践ガイドbayesplot を使ったモンテカルロ法の実践ガイド
bayesplot を使ったモンテカルロ法の実践ガイド智志 片桐
 
東京都市大学 データ解析入門 6 回帰分析とモデル選択 1
東京都市大学 データ解析入門 6 回帰分析とモデル選択 1東京都市大学 データ解析入門 6 回帰分析とモデル選択 1
東京都市大学 データ解析入門 6 回帰分析とモデル選択 1hirokazutanaka
 
東京都市大学 データ解析入門 2 行列分解 1
東京都市大学 データ解析入門 2 行列分解 1東京都市大学 データ解析入門 2 行列分解 1
東京都市大学 データ解析入門 2 行列分解 1hirokazutanaka
 
Lie-Trotter-Suzuki分解、特にフラクタル分解について
Lie-Trotter-Suzuki分解、特にフラクタル分解についてLie-Trotter-Suzuki分解、特にフラクタル分解について
Lie-Trotter-Suzuki分解、特にフラクタル分解についてMaho Nakata
 
PRMLの線形回帰モデル(線形基底関数モデル)
PRMLの線形回帰モデル(線形基底関数モデル)PRMLの線形回帰モデル(線形基底関数モデル)
PRMLの線形回帰モデル(線形基底関数モデル)Yasunori Ozaki
 
【読書会資料】『StanとRでベイズ統計モデリング』Chapter12:時間や空間を扱うモデル
【読書会資料】『StanとRでベイズ統計モデリング』Chapter12:時間や空間を扱うモデル【読書会資料】『StanとRでベイズ統計モデリング』Chapter12:時間や空間を扱うモデル
【読書会資料】『StanとRでベイズ統計モデリング』Chapter12:時間や空間を扱うモデルMasashi Komori
 
モンテカルロサンプリング
モンテカルロサンプリングモンテカルロサンプリング
モンテカルロサンプリングKosei ABE
 
経験過程
経験過程経験過程
経験過程hoxo_m
 
Guided policy search
Guided policy searchGuided policy search
Guided policy searchJaehyeon Park
 
はじめてのKrylov部分空間法
はじめてのKrylov部分空間法はじめてのKrylov部分空間法
はじめてのKrylov部分空間法tmaehara
 
[DL輪読会]Conditional Neural Processes
[DL輪読会]Conditional Neural Processes[DL輪読会]Conditional Neural Processes
[DL輪読会]Conditional Neural ProcessesDeep Learning JP
 
基礎からのベイズ統計学第5章
基礎からのベイズ統計学第5章基礎からのベイズ統計学第5章
基礎からのベイズ統計学第5章hiro5585
 
Pythonによる、デジタル通信のための ビタビ符号化・復号ライブラリの作成
Pythonによる、デジタル通信のための ビタビ符号化・復号ライブラリの作成Pythonによる、デジタル通信のための ビタビ符号化・復号ライブラリの作成
Pythonによる、デジタル通信のための ビタビ符号化・復号ライブラリの作成Katsuhiro Morishita
 

Was ist angesagt? (20)

統計的学習の基礎 5章前半(~5.6)
統計的学習の基礎 5章前半(~5.6)統計的学習の基礎 5章前半(~5.6)
統計的学習の基礎 5章前半(~5.6)
 
PRML chapter7
PRML chapter7PRML chapter7
PRML chapter7
 
正規表現に潜む対称性 〜等式公理による等価性判定〜
正規表現に潜む対称性 〜等式公理による等価性判定〜正規表現に潜む対称性 〜等式公理による等価性判定〜
正規表現に潜む対称性 〜等式公理による等価性判定〜
 
セミパラメトリック推論の基礎
セミパラメトリック推論の基礎セミパラメトリック推論の基礎
セミパラメトリック推論の基礎
 
PRML 上 2.3.6 ~ 2.5.2
PRML 上 2.3.6 ~ 2.5.2PRML 上 2.3.6 ~ 2.5.2
PRML 上 2.3.6 ~ 2.5.2
 
bayesplot を使ったモンテカルロ法の実践ガイド
bayesplot を使ったモンテカルロ法の実践ガイドbayesplot を使ったモンテカルロ法の実践ガイド
bayesplot を使ったモンテカルロ法の実践ガイド
 
東京都市大学 データ解析入門 6 回帰分析とモデル選択 1
東京都市大学 データ解析入門 6 回帰分析とモデル選択 1東京都市大学 データ解析入門 6 回帰分析とモデル選択 1
東京都市大学 データ解析入門 6 回帰分析とモデル選択 1
 
東京都市大学 データ解析入門 2 行列分解 1
東京都市大学 データ解析入門 2 行列分解 1東京都市大学 データ解析入門 2 行列分解 1
東京都市大学 データ解析入門 2 行列分解 1
 
Lie-Trotter-Suzuki分解、特にフラクタル分解について
Lie-Trotter-Suzuki分解、特にフラクタル分解についてLie-Trotter-Suzuki分解、特にフラクタル分解について
Lie-Trotter-Suzuki分解、特にフラクタル分解について
 
PRMLの線形回帰モデル(線形基底関数モデル)
PRMLの線形回帰モデル(線形基底関数モデル)PRMLの線形回帰モデル(線形基底関数モデル)
PRMLの線形回帰モデル(線形基底関数モデル)
 
【読書会資料】『StanとRでベイズ統計モデリング』Chapter12:時間や空間を扱うモデル
【読書会資料】『StanとRでベイズ統計モデリング』Chapter12:時間や空間を扱うモデル【読書会資料】『StanとRでベイズ統計モデリング』Chapter12:時間や空間を扱うモデル
【読書会資料】『StanとRでベイズ統計モデリング』Chapter12:時間や空間を扱うモデル
 
モンテカルロサンプリング
モンテカルロサンプリングモンテカルロサンプリング
モンテカルロサンプリング
 
経験過程
経験過程経験過程
経験過程
 
Guided policy search
Guided policy searchGuided policy search
Guided policy search
 
はじめてのKrylov部分空間法
はじめてのKrylov部分空間法はじめてのKrylov部分空間法
はじめてのKrylov部分空間法
 
[DL輪読会]Conditional Neural Processes
[DL輪読会]Conditional Neural Processes[DL輪読会]Conditional Neural Processes
[DL輪読会]Conditional Neural Processes
 
PRML4.3.3
PRML4.3.3PRML4.3.3
PRML4.3.3
 
基礎からのベイズ統計学第5章
基礎からのベイズ統計学第5章基礎からのベイズ統計学第5章
基礎からのベイズ統計学第5章
 
Pythonによる、デジタル通信のための ビタビ符号化・復号ライブラリの作成
Pythonによる、デジタル通信のための ビタビ符号化・復号ライブラリの作成Pythonによる、デジタル通信のための ビタビ符号化・復号ライブラリの作成
Pythonによる、デジタル通信のための ビタビ符号化・復号ライブラリの作成
 
1次式とノルムで構成された最適化問題とその双対問題
1次式とノルムで構成された最適化問題とその双対問題1次式とノルムで構成された最適化問題とその双対問題
1次式とノルムで構成された最適化問題とその双対問題
 

Andere mochten auch

13.2 隠れマルコフモデル
13.2 隠れマルコフモデル13.2 隠れマルコフモデル
13.2 隠れマルコフモデルshow you
 
2016年度秋学期 応用数学(解析) 第3回 実数とは何か (2016. 10. 13)
2016年度秋学期 応用数学(解析) 第3回 実数とは何か (2016. 10. 13)2016年度秋学期 応用数学(解析) 第3回 実数とは何か (2016. 10. 13)
2016年度秋学期 応用数学(解析) 第3回 実数とは何か (2016. 10. 13)Akira Asano
 
信号処理・画像処理における凸最適化
信号処理・画像処理における凸最適化信号処理・画像処理における凸最適化
信号処理・画像処理における凸最適化Shunsuke Ono
 
概要と具体例で学ぶHMM(隠れマルコフモデル)
概要と具体例で学ぶHMM(隠れマルコフモデル)概要と具体例で学ぶHMM(隠れマルコフモデル)
概要と具体例で学ぶHMM(隠れマルコフモデル)thinkn1108
 
劣モジュラ最適化と機械学習1章
劣モジュラ最適化と機械学習1章劣モジュラ最適化と機械学習1章
劣モジュラ最適化と機械学習1章Hakky St
 
ベイジアンディープニューラルネット
ベイジアンディープニューラルネットベイジアンディープニューラルネット
ベイジアンディープニューラルネットYuta Kashino
 
プログラミング言語 Julia の紹介
プログラミング言語 Julia の紹介プログラミング言語 Julia の紹介
プログラミング言語 Julia の紹介Kentaro Iizuka
 
機械学習基礎(1)(基礎知識編-最適化問題)
機械学習基礎(1)(基礎知識編-最適化問題)機械学習基礎(1)(基礎知識編-最適化問題)
機械学習基礎(1)(基礎知識編-最適化問題)mikan ehime
 
スパースモデリング入門
スパースモデリング入門スパースモデリング入門
スパースモデリング入門Hideo Terada
 
最適化超入門
最適化超入門最適化超入門
最適化超入門Takami Sato
 
スパースモデリング、スパースコーディングとその数理(第11回WBA若手の会)
スパースモデリング、スパースコーディングとその数理(第11回WBA若手の会)スパースモデリング、スパースコーディングとその数理(第11回WBA若手の会)
スパースモデリング、スパースコーディングとその数理(第11回WBA若手の会)narumikanno0918
 
TensorFlowで逆強化学習
TensorFlowで逆強化学習TensorFlowで逆強化学習
TensorFlowで逆強化学習Mitsuhisa Ohta
 

Andere mochten auch (15)

13.2 隠れマルコフモデル
13.2 隠れマルコフモデル13.2 隠れマルコフモデル
13.2 隠れマルコフモデル
 
2016年度秋学期 応用数学(解析) 第3回 実数とは何か (2016. 10. 13)
2016年度秋学期 応用数学(解析) 第3回 実数とは何か (2016. 10. 13)2016年度秋学期 応用数学(解析) 第3回 実数とは何か (2016. 10. 13)
2016年度秋学期 応用数学(解析) 第3回 実数とは何か (2016. 10. 13)
 
信号処理・画像処理における凸最適化
信号処理・画像処理における凸最適化信号処理・画像処理における凸最適化
信号処理・画像処理における凸最適化
 
概要と具体例で学ぶHMM(隠れマルコフモデル)
概要と具体例で学ぶHMM(隠れマルコフモデル)概要と具体例で学ぶHMM(隠れマルコフモデル)
概要と具体例で学ぶHMM(隠れマルコフモデル)
 
劣モジュラ最適化と機械学習1章
劣モジュラ最適化と機械学習1章劣モジュラ最適化と機械学習1章
劣モジュラ最適化と機械学習1章
 
Chapter2.3.6
Chapter2.3.6Chapter2.3.6
Chapter2.3.6
 
ベイジアンディープニューラルネット
ベイジアンディープニューラルネットベイジアンディープニューラルネット
ベイジアンディープニューラルネット
 
線形計画法入門
線形計画法入門線形計画法入門
線形計画法入門
 
プログラミング言語 Julia の紹介
プログラミング言語 Julia の紹介プログラミング言語 Julia の紹介
プログラミング言語 Julia の紹介
 
機械学習基礎(1)(基礎知識編-最適化問題)
機械学習基礎(1)(基礎知識編-最適化問題)機械学習基礎(1)(基礎知識編-最適化問題)
機械学習基礎(1)(基礎知識編-最適化問題)
 
Juliaで並列計算
Juliaで並列計算Juliaで並列計算
Juliaで並列計算
 
スパースモデリング入門
スパースモデリング入門スパースモデリング入門
スパースモデリング入門
 
最適化超入門
最適化超入門最適化超入門
最適化超入門
 
スパースモデリング、スパースコーディングとその数理(第11回WBA若手の会)
スパースモデリング、スパースコーディングとその数理(第11回WBA若手の会)スパースモデリング、スパースコーディングとその数理(第11回WBA若手の会)
スパースモデリング、スパースコーディングとその数理(第11回WBA若手の会)
 
TensorFlowで逆強化学習
TensorFlowで逆強化学習TensorFlowで逆強化学習
TensorFlowで逆強化学習
 

Ähnlich wie CVXOPT: A Python-Based Convex Optimization Suite

Lp and ip programming cp 9
Lp and ip programming cp 9Lp and ip programming cp 9
Lp and ip programming cp 9M S Prasad
 
Convex optimization methods
Convex optimization methodsConvex optimization methods
Convex optimization methodsDong Guo
 
Towards typesafe deep learning in scala
Towards typesafe deep learning in scalaTowards typesafe deep learning in scala
Towards typesafe deep learning in scalaTongfei Chen
 
Least Square Optimization and Sparse-Linear Solver
Least Square Optimization and Sparse-Linear SolverLeast Square Optimization and Sparse-Linear Solver
Least Square Optimization and Sparse-Linear SolverJi-yong Kwon
 
super vector machines algorithms using deep
super vector machines algorithms using deepsuper vector machines algorithms using deep
super vector machines algorithms using deepKNaveenKumarECE
 
Optimization Techniques.pdf
Optimization Techniques.pdfOptimization Techniques.pdf
Optimization Techniques.pdfanandsimple
 
machine learning.pptx
machine learning.pptxmachine learning.pptx
machine learning.pptxAbdusSadik
 
Numerical Linear Algebra for Data and Link Analysis.
Numerical Linear Algebra for Data and Link Analysis.Numerical Linear Algebra for Data and Link Analysis.
Numerical Linear Algebra for Data and Link Analysis.Leonid Zhukov
 
Support Vector Machines is the the the the the the the the the
Support Vector Machines is the the the the the the the the theSupport Vector Machines is the the the the the the the the the
Support Vector Machines is the the the the the the the the thesanjaibalajeessn
 
Convex optmization in communications
Convex optmization in communicationsConvex optmization in communications
Convex optmization in communicationsDeepshika Reddy
 
Design and Implementation of Parallel and Randomized Approximation Algorithms
Design and Implementation of Parallel and Randomized Approximation AlgorithmsDesign and Implementation of Parallel and Randomized Approximation Algorithms
Design and Implementation of Parallel and Randomized Approximation AlgorithmsAjay Bidyarthy
 
MVPA with SpaceNet: sparse structured priors
MVPA with SpaceNet: sparse structured priorsMVPA with SpaceNet: sparse structured priors
MVPA with SpaceNet: sparse structured priorsElvis DOHMATOB
 
ppt - Deep Learning From Scratch.pdf
ppt - Deep Learning From Scratch.pdfppt - Deep Learning From Scratch.pdf
ppt - Deep Learning From Scratch.pdfsurefooted
 
2012 mdsp pr13 support vector machine
2012 mdsp pr13 support vector machine2012 mdsp pr13 support vector machine
2012 mdsp pr13 support vector machinenozomuhamada
 
The world of loss function
The world of loss functionThe world of loss function
The world of loss function홍배 김
 

Ähnlich wie CVXOPT: A Python-Based Convex Optimization Suite (20)

Lp and ip programming cp 9
Lp and ip programming cp 9Lp and ip programming cp 9
Lp and ip programming cp 9
 
Convex optimization methods
Convex optimization methodsConvex optimization methods
Convex optimization methods
 
Towards typesafe deep learning in scala
Towards typesafe deep learning in scalaTowards typesafe deep learning in scala
Towards typesafe deep learning in scala
 
bv_cvxslides (1).pdf
bv_cvxslides (1).pdfbv_cvxslides (1).pdf
bv_cvxslides (1).pdf
 
Least Square Optimization and Sparse-Linear Solver
Least Square Optimization and Sparse-Linear SolverLeast Square Optimization and Sparse-Linear Solver
Least Square Optimization and Sparse-Linear Solver
 
super vector machines algorithms using deep
super vector machines algorithms using deepsuper vector machines algorithms using deep
super vector machines algorithms using deep
 
Optimization Techniques.pdf
Optimization Techniques.pdfOptimization Techniques.pdf
Optimization Techniques.pdf
 
CLIM Fall 2017 Course: Statistics for Climate Research, Estimating Curves and...
CLIM Fall 2017 Course: Statistics for Climate Research, Estimating Curves and...CLIM Fall 2017 Course: Statistics for Climate Research, Estimating Curves and...
CLIM Fall 2017 Course: Statistics for Climate Research, Estimating Curves and...
 
QMC: Operator Splitting Workshop, A Splitting Method for Nonsmooth Nonconvex ...
QMC: Operator Splitting Workshop, A Splitting Method for Nonsmooth Nonconvex ...QMC: Operator Splitting Workshop, A Splitting Method for Nonsmooth Nonconvex ...
QMC: Operator Splitting Workshop, A Splitting Method for Nonsmooth Nonconvex ...
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
 
machine learning.pptx
machine learning.pptxmachine learning.pptx
machine learning.pptx
 
Numerical Linear Algebra for Data and Link Analysis.
Numerical Linear Algebra for Data and Link Analysis.Numerical Linear Algebra for Data and Link Analysis.
Numerical Linear Algebra for Data and Link Analysis.
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
Support Vector Machines is the the the the the the the the the
Support Vector Machines is the the the the the the the the theSupport Vector Machines is the the the the the the the the the
Support Vector Machines is the the the the the the the the the
 
Convex optmization in communications
Convex optmization in communicationsConvex optmization in communications
Convex optmization in communications
 
Design and Implementation of Parallel and Randomized Approximation Algorithms
Design and Implementation of Parallel and Randomized Approximation AlgorithmsDesign and Implementation of Parallel and Randomized Approximation Algorithms
Design and Implementation of Parallel and Randomized Approximation Algorithms
 
MVPA with SpaceNet: sparse structured priors
MVPA with SpaceNet: sparse structured priorsMVPA with SpaceNet: sparse structured priors
MVPA with SpaceNet: sparse structured priors
 
ppt - Deep Learning From Scratch.pdf
ppt - Deep Learning From Scratch.pdfppt - Deep Learning From Scratch.pdf
ppt - Deep Learning From Scratch.pdf
 
2012 mdsp pr13 support vector machine
2012 mdsp pr13 support vector machine2012 mdsp pr13 support vector machine
2012 mdsp pr13 support vector machine
 
The world of loss function
The world of loss functionThe world of loss function
The world of loss function
 

Kürzlich hochgeladen

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Kürzlich hochgeladen (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

CVXOPT: A Python-Based Convex Optimization Suite

  • 1. CVXOPT: A Python Based Convex Optimization Suite 11 May 2012 Industrial Engineering Seminar Andrew B. Martin
  • 2. Easy and Hard • Easy Problems - efficient and reliable solution algorithms exist • Once distinction was between Linear/Nonlinear, now Convex/Nonconvex 2
  • 3. Outline • What is CVXOPT? • How does CVXOPT solve problems? • What are some interesting applications of CVXOPT? 3
  • 4. Convex Sets • For any x,y belonging to the set C, the chord connecting x and y is contained within C. 4
  • 5. Convex Functions • A real valued function mapping a set X to R where X is a convex set and for any x, y belonging to X f (tx + (1 − t ) y ) ≤ tf ( x) + (1 − t ) f ( y ) 0 ≤ t ≤1 5
  • 6. Convex Programming Minimize f 0 ( x) subject to f i ( x) ≤ 0 i = 1,..., m T ai x = bi i = 1,..., p • Convex objective • Convex inequality constraint functions • Affine equality constraint functions 6
  • 7. Linear Programming • Supply Chain Modeling (Forestry) 7
  • 8. Quadratic Programming • Least Squares and Constrained Least Squares • Quantitative Finance 8
  • 9. Second Order Cone Programming • Robust Linear Programming • Truss design, robotic grasping force, antenna design 9
  • 10. Example: Robust LP Minimize cT x subject to aiT x ≤ bi ∀ai ∈ Ε i i = 1,..., m _ Ei = {a i + Pi u | u 2 ≤ 1} Pi ∈ ℜ nxn sup{aiT x | ai ∈ Ε i } ≤ bi _T sup{aiT x | ai ∈ Ε i } = a i x + Pi T x 2 Minimize cT x _T subject to a x + Pi T x ≤ bi i = 1,..., m 2 10
  • 11. Semidefinite Programming • Structural optimization, experiment design 11
  • 12. Geometric Programming Minimize f 0 ( x) Subject to f i ( x) ≤ 1 i = 1,..., n h j ( x) = 1 j = 1,..., m • Posynomial objective and inequality constraint functions. • Monomial equality constraint functions 12
  • 13. Globally Optimal Points • Any locally optimal point is globally optimal! • No concern of getting stuck at suboptimal minimums.
  • 14. Overview CVXOPT • Created by L. Vandenberghe and J. Dahl of UCLA • Extends pythons standard libraries – Objects matrix and spmatrix • Defines new modules e.g. BLAS, LAPACK, modeling and solvers 14
  • 15. cvxopt.solvers • • • • Cone solvers: conelp, coneqp Smooth nonlinear solvers: cp, cpl Geometric Program solver: gp Customizable: kktsolver 15
  • 16. Cone Programs • s belongs to C, the Cartesian product of a nonnegative orthant, a number of second order cones and a number of positive semidefinite cones 16
  • 17. Cone Solvers • Apply Primal-Dual Path following Interior Point algorithms with NesterovTodd Scaling to the previous problem • Specify cone dimension with variable dims • Separate QP and LP solvers 17
  • 18. solvers.coneqp • coneqp(P, q, G, h, A, b, dims, kktsolver) • Linearize Central Path Equations (Newton Equations) • Solving these is the most expensive step • Transform N.E. into KKT system 18
  • 19. solvers.coneqp Central Path Equations 0   P 0  +  A     s  G    G T   x  − c      0   y  =  b , ( s, z )  0, z = − µg ( s ) 0  z   h      AT 0 0 Newton Equations P  A G  AT 0 0   x  a      0   y  = b  − W TW   z   c      GT 19
  • 20. solvers.coneqp KKT System  P   A W −T G  T A 0 0 T G W 0 −I −1  x   a     y = b     Wz  W −T c      20
  • 22. >> from cvxopt import matrix, solvers >> A = matrix([ [ .3, -.4, -.2, -.4, 1.3 ], [ .6, 1.2, -1.7, .3, -.3 ], / -.3, .0, .6, -1.2, -2.0 ] ]) >> b = matrix([ 1.5, .0, -1.2, -.7, .0]) >> m, n = A.size >>> I = matrix(0.0, (n,n)) >> I[::n+1] = 1.0 >> G = matrix([-I, matrix(0.0, (1,n)), I]) >> h = matrix(n*[0.0] + [1.0] + n*[0.0]) >> dims = {'l': n, 'q': [n+1], 's': []} >> x = solvers.coneqp(A.T*A, -A.T*b, G, h, dims)['x'] >> print(x) 7.26e-01] 6.18e-01] 3.03e-01] 22
  • 23. solvers.conelp • Coneqp demands strict primal-dual feasibility. Conelp can detect infeasibility. • Embeds primal and dual LPs into one LP • Algorithm similar to coneqp except two QR factorizations used to solve KKT System 23
  • 24. solvers.conelp Self-dual Cone LP Minimize 0 0  0 0    = − A s −G    T κ  − c  AT 0 0 − bT GT 0 0 − hT C x   b  y , ( s, κ , z ,τ )  0 h  z    0  τ   24
  • 25. dims = {'l': 2, 'q': [4, 4], 's': [3]} 25
  • 26. Nonlinear Solvers • Solvers.cpl for linear objective problems • User specifies F function to evaluate gradients and hessian of constraints • Solvers.cpl(F, G, h, A, b, kktsolver) 26
  • 27. solvers.cpl KKT System  H A ~ G  T A 0 0 m  G  u x  bx  0  u y  = by ,     − W T W  u z  bz       ~ T ~ H = ∑ z k ∇ f k ( x), G = [∇f1 ( x) ... ∇f m ( x) G T ]T 2 k =0 27
  • 28. solvers.cp • For problems with a nonlinear objective function • Problem transformed into epigraph form and solvers.cpl algorithm applied 28
  • 29. solvers.cp Robust Least Squares from cvxopt import solvers, matrix, spdiag, sqrt, div def robls(A, b, rho) : m, n = A.size def F(x = None, z = None) : if x is None : return 0, matrix(0.0, (n,1)) y = A*x -b w = sqrt(rho + y * *2) f = sum(w) Df = div(y, w).T * A if z is None : return f, Df H = A.T * spdiag(z[0] * rho * (w * * - 3)) * A return f, Df, H Minimize m ∑ φ((Ax-b) ) k =1 k where φ (u ) = ρ + u 2 return solvers.cp(F)[' x' ] 29
  • 30. Geometric Solver • GP transformed to equivalent convex form and solvers.cp is applied • Solvers.gp(F, G, h, A, b) 30
  • 31. Exploiting Structure • None of the previously mentioned solvers take advantage of problem structure • User specified kktsolvers and python functions allow for customization • Potential for better than commercial software performance 31
  • 32. Exploiting Structure M N CVXOPT CVXOPT/BLAS MOSEK 1.15 MOSEK 1.17 500 100 0.12 0.06 0.75 0.40 1000 100 0.22 0.11 1.53 0.81 1000 200 0.52 0.25 1.95 1.06 2000 200 1.23 0.60 3.87 2.19 1000 500 2.44 1.32 3.63 2.38 2000 500 5.00 2.68 7.44 5.11 2000 1000 17.1 9.52 32.4 12.8 • L1-norm approximation solution times for six randomly generated problems of dimension mxn (ref) 32
  • 33. Interlude: iPython • Interactive Programming Environment • explore algorithms, and perform data analysis and visualization. • It facilitates experimentation - new ideas can be tested on the fly 33
  • 34. iPython - Features • Magic Commands - e.g. %run • Detailed Exception Traceback • OS Shell Commands • Extensive GUI support 34
  • 35. Facility Layout Problem • As Nonlinearly Constrained Program • As Geometric Program • As Quadratic Program 35
  • 36. Nonlinearly Constrained Facility Layout Problem Minimize W + H Subject to wk hk ≤ Areamin x k + wk ≤ x j x k + wk ≤ W yk + hk ≤ y j yk + hk ≤ H 1 / α ≤ wk / hk ≤ α 36
  • 38. Geometric Program Minimize W * H Subject to x j * xi−1 + w j * xi−1 ≤ 1 x j *W −1 + w j *W −1 ≤ 1 y j * yi−1 + h j * yi−1 ≤ 1 y j * H −1 + h j * H −1 ≤ 1 Areamin * w−1 * h −1 ≤ 1 j j 1 / α ≤ w j * h −1 ≤ α j 38
  • 39. Quadratic Program Minimize ∑∑ i j xi − x j flowi , j * yi − y j 2 + β (W + H ) 2 subject to x j + w j ≤ xi x j + wj ≤ W y j + h j ≤ yi y j + hj ≤ H − w j ≤ − Areamin − h j ≤ − Areamin 1/ α ≤ wj / hj ≤ α 39
  • 41. Closing • CVXOPT: Software for Convex Optimization • How will you use it? • andrew.b.martin@dal.ca 41