Find multiple unique solutions with Solver

jvanspro

New Member
Joined
Nov 10, 2015
Messages
4
Is there a way to find multiple unique solutions with solver. I've been trying to figure out how to do this for some time now. I created a lineup optimizer for the NBA. Unfortunately I can only use solver to find 1 lineup that fits within the parameters. Is there a way to find multiple solutions and paste them to another worksheet? I have a cell in the worksheet to specify the quantity of lineups I'd like solver to run. Attahced is my document. Any tips would be great. Thanks in advance

000George Hill570025.36479PG00000
000Gorgui Dieng480025.23017C00000
SFSF 11Andre Iguodala490025.17617SF00100
000Kent Bazemore550025.15036SG00000
SFSF 21Omri Casspi500025.12288SF00100
000Mason Plumlee530025.10088C00000
000Elfrid Payton67000PG00000
000Victor Oladipo67000SG00000
000Evan Turner530024.18087SF00000
000C.J. Miles540023.94174SF00000
000Robert Covington640023.77627SF00000
000Kentavious Caldwell-Pope590023.70477SG00000
000Klay Thompson690023.49132SG00000
000Tim Duncan620023.44853C00000
000DeAndre Jordan740023.29851C00000
000Darren Collison530023.26877PG00000
000Ian Mahinmi530023.15842C00000
000Jordan Hill460023.00413C00000
000Kenneth Faried660022.83006PF00000
000Will Barton600022.82795SG00000
000Raymond Felton490022.53249PG00000
000Joe Johnson530022.40724SG00000
SGSG 21Kevin Martin430022.38979SG01000
PlayersTotal Salary60000
9Maximum Salary60000# of Lineups10
9Total Points300.2683
PG 1Brandon KnightPHO760038.20131Position# of PlayersMinMax
PG 2Tyreke EvansNOP720038.05809PG222
SG 1Eric GordonNOP490026.62158SG222
SG 2Kevin MartinMIN430022.38979SF222
clip_image002.png

<tbody>
</tbody>
SF 1Andre IguodalaGSW490025.17617PF222
SF 2Omri CasspiSAC500025.12288C111
PF 1Anthony DavisNOP1050047.6931
PF 2Ryan AndersonNOP660029.59775
C 1Andre DrummondDET900047.4076
Total Points300.2683

<tbody>
</tbody>
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
What option best describes your problem?

1) You know multiple solutions exist for a given set of constraints and Solver stops at the first one. This means one problem has multiple solutions and we are dealing with a single problem.

2) You want to change at least one constraint and run Solver again to find another solution. This means one problem has one solution and we are dealing with multiple problems and solutions.
 
Upvote 0
First off thank you for replying. I've been struggling with this for awhile. Option 1 best describes my problem. I would like solver to give multiple solutions based on the number I specify. For example, if I have the 10 in cell c6, I would like solver to find 10 solutions and display the results in another worksheet. I have a copy of the file if you'd like to view it to better understand the issue I'm running into. I don't see an attach option.
 
Upvote 0
What concerns me is, does ten solutions exist for a fixed set of constraints?

You can upload the workbook to a sharing site like Drop Box and paste a link here. I’ll get back to you if I don´t understand your project.
 
Upvote 0
Attached is a link to the file. Within the file there are many worksheets. The ones I'm working on are "Optimal Lineup" and "Lineups." They are the 2nd and 3rd on the list. Solver is in the "Optimal Lineup" sheet. There is a button called "Find optimal lineup" that runs solver. Above the button is a call with a number, that I want to tell solver how many unique solutions I'd like it to find. Then copy and paste the solutions into the worksheet "Lineups."

I understand that all solutions will not be perfect and some will have a higher score than others but I'd like to use my judgement to choose one.

thanks again for the help and support as I've been working on this for awhile and haven't been able to figure out how to do it.

https://www.dropbox.com/s/k2k0qpflnepz22n/NBA Projections.xls?dl=0
 
Upvote 0
It’s not guaranteed that you will get the specified number of solutions, but running the macro repeatedly will probably produce different solutions:

Code:
Dim opt As Worksheet, v%


Sub FindLineupNBA()
Set opt = Sheets("Optimal Lineup")
v = CInt(opt.Range("j204"))
solveroptions 0, 1000, 0.000001, , False, , 1, , 0.1, True, 0.0001, True, 200, 0, False, True, 0.075, v, v, False, 30
opt.Activate
SolverOk SetCell:="$E$206", MaxMinVal:=1, ValueOf:=0, ByChange:="$C$2:$C$201", Engine:=3, EngineDesc:="Evolutionary"
SolverSolve (True), "ShowTrial"
End Sub


Function ShowTrial(Reason%)
Dim r As Range, lu As Worksheet
Set lu = Sheets("Lineups")
MsgBox Reason
opt.UsedRange.Copy
Set r = lu.Cells(lu.Range("a" & Rows.Count).End(xlUp).Row + 2, 1)
r.PasteSpecial xlPasteValues, xlPasteSpecialOperationNone, False, False     ' paste intermediate result
ShowTrial = 0
End Function
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,935
Members
449,195
Latest member
Stevenciu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top