Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Quadratic Programming with the Optimization Tool

Mikey1
5 - Atom

Hi, 

 

Looking at doing quadratic programming with the optimization tool but this is a first attempt and I am not sure what to enter through the Q input. 

 

Does anyone have a working workflow so I can see the input being used here (the help section seems a bit light after the linear programming bit) . 

 

Thanks! 

 

Mikey 

9 REPLIES 9
ChristineB
Alteryx Alumni (Retired)

Hi @Mikey1

 

I'm attaching a sample workflow with a configuration using a Quadratic Input.  Hope this helps! 

 

------------------------------------------------

Christine B

Customer Support Engineer

pkb
5 - Atom

@ChristineB ,

I'm curious why the Pearson Correlation tool is not / cannot be used for the covariance input here?  It appears that the R matrix produces a different matrix than the embedded tool...

 

Trying to make this into a dynamic WF that can respond to any varied portfolio asset size...

thanks!

apathetichell
18 - Pollux

FYI - if anyone stumbles upon this and is like why doesn't the covariance match - two reasons:

1) Inside the R Tool there is language re:

# Set "risk aversion parameter", a = 8
a <- 8
cov_mat <- as.data.frame(-2*a*cov(dat))

2) the values are rotated/cross-tabbed. once you multiply by -16 and rotate the values match the Pearson tool.

 

two other issues - I think the workflow as posted is dense matrix variables in rows - not dense matrix constraints in rows as it initially showed up on my system.... Don't know if that's a change from the 2017 version. also I'm getting negative portfolio allocations. Albeit tiny negative allocations- they are still negative allocations  which is odd as the lb is zero. I'd love to see a more up to date version of quadprog optimization if anyone has one.

mouna_belaid
8 - Asteroid

Hi @apathetichell 

 

Would you have an explanation please about why the quadratic portion of the objective function is provided by calculating a covariance matrix multiplied by -2*a? Thank you!

apathetichell
18 - Pollux

@mouna_belaid- I'd recommend digging into the R to see what's going on - but my assumption is that this relates to multiplying both sides by -2a to allow x = -b+/-(4ac)^.5 ?

mouna_belaid
8 - Asteroid

Thank you @apathetichell  for your reactivity.

Where x = -b+/-(4ac)^.5  that you mentioned comes from?

apathetichell
18 - Pollux

Left out the b^2 - but otherwise - just the standard quadratic equation has a 2a denominator which I'd expect this relates to. I'd have to dig more into it to get how this is implemented here. I honestly haven't look at this (or anything related to this in a while so I'd need a refresher).

 

https://en.wikipedia.org/wiki/Quadratic_equation

mouna_belaid
8 - Asteroid

Thank you for this clarification and for your reactivity.

Krystophe
6 - Meteoroid

 What is the purpose of the R tool in the workflow ?

Labels