+ Reply to Thread
Results 1 to 4 of 4

Help with Solver!!!

  1. #1
    Registered User
    Join Date
    05-03-2020
    Location
    Menlo Park, CA
    MS-Off Ver
    2019
    Posts
    4

    Help with Solver!!!

    Hi, I'm trying to make a Solver function to maximize the amount of total return on a stock portfolio. It needs to satisfy the following constraints:

    Condition 1: Additional shares can be bought only in “Health Care” Companies in the portfolio.
    Condition 2: The maximum number of additional shares in each “Health Care” company in the
    portfolio that can be bought is 250
    Condition 3: Fractional shares cannot be bought.
    Condition 4: The total additional money available (The sum of money paid for additional shares in
    Health Care companies) for investment is $60,000.

    I've set this up in Solver like this:

    $D$4:$D$36 = $Y$6 ((D4:D36 is the specification of the industry for each stock)) ((Y6 = Health Care))

    $T$4:$T$36 <= $Y$7 ((T4:T36 is the blank range of cells I've set up for the additional shares to be purchased)) ((Y7 = "250))

    $T$4:$T$36 = integer

    $T$4:$T$36 >= 0

    $X$38 = 60000 (X38 is the total sum of 60,000 that I can spend to purchase additional shares)


    I keep getting the same error that says "Variable bounds conflict in Binary or AllDifferent Constraint"

    PLEASE HELP!!!!!!!!!

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Help with Solver!!!

    dpible post: https://www.excelforum.com/excel-for...th-solver.html
    Ben Van Johnson

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Help with Solver!!!

    Please do not post duplicate threads. I have closed your other thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

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

    Re: Help with Solver!!!

    It's probably going to be difficult for us to help you debug this without a sample file. Can you cobble something together that will illustrate the scenario with dummy values so we have something to look at and test?

    The main thing I see is
    $D$4:$D$36 = $Y$6 ((D4:D36 is the specification of the industry for each stock)) ((Y6 = Health Care))
    If I understand this correctly, you have put a "range=text string" type constraint into the model. I know my older version of Excel/Solver does not at all like text constraints. I would probably rewrite the spreadsheet formulas to account for this constraint inside of the formulas so that Solver does not need to worry about this constraint.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ 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. Replies: 7
    Last Post: 12-31-2016, 12:29 PM
  2. Replies: 1
    Last Post: 04-27-2016, 03:05 PM
  3. Replies: 0
    Last Post: 07-20-2014, 12:45 PM
  4. macro not keeping solver solutions when solver is successful
    By jimmypants in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2014, 01:45 AM
  5. Can't start Solver. Error message says Solver.xlam already open.
    By DaveHills in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 1
    Last Post: 10-21-2012, 11:02 AM
  6. solver macro + simulation code + not updating solver values
    By sabinemaria in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2012, 11:37 AM
  7. Interesting Solver problem (Solver encounters an error)
    By MrShorty in forum Excel General
    Replies: 3
    Last Post: 12-22-2005, 06:55 PM

Tags for this Thread

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