+ Reply to Thread
Results 1 to 12 of 12

Solver - SolverAdd using variable in variable constrains doesn't work

  1. #1
    Registered User
    Join Date
    04-04-2014
    Location
    Warsaw
    MS-Off Ver
    Excel 2010
    Posts
    97

    Solver - SolverAdd using variable in variable constrains doesn't work

    Hello I've got problem with the following code using Solver add. The problem concerns first two SolverAdd lines - they just doesn't add a thing in constrains window, and I try to figure out why:

    Please Login or Register  to view this content.
    Any ideas why first and second constrains doesn't add in into Solver and doesn't work? Adding values without variables makes them work, but it's not desirable:
    Please Login or Register  to view this content.
    But still I can't figure out first one. Any ideas?

    Thanks for all suggestions!
    Regards,
    P.
    Last edited by drrazor; 06-04-2014 at 03:34 PM.

  2. #2
    Registered User
    Join Date
    04-04-2014
    Location
    Warsaw
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Solver - SolverAdd using variable in variable constrains doesn't work

    Any ideas?

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Solver - SolverAdd using variable in variable constrains doesn't work

    Maybe something closer to ...

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

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

    Re: Solver - SolverAdd using variable in variable constrains doesn't work

    I could be wrong, but I don't think Solver can accept a "formula" like E69*F65 in the constraint fields. I think if you want this kind of constraint, you will want to add a helper cell to calculate the constraint (maybe G65=E69*F65), then reference G65 in your Solver constraint.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Solver - SolverAdd using variable in variable constrains doesn't work

    It's not a formula, MrS, it resolves to a value at runtime. It doesn't change over the course of Solver's progress.

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

    Re: Solver - SolverAdd using variable in variable constrains doesn't work

    My mistake.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Solver - SolverAdd using variable in variable constrains doesn't work

    Not necessarily -- that may have been the OP's intent, it's just not the way it works.

  8. #8
    Registered User
    Join Date
    04-04-2014
    Location
    Warsaw
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Solver - SolverAdd using variable in variable constrains doesn't work

    Yes, I've put there a formula, because a.Offset(-12, -3) is one of the variables that should be changed to find optimal solution.

    When I enter it manually like this V is for VALUE, F for FORMULA, but formula it's not complicated it's like VLOOKUP and SUM, only in last $J$81 this formula is more complex:
    Capture.GIF

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Solver - SolverAdd using variable in variable constrains doesn't work

    "(cell) = integer" means nothing to Solver, nor does "(cell) = (formula)"

    See http://www.solver.com/content/basic-...ete-constraint

  10. #10
    Registered User
    Join Date
    04-04-2014
    Location
    Warsaw
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Solver - SolverAdd using variable in variable constrains doesn't work

    Thanks both of you guys! That solution worked really well, I replaced function from constraint, put it into cell and added that cell to variable.

    The question now is how to speed it up? Calculation takes a lot of time, something like 25 seconds multiplied by 1000 cases equals 'forever'.

    Regards,
    P

  11. #11
    Registered User
    Join Date
    04-04-2014
    Location
    Warsaw
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Solver - SolverAdd using variable in variable constrains doesn't work


  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Solver - SolverAdd using variable in variable constrains doesn't work

    You're welcome.

+ 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] Variable doesn't seem to work
    By davepoth in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-11-2013, 08:21 AM
  2. Optimization problem when Solver doesn't work
    By fouzi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2012, 09:53 AM
  3. Variable doesn't work based on type
    By carsto in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-11-2007, 09:35 AM
  4. Using a variable in solver
    By Stephen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2006, 11:15 AM
  5. Excel Solver with Macro doesn't work
    By Jukka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-10-2005, 01: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