+ Reply to Thread
Results 1 to 3 of 3

Obtain Solver (in between) optimized variables when solver is called in a loop multiple ti

  1. #1
    Registered User
    Join Date
    06-02-2020
    Location
    Leiderdorp, The Netherlands
    MS-Off Ver
    Office 365
    Posts
    2

    Question Obtain Solver (in between) optimized variables when solver is called in a loop multiple ti

    Hi There,

    This is my first post so please forgive my ignorance. I read the forum rules and think I am not infringing them.

    I have a problem related to optimization of a number of variables. I am calling the solver in a loop and I wrote a criterium function which resides in the Solver SetCell of the worksheet. The code works fine and the solver dumps all optimized variables once the loop is completed and the macro code ended. So far so good. However I would like to get better results by using the optimized variables from one step as starting values to calculate the optimized variables in the next step in the loop. I am not able to force solver to give the optimized variables in the completed step of the loop.

    Conceptually the code looks like:

    Please Login or Register  to view this content.
    I really tried to find this on the Internet but did not succeed.

    Any help is appreciated.

    Thank you
    Roel

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

    Re: Obtain Solver (in between) optimized variables when solver is called in a loop multipl

    '==> Here I would like to obtain the optimized values from step i as starting values for step i+1
    '==> So I would write them in the "By Changing Variable Cells" for the next i
    It should be as simple as reading the values from the old by changing cells/range using the Range(...).Value property, then writing those values to the new cells/range using the same property. A statement like newrange.Value=oldrange.Value would work. If you are unfamiliar with the Range object and the .Value property, you might start here: https://docs.microsoft.com/en-us/off....Range(object)
    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
    06-02-2020
    Location
    Leiderdorp, The Netherlands
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Obtain Solver (in between) optimized variables when solver is called in a loop multipl

    Thanks Mr Shorty,

    Sorry for the late response!
    It worked! I did not know that it was possible to read the contents of a cell although the Solver did not (at least visually) dumped the values of the optimized parameters in the cell. Appearantly a memory representation of the cell is called if you store in the range object, in stead of the value displayed in the cell. But that is stuff for the experts I guess.

    Cheers!

+ 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] Solver in a Loop for multiple rows by changing multiple columns
    By glauberpontes in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-30-2018, 01:45 PM
  2. Excel Solver - Multiple By Changing Variables
    By PingPongYeah in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2018, 02:20 PM
  3. Replies: 1
    Last Post: 04-27-2016, 03:05 PM
  4. Solver loop with 2 sets of decision variables
    By Willie68 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-24-2014, 07:19 PM
  5. [SOLVED] Solver does not always work when called from VBA
    By Nnkalita in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2013, 07:14 PM
  6. [SOLVED] [SOLVED] Missing condition after solver called by macro
    By samkut@web.de in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2006, 11:55 AM
  7. Solver does not solve when called from a macro
    By mjd918 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-19-2006, 10:55 AM

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