Welcome to the OpenSolver on-line help.
We hope that most of your questions will be answered on the Using OpenSolver page. However, if you still have a question, please post it below.
Building Linear Programming models
Writing optimisation models that only use linear mathematical equations and inequalities is not easy. However, most of the time you want to build these “linear programming” models (and avoid non-linear models) because these are easier and more reliable to solve using packages such as OpenSolver. (OpenSolver uses CBC by default to solve these linear programmes.) Check out this Wiki page on linear programming.
The AIMMS folks have a great online chapter describing how to take non-linear requirements (local copy of pdf) and model them using linear programming. (Thanks to Stu Mitchell of PuLP fame for pointing out this resource.) The NEOS guide is also a great resource. If you still have a modelling question (e.g., how do I express this requirement using the rules for a linear program), please ask it on https://www.or-exchange.org/.
Common Software Problems
Excel can have problems dealing with add-ons. Visit http://www.add-ins.com/how_to_repair_office.htm for a guide on fixing these.
1. OpenSolver not loading – July 2016 Office update (no error message)
In July 2016, MicroSoft released an update to Office 365 which prevents OpenSolver from loading unless the .zip file is “unblocked” before the files are extracted. (We expect this change to appear in other versions of Excel.) The symptoms are simply that OpenSolver does not appear in the Data tab; there is no error message shown. To fix this, delete your old OpenSolver files (but not the downloaded .zip file), right click the downloaded OpenSolver .zip file, choose Properties, and click the Unblock button which will show if the file is blocked. Once the file is unblock, close the properties dialog, and then un-zip the files and open up OpenSolver.xlam as usual.
2. Unable to find the external solver …
If OpenSolver reports this problem, then it could not find a solver file that comes with OpenSolver. Please check that you have extracted (i.e. un-zipped or uncompressed) all the files from the OpenSolver download.
3. The solver did not create a solution file.
If this error is reported, then it is likely that OpenSolver was unable to run the solver executable. This may happen if the OpenSolver files are in an ‘untrusted’ location, and so Windows will not let them be run. First check whether the solver is shown as found in the “About OpenSolver” form. If not, go to the folder identified in the “About OpenSolver” form and double click on this solver file. You should then see a command window open that gives the solver name and version information etc. If you don’t see this, then Windows should give you an error message to help you diagnose the problem. It may help to move the OpenSolver folder (and all the files it contains) into a location such as your Documents, or even into Program Files, and try again.
4. Solver crashes; OpenSolver reports no solution file
The files in the “Solver” folder provided with OpenSolver contain the actual solver code. These solvers are being continually upgraded as bugs are reported and fixed. If OpenSolver reports that no solution file was generated, then the solver may have crashed. This can happen on big problems when the solver runs out of memory, but also on smaller problems that happen to hit a solver bug. In such cases, you should check if a newer version of OpenSolver is available since we regularly update the solvers included with OpenSolver as they are released.
With CBC, a typical OpenSolver error for thois problem message might be: ‘The CBC solver did not complete, but aborted with the error code -1073741510’
If needed, you can download the latest version of CBC, Bonmin or Couenne from AMPL. Download the either the Windows or Mac version as appropriate. For Windows, get the 32-bit version if you have 32-bit Windows, or the 64-bit version otherwise. (The 64 bit version will solve much larger problems than the standard 32 bit version included in OpenSolver, so always choose this if possible. Right-clicking on Computer, and choosing Properties, will tell you if have a 32 or 64 bit system type.) Right click on the downloaded .zip file, choose Properties, and click the Unblock button if there is one. Then, open the .zip file, and drag the files into the right location in your OpenSolver Solvers folder (the win32, win64 or osx folder as appropriate), replacing the existing files. This may fix your problem.
Report a CBC bug
If after installing the latest version of CBC, CBC still crashes on you, then you may wish to report a bug. Please be sure to include the .lp file produced by OpenSolver; you can open this file using “View Last Model .lp File”. CBC bugs can be reported by either:
- The online CBC TRAC bug reporting system (which you will have to register for), or
- The CBC mail list
Switch from CBC to Gurobi
Since August 2014, OpenSolver has also supported solving models using the Gurobi solver. You can obtain a copy of this solver at no charge if you are at a university. Gurobi is faster and more stable than CBC, and comes highly recommended.
5. Repairing Excel
Sometimes it is useful (if all else fails) to repair your Office installation:
Windows
See these Microsoft Office 2010 and later instructions (or in Excel 2007, use Excel’s application menu, then Excel Options, then Resources, then “run Microsoft Office Diagnostics”). You might also want to look at http://support.microsoft.com/kb/166273, which talks about this.
Mac
Unfortunately there is no easy way to repair the Office 2011 installation. The best option is to follow these instructions to completely uninstall Office. You can then install Office again from scratch to get a clean version installed.
6. ‘Can’t find project or library’ : Missing Reference Errors
OpenSolver uses the “RefEdit” control, which we need but which can cause problems because of missing references caused by version changes. To check for missing references, using the VBA editor (which you access using Alt-F11), select OpenSolver (openSolver.xlam) in the Project window, choose Tools… References, and look for a “Missing:” line. If you see this, un-check that line, close the dialog, and choose File … Save OpenSolver.xlam to update the file. If this doesn’t help, try the above steps for repairing Excel.
7. Error 70: Unable to delete the file: C:\Users\XXXXXX\AppData\Local\Temp\log1.tmp
This errors happens if Excel crashes while OpenSolver is running, leaving log1.tmp open. Please restart your computer, which will close this file, and try again.
8. OpenSolver was working on my Mac. Then I updated to Excel 16.16.7 (released late 2018) and OpenSolver stopped working. What do I do?
We have had numerous users report this issue. We are looking for a Mac user with VBA experience to help us diagnose this problem. Please contact us at email hidden; JavaScript is required if you can help.
9. OpenSolver does not work in Excel installed from the Windows Store
Windows Store versions of Office applications do not support Add-ins such as OpenSolver; see this link, or this support page for another add-in, or this technical article from Add-in Express. This Dell article explains a little more. If you have a Windows Store version, it will display this in the Excel Version information, such as in the following example:
Version 1807 (Build 10325.20082 Microsoft Store)
The solution is to un-install Excel, and install the click-to-run versions, in which case the Excel version will change from ‘Microsoft Store’ to ‘Click-to-Run’. Standard installs (meaning not Office 365) don’t have this issue.
Hi,
I’ve got exactly the same issues as Mark reported on October 22nd:
recently I’ve been having trouble making updates to the model and saving it. I keep getting an error:
… [OpenSolver.xlam] CModel.BuildModel: Line 3937
… [OpenSolver.xlam] FModel.cmdBuild_Click: Line 4448
Error 438: Object doesn’t support this property or method
Repairing Office did not help.
Any thoughts?
Thanks,
Thomas
Can you please confirm exactly when the error happens (eg clicking Save Model?), and perhaps send a screen shot showing the error to email hidden; JavaScript is required? It might good to also send us your spreadsheet. Andrew
Andrew,
I found the reason in the meantime by newly setting-up the model:
I defined contraints whith limits <= 1. The solver does not accept that (to whatever reason).
My workaround is to multiply those cells by 100 (and correct all other formulars accordingly) and set the limit of the contraints to <= 100.
Don't understand why, but now it works.
Regards,
Thomas
That is weird. Are you running on an US/English system? Are you entering the 1 as 1 or 1.? Are you typing this value directly into the constraint right hand side in the model dialog (or into a cell on the sheet)? Andrew
I’m running on a German system (DE), typing in as 1 directly in the model dialogue. Also 1,0 and 1,00001 did not work. I also tried to change the format of the cells which contain the constrains to “standard” and “number” without success.
When I make the same in the excel solver dialogue, the 1 is accepted and the OpenSolver is running – but gives the error message when I try to save the model…
Thanks a lot for the detailed information; we will follow up this very odd bug. Andrew
I’m getting the same “No Solution Found (unbounded)” error that a few other people have mentioned. I appreciate the suggestion to check my model (user error is always a good guess), but the exact same model works with the built-in excel solver and generates accurate results. My model is pretty simple, essentially just trying to recreate: https://support.office.com/en-ca/article/Using-Solver-to-rate-sports-teams-f063257d-1008-46b7-8811-c723c64a7651#bm1
Any ideas for why the method used in that article wouldn’t work? (pardon if this is double posted – having trouble with the Captcha)
A common cause is the model being non-linear, but OpenSolver not detecting this. (We have since confirmed this was the case here). Andrew
I’m using opensolver with google sheets and have a model setup. However, if I copy the entire sheet the model disappears and I have to reenter all the parameters. Is there a way to keep this from happening? I’d like to have one template file that I keep and then make a copy to use everyday.
Thanks
Hi Andrew,
Unfortunately this isn’t possible with Google Sheets – we can’t store the model information in the sheet like we do in Excel. We are currently working on adding support for one model per sheet (like Excel), and as part of that we could certainly add the ability to copy a model from another sheet, which would be a useful function given the constraints of Google Sheets.
Hey Jack,
Kinda in line with this same thing…is there a way to use Open Solver mobile in any way? Be it through Google Sheets or excel? Right now I have a google sheet and an excel document that both use open solver (very awesomely btw) and I would like to know if there is a way I could use / access this on my iphone?
Thanks
Hi Jose,
Short answer: Not right now sorry.
I don’t think Google Sheets currently supports Addons on its mobile versions, no idea if/when that might happen.
I believe the Excel app for iPad does support Excel add-ins, or at least is in the process of gaining support, but only for their new types of add-ins, which are the same as the ones that run on Office 365. We don’t have a 365 add-in ready, so Excel on mobile isn’t an option right now either.
The other caveat to both of these (if/when they happen) is that all the solving would have to be remote, and so would require internet access to use.
Hi guys
Trying to run an LP using CBC however the solution only uses two of my ten columns of variables, leaving a solution far from the optimum. I have the same constraints as a friend and his solution is optimum. When I use his spreadsheet on my computer I get the same problem, and it changes his optimum solution to my less optimum one.
Any idea what the problem may be?
Cheers
Mike
Do you have any integer or binary variables? If so, and you want optimal solutions, you need to set the Branch and Bound Tolerance to 0%. Otherwise, you may get “good enough” solutions that differ from your friend’s also “good enough” solutions.
Unfortunately that hasn’t worked either, am I able to send you my spreadsheet so you can have a look?
The newer versions of OpenSolver are better at enforcing the limits set in the Solve Options dialog. Please check that the maximimum number of iterations and solution times are very large numbers, eg 999999999. Please let us know if that fixes your problem. Andrew
Love the software, thanks for making it. Any idea when this will be available for Mac Excel 2016?
No date yet, sorry; Excel on the Mac is very much a moving target as Microsoft fix the multiple bugs! Andrew
Hi,
I’m trying to do the following (In general – I’m trying to write a function, and part of it will be to solve a MLE):
1. Setting initial values through the vba code (not using ranges, but using variables) – The reason is that i want it to be fast + be a part of another, much larger spreadsheet function I’m writing.
2. Finding the global optimization solution (I’m not sure it’s automatic in the solvers offered in open solver, but setting variables allows me to change the starting points)
3. Return the solution array (In my case, It’s 3 parameters).
Is it possible to accomplish any / all of this with OpenSolver?
Thank you for any help or pointers you could offer.
As long as you set/get variables values via the decision cells on the sheet it should all work. Andrew
Hi, I am currently trying to optimize a scheduling problem to maximize my profits, where 1 = schedule and 0 = do not schedule. There are functions like index match and if. I’m using Opensolver Nomad because the number of decision variables exceed 200.
However, i am unable to get an optimised solution and the decision variables do not change. Is there any way I can use Opensolver for this?
NOMAD is getting stuck because of your index, match etc. Reformating this with binary variables should help. Andrew
I have been having issues with a Method ‘Range’ of object ‘_Worksheet’ failed error on all of the non-default solver engines.
This is all that is in the log:
30 Oct 15 01:08:09 [OpenSolver.xlam] CModelParsed.ExpandFormula: Line 5212
30 Oct 15 01:08:09 [OpenSolver.xlam] CModelParsed.ParseFormulae: Line 4923
30 Oct 15 01:08:09 [OpenSolver.xlam] CModelParsed.ProcessSolverModel: Line 4817
30 Oct 15 01:08:09 [OpenSolver.xlam] COpenSolver.BuildModelFromSolverData: Line 1186
30 Oct 15 01:08:09 [OpenSolver.xlam] OpenSolverAPI.RunOpenSolver: Line 0
Error 1004: Method ‘Range’ of object ‘_Worksheet’ failed
Solver: Couenne
Version 2.7.1 (2015.06.28) running on 64-bit Windows 6.2 with VBA7 in 32-bit Excel 15.0
Sorry it is not working. Does your model cross multiple sheets? We cannot handle that. If not, please email us your sheet to andrew at opensolver.org. Thanks, Andrew
I think I figured it out – I was using Table names instead of explicit cell references in many of the underlying formulas.
Pleased you got it working. Cheers, Andrew
Hi Chris, I am also facing same issue Method ‘Range’ of object ‘_Worksheet’ failed. I didn’t understand the resolution you had “Table names instead of explicit cell references in many of the underlying formulas.”. I am not using any tables, i gave cell references only. Can you pls share more details?
Good morning,
I have been using Opensolver to solve a linear program with 1062 decision variables. However, as I exceed this number of decision variables, I have been receiving the following error:
Error: the cell range specified for the Variable cells is invalid. This must be a valid Excel range that does not exceed Excel’s internal character count limits. Please correct this and try again.
Unfortunately, I have not been able to resolve this issue. I wonder if you would have any advice on how to proceed.
Thank you!
I assume that your range “exceeds Excel’s internal character count limits”. Replace A1, A3, A5, A7 it by something like B1:B4, and put “=B1” in A1, etc. Hope this helps. Andrew
Hi,
I’ve been working with the open solver for a few weeks without too much issue, but recently I’ve been having trouble making updates to the model and saving it. I keep getting an error:
21 Oct 15 19:39:06 [OpenSolver.xlam] CModel.BuildModel: Line 3937
21 Oct 15 19:39:06 [OpenSolver.xlam] FModel.cmdBuild_Click: Line 4448
Error 438: Object doesn’t support this property or method
Any thoughts?
Thanks,
Mark
I don’t remember seeing that error before. Can you please post (or email to email hidden; JavaScript is required) the contents of your About box. Can you also please try downloading a fresh copy of OpenSolver in case something has got corrupted, and repairing your Excel installation. Thanks, Andrew
Hi,
I’ve been working with the open solver for a few weeks without too much issue, but recently I’ve been having trouble making updates to the model and saving it. I keep getting an error:
21 Oct 15 19:39:06 [OpenSolver.xlam] CModel.BuildModel: Line 3937
21 Oct 15 19:39:06 [OpenSolver.xlam] FModel.cmdBuild_Click: Line 4448
Error 438: Object doesn’t support this property or method
Any thoughts?
Is there a way to save multiple models in the Google Sheets opensolver addin?
I tried copying the sheet and changed a few variables, and all said and done it also changed those variables when I went back and opened the model on the original sheet.
Sorry for the delay in getting back to you. This isn’t currently possible, the addin can only save one model per file right now. The next version that is released will have the ability to save multiple models, one per sheet as in Excel. We have already implemented the feature, we are just now in the process of fine-tuning it for release.
is there any way to solve the below problem in open solver? My colleague already solved it using IBM ILOG CPLEX solver. But we want to have open solver based solution as the end user are not comfortable using ILOG. They prefer Excel. http://math.stackexchange.com/questions/1476808/optimizing-contractor-schedules-operations-research-linear-programming
please explain how could i make my decision variable integer and/or binary. I couldnt find easy way to define variables as integer or binary. I am using “Version 2.7.1 (2015.06.28) running on 64-bit Windows 6.1 with VBA7 in 32-bit Excel 14.0”
You need to add a constraint. Good luck. Andrew
Hi All,
I keep getting “Error 6: Overflow” (message in the error log) while trying to solve a model. I can’t seem to get it work. Anybody experience with this error or suggestions on how to solve it? I have approx. 1.2 million decision variables. The model used to solve (like two months ago) when I was still using an OpenSolver version of 2011 (which I no longer have). I already tried to solve a smaller version of the model (with ~200k decision variables), but to no avail.
Version 2.7.1 (2015.06.28) running on 64-bit Windows 6.1 with VBA7 in 32-bit Excel 15.0
CBC v2.9.4 (64-bit)
Any help will be much appreciated. Thanks, Bram
Thanks for your report. This is a bug in the current (as of Oct 2015) release. The following code in CSolverCBC in ReadResults needs CInt() in “Index = CInt(SplitLine(StartOffset))” changed to val(), to give
While Not EOF(1)
Line Input #1, Line
SplitLine = SplitWithoutRepeats(Line, ” “)
‘ In the case of LpStatusInfeasible, we can get lines that start **. We strip the **
StartOffset = 0
If SplitLine(StartOffset) = “**” Then StartOffset = 1
Index = Val(SplitLine(StartOffset))
NameValue = SplitLine(StartOffset + 1)
If left(NameValue, 1) = “_” Then NameValue = Mid(NameValue, 2) ‘ Strip any _ character added to make a valid name
s.VarCell(j) = NameValue
s.FinalVarValue(j) = Val(SplitLine(StartOffset + 2))
If s.bGetDuals Then
value = Val(SplitLine(StartOffset + 3))
If s.ObjectiveSense = MaximiseObjective Then value = -value
Sorry about this bug; it will be fixed in the next release. I hope in the meantime that this fixes your overflow error. Andrew
Hi, Andrew! I have the exact same problem: Error 6: Overflow (Version 2.7.1 (2015.06.28) running on 64-bit Windows 6.1 with VBA7 in 32-bit Excel 14.0) in solving large-task. Among the methods available for editing module Opensolver no procedure ReadResults.
Please try searching the whole project not just one module. Andrew
Thanks you very mach, OpenSolver works fine.