# Re: 10 to 20 item optimizer?

dave wrote:
"S. I. Becker" <stewart@xxxxxxxxxxxxx> wrote in message
news:OyidyIfSHHA.5068@xxxxxxxxxxxxxxxxxxxxxxx
dave wrote:
yes you are right on.
My equation is z=E((x1+y1)*(x2+y2)*(x3+y3)*(x4+y4)*(x5*y5)....)
x's are known
y's are unknown
z is my target of about.12
with a couple of simple constraits
y>=0
sum of all y=1
yeah there are math tricks to do this and solver knows them
there are libraries for this too but do way more than I need and cost
way
more than I have

A few questions:

1) What is E(...) ? Mathematical/statistical Expectation? Something
else?
2) Are you sure that those + and * signs are the right way round? If
they aren't then the simplex algorithm may well do the job for you.

What expression(s) do you want to _optimize_ (i.e. minimise / maximise),
and what expressions(s) do you want to _constrain_ (have less
than/greater than/equal to a given value)?

As I understand the terminology, you have only given constraints in your
example above:

Constraints 1 to n:
y_i >= 0

Constraint n+1:
Sum over i (y_i) = 1

Constraint n+2:
.12 [ = z ] = E(Product over i (x_i + y_i))

Stewart
1. with E, I was trying to infer that the sum of the whole equation

Aha! so E := Sigma (but you had summation signs in there already). But now I know what you mean, so that's sorted. <g>

2. you are correct in my haste I have + and * wrong, y are weights and
multiplied by the return(x)
I would like to maximize the sum of the equation
((x1*y1)+(x2*y2)+(x3*+y3)+(x4*y4)+(x5*y5)....)

So this is linear optimisation on linear constraints.

I am essentially trying to embed a portfolio optimizer into my data charting
software for my own use.

<sales-pitch>
Why not buy the one I write: http://www.occamsrazor.com/ ? It has a COM automation interface for access from VB, or it plugs directly into Excel for charting purposes.
</sales-pitch>

So I need to have the sum of all weights of course = 1 and then no more
than 5% for any one weight
for right now they are my only constraints
x is monthly return and y is weight
Its very similar to markowitz optimization but I care less about deviation
and more about downside deviation or sortino but I want to take one step at
a time

If you don't care about the risk part of the equation, then you want the simplex algorithm:

http://en.wikipedia.org/wiki/Simplex_algorithm

Also google for "Simplex algorithm" Many universities have it in "linear programming" courses, and some have their lecture slides on the web.

If you have Markowitz's book "Mean-Variance Analysis in Portfolio Choice and Capital Markets," the simplex algorithm is described in chapter 8, with particular reference to maximising return subject to linear constraints on your portfolio.

Stewart
.