2

我正在使用 CVXOPT 进行二次规划,以使用均值方差优化计算组合的最佳权重。在http://abel.ee.ucla.edu/cvxopt/userguide/coneprog.html#quadratic-programming有一个很好的例子。但是,参数是正则化的形式(根据作者)。该示例是基本版本。我正在寻找一个更复杂的问题,其中:

min:

x'Sx  

s.t.:

x'a >= g  
x'1 = 0  
x >= -Wb  
x <= c1 - Wb  

where:
x: active weights of assets (active weight = portfolio weight - benchmark weight)  
S: covariance matrix of asset returns  
a: expected stock excess returns  
g: target gain  
Wb: weights of assets in the benchmark  
c: upper limit (weight) of any asset in the portfolio  

假设所有变量都是计算的或已知的。

文档中提供的基本示例:

min:  

x'Sx  

s.t.  

p'x >= g  
1'x = 1

其中 p 是资产收益。

我不知道的(参考http://abel.ee.ucla.edu/cvxopt/examples/book/portfolio.html的代码和上面的优化问题):

1.我认为这些论点设置了约束,但我不完全确定:

G = matrix(0.0, (n,n))
G[::n+1] = -1.0
h = matrix(0.0, (n,1))
A = matrix(1.0, (1,n))
b = matrix(1.0)

2.我相信这是“规范形式”中最小化问题的一部分,我不确定这意味着什么:

mus = [ 10**(5.0*t/N-1.0) for t in xrange(N) ]

3. qp 的参数是什么(solver.qp 是二次优化器):

xs = [ qp(mu*S, -pbar, G, h, A, b)['x'] for mu in mus ]

查看文档,我很确定 mu*S (第一个参数)是要最小化的目标函数,而 -pbar 是返回值。然而,这看起来像是一个最大化问题(最大化负回报)。

但是我不知道如何使用其他参数。

鉴于上述最小化问题和约束,我正在使用优化器寻求帮助。

4

1 回答 1

1

I read the docs and I think you have to use the function with the following parameters. I assume that x has size n:

P = S
q = (0,....0)

A = (1, ...... 1)
b = (0)

G is vertically stacked from

 -a
 +I_n
 -I_n

where I_n is the identity matrix of size n x n . And the corresponding right hand side h is

  -g
  Wb
  ...
  Wb
  C1-Wb
  ...
  C1-Wb

That is: one -g, n times Wb and n times C1-Wb.

HTH.

于 2011-09-27T19:33:07.213 回答