+ Reply to Thread
Results 1 to 7 of 7

Solver - Objective Zero

  1. #1
    Registered User
    Join Date
    12-11-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    19

    Solver - Objective Zero

    Hello,

    I have setup a list of data to use the solver feature and I can successfully use it to solve which numbers add up to a target amount.
    The only problem is that I cannot get it to work with which numbers add up to 0.
    0 target seems to be the only exception to this solver rule.
    prefer not to work with macros.

    I want to determine which numbers could add up to offset a net 0.

    i.e.
    1 - yes
    2 - yes
    3 - yes
    4 - yes
    5 - no
    -1 - yes
    -2 - yes
    -3 - yes
    -4 - yes

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

    Re: Solver - Objective Zero

    How did you set up the spreadsheet and the solver model? I have no trouble getting Solver to solve for target cell =0 in the usual way that I set these up, so I would guess that there is something in the way you have set up the spreadsheet that makes it difficult for Solver to find the 0 solution.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    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 - Objective Zero

    One way is to use binaries. Like this perhaps?

    Alf
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-11-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Solver - Objective Zero

    That's weird I thought I sent up correctly but I was missing the objective F setup.

    What is the purpose of the set objective for the sum of binaries? and also selection of the MAX?
    I just didn't understand the logic for that piece.


    Thanks so much Alf!

  5. #5
    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 - Objective Zero

    I assumed you wish to use as many of the numbers as posible to reach the sum of zero, setting it to min will make solver pick none as the sumproduct of the numbers times the binaries (all zero) will make constr2 = 0.

    Also setting the sum of binaries to max will force solver to pick at least some of the numbers.

    Alf

  6. #6
    Registered User
    Join Date
    12-11-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Solver - Objective Zero

    so testing this out, i noticed it loves to go for the weird alternatives that add up to 0 instead of eliminating the obvious negative to positive pairings.


    1 1
    2 1
    3 1
    4 1
    5 1
    -1 0
    -2 1
    -3 1
    -4 0
    -10 1


    It's interesting that the solver would go for the -10 and make the others work instead of eliminating the -1 and -4

    didn't end up using this solver solution, because my real list of numbers contains thousands and decimals the system was taking forever to run the possibilities. i guess its back to the old matching one by one through control F haha. thank you everyone, i did learn something.
    Last edited by skyxliner; 12-18-2015 at 02:36 PM.

  7. #7
    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 - Objective Zero

    Is objective cell still set to max then it would use as many numbers as possible.

    You could also set objective cell to min and add a constraint to the objective cell say >= 2, then solver would pick two numbers. When I tested it selected 4 and -4.

    I thought it would pick 1 and -1.

    Shall we say "Solver works in mysterious ways its miracles to preform"

    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. Solver maximizing a UDF as Objective Function
    By gibsonj4 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-08-2015, 11:46 AM
  2. Excel Solver with multiple objective cells
    By hansaaa in forum Excel General
    Replies: 1
    Last Post: 07-21-2014, 03:20 PM
  3. [SOLVED] using solver to set objective to value of another cell
    By will.girling in forum Excel General
    Replies: 2
    Last Post: 11-26-2013, 10:00 AM
  4. Saving the final objective function value in solver
    By SJP22 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2013, 10:47 AM
  5. [SOLVED] How do I write up a controllers objective
    By click in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-15-2006, 04:40 PM
  6. Objective/Goal Tracing
    By FireGeek822 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-24-2005, 04:05 PM
  7. [SOLVED] Percent of Objective
    By [email protected] in forum Excel General
    Replies: 1
    Last Post: 03-15-2005, 05:06 PM

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