+ Reply to Thread
Results 1 to 9 of 9

Solver, # of categories used Constraint

  1. #1
    Registered User
    Join Date
    04-02-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2013
    Posts
    5

    Solver, # of categories used Constraint

    So I have Solver set up to select 6 items from a list that each have 1 of 10 categories. Setting min/max's on totals from specific categories is no problem, but I don't want it to pick 20 items from 10 different categories, i want to limit it to only use 3 (of it's choosing, not mine). What would be a way to do this?

  2. #2
    Forum Contributor
    Join Date
    12-26-2008
    Location
    India
    MS-Off Ver
    2007
    Posts
    122

    Re: Solver, # of categories used Constraint

    Post sample workbook..

  3. #3
    Registered User
    Join Date
    04-02-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Solver, # of categories used Constraint

    my bad.
    sample.xlsx

    I want to be able to set a constraint so that it only uses 3 categories

  4. #4
    Registered User
    Join Date
    04-02-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Solver, # of categories used Constraint

    Just one bump. Any ideas?

  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, # of categories used Constraint

    i want to limit it to only use 3
    Only 3 categories or only 3 items from each category?

    Alf

  6. #6
    Registered User
    Join Date
    04-02-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Solver, # of categories used Constraint

    only 3 categories.

    so in the sample workbook, i want a way to limit it to using just 3 (or 2, or 1 or whtever) colors.

  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, # of categories used Constraint

    Perhaps a Solver model like this? Since I use the COUNTIFS function (cell K24) to set the constraint for the maximum numbers of colours to use I had set up this model using the "Evolutionary Solver" as both the "GRG Nonlinear" and the "Simplex LP" can not cope with discontinuous functions like "If", "Countif" and "Sumif".

    I've also shuffled the cost and ratings a bit i.e. trying to match highest cost with highest ratings since I needed three 9 X 4 matrixes (one cost, one rating and one binary), don't know if this is an acceptable solution.

    Alf
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-02-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Solver, # of categories used Constraint

    Appreciate the idea, the new look at things gives me some other ideas, but keeping it as Simplex LP is pretty important as actual optimal results and speed of the run are both important.

    My hunch is that there is not a way to do what I'd like while keeping things linear, but wanted to see if there were any ideas on here before I give up.

  9. #9
    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, # of categories used Constraint

    Perhaps like this then as this model is set up for solving the problem using the "Simplex LP".

    I've introduced a starting constraint (sum of values in binary grid). After solver found a solution the values in binary grid is checked to find the number of categories selected.

    If there is no match between categories selected and set number of categories then the starting constraint can be changed and solver rerun.

    The easiest solution would probably be to set up a macro running solver in a loop until categories selected are equal to set number of categories.

    Alf
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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