+ Reply to Thread
Results 1 to 2 of 2

Looping over the Solver

  1. #1
    Registered User
    Join Date
    09-26-2019
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    2017
    Posts
    1

    Looping over the Solver

    Hi,

    I'm trying to make a tool that solves a linear system of equations using the solver. I've recorded a macro to figure out how VBA fills the solver, now I simply want to loop over all constraints that I want to add using a counter. This all goes well escept when:

    - The constraint is ' > 1'
    - The constraint is 'output should be integers'

    I've tried to step by step go over the code, and it shows in yellow that the code responsible for the above constraints is executed. But after running the macro specifically the above constraints are missing from the solver.

    The loop code:
    Please Login or Register  to view this content.
    where 'Var' is the number of variables X1...Xn
    And 'st' is the number of constraints

    When I manually use the solver on a dummy-system, it works fine. When I use VBA to do the exact same thing, it just ignores constraint iff
    Cells(10 + c, 5).Value = 1
    And it just skips the integer part always
    even though using F8 shows that it goes over the code

    If anyone knows what's going on here, please let me know!

  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: Looping over the Solver

    Please Login or Register  to view this content.
    This looks strange to me as I assume you wish to go from 0 to say -5 in steps of -1 i.e.

    Please Login or Register  to view this content.
    As for skipping the integer constraint, the default setting for solver is "ignore Ingres constraint" so check setting under Options if box marked "Ignore ..." is ticked. If so untick.

    Alf
    Last edited by Alf; 09-27-2019 at 06:30 AM.

+ 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. Looping with solver
    By kawhi2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-10-2016, 10:24 PM
  2. Looping Solver in VBA
    By cmondeau in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-01-2014, 05:07 PM
  3. Solver Looping
    By Weston12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-10-2014, 07:31 PM
  4. looping of Solver in VBA
    By bored in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-14-2010, 11:28 AM
  5. Looping and Solver
    By junejaja in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2008, 11:53 AM
  6. Looping a Solver
    By Peter1999 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-31-2007, 08:32 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