# optimisation problem with linear constraint

I have an optimisation problem.

I wish to maximise a function subject to a constraint. It is the constraint that is causing me problems. I am using an addin in Matlab which does the optimisation however the constraints that I have used before have been in the format of the line below.

 b_l <= Ax <= b_u


The constraint is,

 Sum(x .* stock)*BetaBM - 0.1 <= Sum(x .* stock.*BetaSK) <= Sum(x .*stock)*BetaBM + 0.1


where,

 x is 2000 by 1 vector
stock is 2000 by 1 vector
BetaBM is a scalar
BetaSK is 2000 by 1 vector

x - is the weight of each stock in the fund. It cannot be more than 100% but can be less.
stock - I am looking at M&A deals. The stock variable is a number between 0 and 1 which represents how much of the deal is being paid for in the acquires stock. 0 would mean the deal is purely cash. If there is part of the deal being paid in stock I will hedge the beta exposure against the S&P Index.

BetaBM - is the S&P beta.
BetaSK - contains all the individual beta for all the stocks in the fund


I need to get the constraint in the format b_l <= Ax <= b_u if at all possible?

• please, check your question: something is missing BetaSK is. – Arrigo Sep 29 '14 at 14:40
• I think there is something to correct: in MATLAB, x*stock will not work if both vectors have the same dimensions (2000x1) because it is not a correct matrix product. Do you mean matrix product or dot product when you use *? – Arrigo Sep 29 '14 at 14:56
• sorry if I was using matlab your right they would not work. I meant to use .* – mHelpMe Sep 29 '14 at 15:16
• is this a programming question? If yes .. off-topic. If no: then please write something about what the variables mean and what the constraint means. – Ric Sep 29 '14 at 15:28
• @Richard - please see my revised post. If it is not clear please let me know – mHelpMe Sep 29 '14 at 15:46

If you have a vector of weights $w=(w_1,\ldots,w_n)^T$ then $(1,\ldots,1)* w = \sum_{i=1}^n w_i$ thus a sum condtion can be formulated by multiplication with a row of ones. A $\le$ can be put into an $\ge$ by multiplying with $(-1)$ and if you have to put all your constraints into on $A$ then you usually stack all the row vectors together. In your case the matrix $A$ will consist of rows of ones. As long as you don't explain your constraint I can not add more.
I will try: If you want to put a constraint on your porfolio beta then you should use a constraint: $$(\beta_1,\ldots,\beta_n) * w \le \beta_{BM}+0.1$$ and $$(\beta_1,\ldots,\beta_n)*w \ge \beta_{BM}-0.1$$ which the same as $$-(\beta_1,\ldots,\beta_n)*w \le 0.1-\beta_{BM}$$. So you could use a matrix $$A = (\beta_1,\ldots,\beta_n;-\beta_1,\ldots,-\beta_n)$$ and right hand side $b = (\beta_{BM}+0.1;0.1-\beta_{BM})$ then your condition is: $$A w \le b.$$
EDIT after a remark by PO: If you have $$(\sum_{i=1}^n w_i stock_i) \beta_{BM} -0.1 \le \sum_{i=1}^n w_i stock_i \beta_i$$ then this is equivalent to $$\sum_{i=1}^n w_i stock_i (\beta_{BM} - \beta_i) \le 0.1$$ then you define scalars $k_i = stock_i (\beta_{BM} - \beta_i)$ and the same as above holds for $\sum_{i=1}^n w_i k_i \le 0.1$. For the right hand side you get $$\sum_{i=1}^n w_i (-k_i) \le 0.1.$$ Your matrix $A$ has two rows, one $(k_1,\ldots,k_n)$ and one $(-k_1,\ldots,-k_n)$ the rhs is $(0.1, 0.1)$.
• I though that maybe there is a way to keep the $B_l \le A \le b_u$ formulation. But please forget it for now. It is quite usualy to formulate the constraint as $A x \le b_u$. This is fully general as you can always multiply rows and rhs by (-1). – Ric Sep 30 '14 at 8:39