Re: 10 to 20 item optimizer?

dave wrote:
"S. I. Becker" <stewart@xxxxxxxxxxxxx> wrote in message
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
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
more than I have

A few questions:

1) What is E(...) ? Mathematical/statistical Expectation? Something
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))

Wanting to help, but needing more information,

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

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.

Why not buy the one I write: ? It has a COM automation interface for access from VB, or it plugs directly into Excel for charting purposes.

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:

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.


Relevant Pages

  • Re: lb and ub constraints in lsqcurvefit
    ... to be able to use large scale solvers. ... My objective function is a sum of squares ... Those are linear constraints on the parameters; ... with each a mean and a variance, and I want those peaks to ...
  • Re: 10 to 20 item optimizer?
    ... they aren't then the simplex algorithm may well do the job for you. ... Constraints 1 to n: ... Sum over i = 1 ... So this is linear optimisation on linear constraints. ...
  • Re: The Language I want
    ... GC (provided at the library level instead) ... only be instantiated to types that obey certain constraints. ... the function Sum finds the sum of the elements of a ... If E is a type implementing the Number type class and Cis a type ...
  • Re: Sum of combination
    ... > and have Solver find all the combinations that sum to 20, ... but adding constraints to Solver would add ... >> If all values were positive, then your proposed constraints would work ...
  • Re: Create an averaged matrix
    ... To enforce a matrix-wide average, you could iterate over the array, set each ... keep a sum of all the items. ... whatever constraints you're trying to enforce. ... subtract that much from every item. ...