我正在使用 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 是返回值。然而,这看起来像是一个最大化问题(最大化负回报)。
但是我不知道如何使用其他参数。
鉴于上述最小化问题和约束,我正在使用优化器寻求帮助。