OpenSolver for Excel
The Open Source Optimization Solver for Excel
We welcome your comments on OpenSolver.
I am using Open Solver Advanced 2.9.0 with my students for both Mac and Windows. My students running Windows 11 are having issue with it remaining installed on the Data tab in Excel. It runs fine but they need to reinstall it each time they open Excel. Any advice?
That is a new issue we have not heard of before. These glitches are often caused by, and then fixed by, Microsoft making code changes; let’s wait a bit and see if it goes away. For the record, could you post (or email if you are worried about privacy) the text of the About OpenSolver window so we get a record of the exact Excel version.
By the way, I do not install OpenSolver, but instead just ‘pin’ it in the Open File list so I can open it when I need it; this is good advice for lots of add-ins as it means Excel starts faster. it would also address your issue as a work-around.
copy files to likethis “C:\Program Files (x86)\Microsoft Office\root\Office16\Library\SOLVER”。
This little message to tell you how I love your tool. Your solver solution is far better than the main other alternative, since it works as well and models don’t have size limits.
Many thanks for creating and maintaining such a fantastic tool.
Thanks for your kind words. Andrew
Dear OpenSolver Team,
Thank you for continuing to update this fantastic tool, I use it daily.
One question I have, and maybe this already exists I just haven’t found it… is there a way to set up a Macro for OpenSolver Model options? I have a couple spreadsheets where the data changes, but I run the same OpenSolver model on them, sometimes multiple times a day. Is there a way that I could set up a Macro to fill in the Model options since the objective cell, variable cells, and constraints are always the same? I tried doing this with the Macro feature within Excel, but as anticipated the options selected for the OpenSolver Model did not save and carry over in the Excel macro.
Any help or direction is greatly appreciated, or if this does not exist yet considering it for a future version would be awesome.
You can do this with VBA, but no, we do not have support for recording macros. Can you just duplicate the sheet instead; this will copy the model settings with it. Andrew
One possible solution that works for me is to have two workbooks – one with the data and the other running OpenSolver. Using VBA, as Andrew suggested, simply ‘feed’ the new data to the workbook that launches OpenSolver by either copying the relevant cells or copying the whole worksheet. With a click of a button, the new data is transferred and then you can either manually start OpenSolver or do it programmatically. Mine, unlike yours, has variable data where the constraints, variable cells, and objective cells changes from one run to the next and VBA can be set up to perform this as well.
In regards to filling in the model options, these can be controlled via VBA using the ‘OpenSolver API References’ listed under the ‘Using OpenSolver’ tab. For instance, changing the Branch & Bound Tolerance from the default 5% to another value, like 20%, can be made by simply adding a line like “SetToleranceAsPercentage (20)” to your VBA code.
I love this software!!!
Dear Open Solver Team,
I am using Open Solver dialog box to build the model manually, but this a daunting task to do repetitively when I have to build and run model 6 times by changing objective, variable and constraints.
I am able to change objective and variables using VBA, but unable to add, set or update constraints using VBA code. I tried this code :
Dim TestSheet As Worksheet
Set TestSheet = Sheets(“Dispatch Planning Model”)
Application.Run “OpenSolver.xlam!OpenSolverAPI.ResetModel”, TestSheet
Application.Run “OpenSolver.xlam!OpenSolverAPI.SetObjectiveFunctionCell”, TestSheet.Range(“Z1”), TestSheet
Application.Run “OpenSolver.xlam!OpenSolverAPI.SetDecisionVariables”, TestSheet.Range(“y4:y22”), TestSheet
Application.Run “OpenSolver.xlam!OpenSolverAPI.AddConstraint”, 1, TestSheet.Range(“y4:y22”), RelationINT, TestSheet – this line of my code gets error.
Thanks again for your tool!
I have not found an answer to a question that seems simple to me. Server Neos uses the “Short priority: Send to higher priority queue with maximum CPU time of 5 minutes” setting in the job settings on its website. I can disable this option on the site because tasks are usually done so quickly. But OpenSolver when specifying, for example, “NEOS using CPLEX” explicitly uses “Short Priority”, and the complex task crashes after 5 minutes.
Can this be changed somewhere in the model settings?
With deep respect.
A quick check of the code suggests OpenSolver does not yet have the option for long runs on NEOS. I will add it to the ToDo list. Thanks for raising this, Andrew
First use. On Google Sheets.
An unexpected error occurred:
Unexpected token < in JSON at position 0
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at SolverSolveEngine.submitJob (solverSolveEngine:180:21)
at SolverSolveEngine.solve (solverSolveEngine:119:20)
at OpenSolver.solve (openSolver:696:28)
at OpenSolver.solveModel (openSolver:164:12)
at solveModel (sidebar:207:21)
Good day, dear developers!
Thanks a lot for the great tool! I was amazed at the efficiency of solving integer programming problems for 20-30 thousand variables.
I enjoy teaching my OpenSolver students on my MBA course.
I recently came across an integer linear optimization problem that only has 161 binary variables and cannot be solved with OpenSolver (or it takes more than 12 hours to solve).
Excel file link: https://1drv.ms/u/s!ArFRI2i3V3yXl_ddltR-08_O9pumjQ?e=yfe1ze
The task schedules delivery days for 7 days of the week and 23 stores (binary variables E2: K24). I want to schedule a given number of deliveries D2: D24 for each store. The goal is to achieve a minimum difference in the loading of the central warehouse on different days of the week.
(The real problem is a little more complicated, but that’s enough.)
Surprisingly, the Calc Solver add-in (LibreOffice) solves the problem in a few minutes and gives the solution shown in the file (for example).
Can you please tell me what is the problem? The task looks very simple.
Best regards, Sergei.
I was able to figure out how to overcome the described complexity.
In my opinion, a problem occurs when a problem has a large number of equally good solutions.
Tracking the optimization process shows that the algorithm quickly achieves excellent objective function values, and then continues to look for even better options.
From the point of view of practice, it is necessary to limit the objective function to some reasonable value. For minimization, this is the lower bound.
After that, the practical problem is solved quickly enough.
Sincerely yours, Sergei.
Sergei: This is the behaviour we expect. Proving we have the best solution is often much harder than finding the best solution. Try to change your equations to remove equivalent equally-good solutions by, for example, giving staff small random preferences (i.e. slightly lower costs) for shifts (or whatever makes sense for your problem). Setting a large optimality tolerance can also help reduce run times. Andrew
First of all thanks for the excellent tool.
It would be great if you could have the possibility to give meaningful names/titles to constraints. If there is big list of constraints, it sometimes hard to find the one you would like change. Also it would make easier to understand the model being handled.
Dear OpenSolver developers:
I am a huge fan of using Excel when modelling Process Engineering simulations.
I have been using circular references, scaling and GRG, and find it quite powerful.
However, I sometimes miss a more powerful non linear solver, such as the ones you have implemented.
I have been trying to use OpenSolver, but seems to get into trouble when dealing with circular references.
May I ask you to state if this is the case? If so, are you planning on embedding OpenSolver with native circular references?
Thank you in advance.
You should add circular references as constraints. I have not tried this, but it should work. You then need to manually break the cycle yourself; the OpenSolver constraint ‘completes’ the cycle. Let us know if it works, Andrew
Hi Andrew, definitely inspired by the opensolver. I have a nonlinear problem that causes the original excel solver to solve in around 3 mins, but thats too slow for my required procedure. I tried to use your opensolver to solve it with NOMAD and Bonmin. However, both methods try to find global solutions which cost an even longer time to solve the problem. I was trying to find a way to find a local solution, faster than 3 mins, but seems there is no local engine in your add in. I found an engine, called Ipopt, which could possibly find a local solution, but is there a way we could load new engine into your add-in please? Thank you for your time
You already have IPOpt… it is built into both Bonmin and Couenne. Andrew
Hello, OpenSolver team.
I’m always using OpenSolver in my own macros. I am very grateful to you for developing such a useful tool.
Recently, I noticed a strange phenomenon. When I run OpenSolver with a “camera tool” on one sheet displaying information from another sheet, the solving time becomes extremely long. It looks like OpenSolver and “camera tool” are interfering with each other.
If you know the cause or the solution, I would appreciate it if you could let me know.
That is a new one to us… but anything that needs updating if the sheet changes will slow down OpenSolver. Andrew
Error in loading DLL (Error 48)，Automation error (Error 440)
Excel will report errors when running on the computer. No loss is found in the reference, but it works normally on another computer
I am just thinking about using OpenSolver, and I would like to know if it is possible to define the problem in Excel and then save it as mps or gurobi file or in another syntax. Thank you.
Yes; if you open the working files directory (using the OpenSolver menu), then you can see the .lp file. But, don’t forget that OpenSolver can run Gurobi directly for you. Cheers, Andrew
On the webpage: https://opensolver.org/opensolver-for-google-sheets/
“You can install the OpenSolver Add-on by clicking on the Chrome Web Store link below” but I couldn’t find any such link.
“When you start OpenSolver” but the webpage does not contain a description of starting OpenSolver within Google Sheets.
OpenSolver for Google Sheets is currently unavailable because of issues with changes made by Google that we are working through. Sorry about this, Andrew
I tried every free solver and minimizer available free of cost.
This is by far my favorite because it’s simple. Personally prefer this over SolverStudio because it can do what I want with minimum programming work on my side.
-minimizing one cell calculated in a spreadsheet
-larger than 200 variables. (So standard solver couldn’t handle it.)
This works. My suggestions follow
-On installation, it seems to work better with OpenSolver extracted into the MS Excel Addin’s folder. Specifically, if one clicks: file->options(at the bottom left)->Add-Ins-> Go (after manage in the middle with excel add-ins selected)-> browse (on analysis toolpak) -> it will take you to the addins folder. Copy OpenSolver to there.
-when selecting constraints and variables sometimes it seems to mess up and write the same cells multiple times. Sheet1!$A$1:$C$8 is how it should look as shown in the examples. Where ‘Sheet1!” = sheet name. $A$1:$C$8 = rows and columns from A1 to C8.
Very grateful for this OpenSolver. Well done Andrew Mason.
Your email address will not be published. Required fields are marked *