+ Reply to Thread
Results 1 to 11 of 11

SOLVER does not change inputs!

  1. #1
    Registered User
    Join Date
    03-17-2016
    Location
    belgium
    MS-Off Ver
    2013
    Posts
    25

    SOLVER does not change inputs!

    Good day everyone.

    As part of a portfolio strategy, I need to determine the optimal weights in order to maximize the sharpe ratio.
    In order to do that, I want to make use of SOLVER.
    When I do this, the SOLVER acts like it's giving a solution but nothing changes to the portfolio weights.
    Does this have something to do with the "complexity" of some functions on which the sharpe ratio is based?
    These are partly based on IF functions.

    Please find my excel file attached.
    The sheet to look at is "Momentum Signals".
    There you can find the weights and sharpe ratio.
    What I did to maximize is:
    - set objective: $H$3
    - by changing variables cells: $C$3:$F$3
    No matter what solving method I choose, it does not solve!!

    I would greatly appreciate any help. Thanks
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: SOLVER does not change inputs!

    I am most familiar with the behavior of the GRG non-linear (Newton Raphson) type algorithms for this kind of thing. What I see is that small changes to the weights make no change to the Sharpe ratio, so it is easy to see how Solver (using one of its "make small changes to the decision variables, observe the change to the objective function, then continue) would conclude that it is already optimized. This is a common problem for Solver and discontinuous "step" functions like this.

    Digging a little deeper, I think the main source of the "discontinuous" nature of the problem is in the Positions tab, where you have a big IF(AND(...))))) function (that looks like it should reduce down to a simple VLOOKUP() function with the 4th argument set to TRUE, if you are interested). I replaced this function with a linear interpolation function (how many times have I wished Excel had a nice built in linear interpolation function) to make this step in the algorithm "continuous". This change allowed me to use Solver to maximize the Sharpe ratio by changing the weights.

    My advice would be to reformulate your algorithm (in particular, the positions tab) so that the computation is not a step function.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    03-17-2016
    Location
    belgium
    MS-Off Ver
    2013
    Posts
    25

    Re: SOLVER does not change inputs!

    Quote Originally Posted by MrShorty View Post
    Digging a little deeper, I think the main source of the "discontinuous" nature of the problem is in the Positions tab, where you have a big IF(AND(...))))) function (that looks like it should reduce down to a simple VLOOKUP() function with the 4th argument set to TRUE, if you are interested). I replaced this function with a linear interpolation function (how many times have I wished Excel had a nice built in linear interpolation function) to make this step in the algorithm "continuous". This change allowed me to use Solver to maximize the Sharpe ratio by changing the weights.

    My advice would be to reformulate your algorithm (in particular, the positions tab) so that the computation is not a step function.
    VLOOKUP would not be doing the job as I needed to check if values were in certain intervals.
    Right? Or how would you use VLOOKUP here
    Thxx for helping out!

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: SOLVER does not change inputs!

    I can get solver to "react" with a setup like this but ....

    asolv1.jpg

    asolv2.jpg

    asolv3.jpg

    .... but the max value for H3 is still 73.31% so I really don't know if this is of any help to you. Ticking the box marked "Use Multistart" and "Required Bounds on Variables" was what I needed to get solver going.

    Alf

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: SOLVER does not change inputs!

    VLOOKUP() with the 4th argument set to TRUE (rather than FALSE like almost all of the examples out there) does an excellent job of checking if values are in certain intervals. Steps to replacing that big IF() function with VLOOKUP()

    1) VLOOKUP(value,table,column,TRUE) only works when the lookup values (left column) in the lookup table are in ascending order. Select W7:Y14 and sort the lookup table in ascending order by column X. Note that column X will be our lookup values.
    2) The formula in Positions now becomes =VLOOKUP('momentum signals'!B12,'momentum signals'!$X$7:$Y$14,2,TRUE) (or something like that). Copy down and across.

    But, VLOOKUP() is still a discontinuous "step" function, so this replacement is not going to help with the overall problem of getting Solver to find the maximum Sharpe ratio.

  6. #6
    Registered User
    Join Date
    03-17-2016
    Location
    belgium
    MS-Off Ver
    2013
    Posts
    25

    Re: SOLVER does not change inputs!

    Yes, apparently adding a restriction reduces the range of possible values that SOLVER has to consider, which enables it to find a solution.
    Even without using Multistart or Required Bounds on Variables.
    Thx!

  7. #7
    Registered User
    Join Date
    03-17-2016
    Location
    belgium
    MS-Off Ver
    2013
    Posts
    25

    Re: SOLVER does not change inputs!

    Quote Originally Posted by MrShorty View Post
    VLOOKUP() with the 4th argument set to TRUE (rather than FALSE like almost all of the examples out there) does an excellent job of checking if values are in certain intervals. Steps to replacing that big IF() function with VLOOKUP()

    1) VLOOKUP(value,table,column,TRUE) only works when the lookup values (left column) in the lookup table are in ascending order. Select W7:Y14 and sort the lookup table in ascending order by column X. Note that column X will be our lookup values.
    2) The formula in Positions now becomes =VLOOKUP('momentum signals'!B12,'momentum signals'!$X$7:$Y$14,2,TRUE) (or something like that). Copy down and across.

    But, VLOOKUP() is still a discontinuous "step" function, so this replacement is not going to help with the overall problem of getting Solver to find the maximum Sharpe ratio.
    So you would advise me to reformulate my algorithm by using linear interpolation? No idea how that works

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: SOLVER does not change inputs!

    If this were my algorithm, I would probably use linear interpolation (a common topic on here and other forums). However, Alf's direction might be closer to what you want, anyway. My advice at this point is to follow through on Alf's suggestions until that line of thought is exhausted. If his line of reasoning works, it will probably be easier to implement than trying to learn linear interpolation.

  9. #9
    Registered User
    Join Date
    03-17-2016
    Location
    belgium
    MS-Off Ver
    2013
    Posts
    25

    Re: SOLVER does not change inputs!

    Quote Originally Posted by MrShorty View Post
    1) VLOOKUP(value,table,column,TRUE) only works when the lookup values (left column) in the lookup table are in ascending order. Select W7:Y14 and sort the lookup table in ascending order by column X. Note that column X will be our lookup values.
    When I try to sort that, it refers me to cells in other sheets (because of references).
    How can I make Excel ignore those references?

  10. #10
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: SOLVER does not change inputs!

    Since W and X are merely copying the values in M3:U3, perhaps use something like =small($M$3:$U$3,ROWS(V$7:V7)) (copied down) to get the values in X. If you still want the values in W, you can use a similar formula.

  11. #11
    Registered User
    Join Date
    03-17-2016
    Location
    belgium
    MS-Off Ver
    2013
    Posts
    25

    Re: SOLVER does not change inputs!

    Thanks for helping out!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Change the Validation contents as per the given inputs
    By Sekars in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-10-2016, 11:41 PM
  2. [SOLVED] change triangle size by cell inputs
    By riz4u in forum Excel Charting & Pivots
    Replies: 17
    Last Post: 04-12-2016, 10:22 AM
  3. Change Input - Recalculate - Paste Results for all Inputs Separately
    By RiteshChaturvedi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-21-2013, 09:57 AM
  4. Can't get Solver to work in a function (taking inputs and returning value)
    By VBAFinance in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-28-2010, 04:06 PM
  5. Automation of Solver: Must inputs be derived from cells?
    By HammerTime in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-20-2010, 09:17 PM
  6. Replies: 8
    Last Post: 11-30-2009, 10:02 PM
  7. Re-run solver when some inputs change
    By Bojana in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-04-2005, 09:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1