+ Reply to Thread
Results 1 to 2 of 2

Solver with maximum number of non-zero inputs

  1. #1
    Registered User
    Join Date
    12-08-2020
    Location
    Portugal
    MS-Off Ver
    2016
    Posts
    1

    Solver with maximum number of non-zero inputs

    Hi everyone!
    I am using solver to set up the best portfolio (which is just a set of weights) given an x number of stocks. For instance, I might have data for 100 stocks and with this data, solver will give me the optimal weights of each stock for my portfolio by maximizing a ratio that takes into account both expected returns and volatility (sharpe ratio). The problem that I am facing is related to the constraints: I am trying to set a maximum number of stocks (i.e., maximum number of non-zero values for weights) but solver keeps saying that it can't find any feasible solution. Important to note that there are in fact feasible solutions. Can anyone help me? By the way, as a constraint for the maximum number of stocks i was using a countif (non-zero) function which seems to work for a small number of stocks (I tried with only 5) but not for 100 as in my case.

    Thanks in advance!
    Last edited by Antonio Pereira; 12-09-2020 at 04:24 PM. Reason: Change title

  2. #2
    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 with maximum number of non-zero inputs

    In a nutshell, Solver can not work with CountIf and If functions in the
    model. This is because these are discontinuous functions. Solver is
    not capable of determining a "finite difference" to help with a
    derivative. Solver will often give up without warning at the first sign
    of confusion.
    Your model would have to be reworked without these functions.
    = = = = = = =
    Dana DeLouis
    Still you could try to run your model using the Evolutionary solver engine as this is not as sensitive to discontinuous function. And I would also suggest you upload a file with your model.

    Alf

+ 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. Import Mutual Fund NAV from web
    By djungst in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-23-2019, 07:24 PM
  2. mutual exclusivity of one workbook
    By uimhirADo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-21-2012, 12:10 AM
  3. Mutual exclusive currency cells
    By macgywer in forum Excel General
    Replies: 2
    Last Post: 11-07-2010, 08:27 AM
  4. mutual exclusive write to Excel file
    By extreme in forum Excel General
    Replies: 4
    Last Post: 06-18-2007, 02:36 AM
  5. mutual exclusive write to Excel file
    By extreme in forum Excel General
    Replies: 1
    Last Post: 06-13-2007, 10:56 PM
  6. mutual exclusive write to Excel file
    By extreme in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2007, 05:18 AM
  7. [SOLVED] Computing Mutual Fund Diversification
    By [email protected] in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-16-2006, 09:10 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