### 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 OpenSolver Team!

Thanks so much for your work on this tool. It has been really useful!

I was just wondering whether you could help me with an issue. I am trying to run an optimisation model for 3 production factories which consume raw materials in different circuits within each factory. As the 3 factories are situated in different geographical locations, I want to keep the optimised solution within shipment lot sizes (for example, consumption of 3kt per raw material.

I tried solving this my creating a matrix which divides the decision variables by the lot size and adding a constraint which limits the results to integers. Unfortunately I then received the error message that this is a valid model, however OpenSolver does not support non-decision variables being constrained to binary or integers.

Would you know if there is another ‘work around’ or way of modelling this in order to keep the solution to shipment sizes? Or is there a way of allowing non-decision variables constrained to integers which could be supported by OpenSolver?

Thanks in advance!

To have a cell that is not a decision variable, but must be integer, you should add in an extra integer decision variable, and add a constraint forcing this to equal your “integer” cell. Good luck, Andrew

Hi OpenSolver-Team,

first of all – thank’s for your great tool! I have a problem using Opensolver with the VBA API to automate some models I use.

I use Excel 2007 and OpenSolver 2.9.3 (but the problem is still the same with older versions). I can see opensolver.xlam in the visual basic editor and if I define the model manually everthing works fine. OpenSolver is also visible in the AddIns list.

See this test code:

Sub vbatest()

Dim TestSheet As Worksheet

Set TestSheet = ActiveWorkbook.Worksheets(“Optimierung”)

OpenSolver.ResetModel Sheet:=TestSheet ‘Here the error Runtime Error 424 “Object Required” occurs

OpenSolver.SetObjectiveFunctionCell TestSheet.Cells(226, 7), Sheet:=TestSheet

OpenSolver.SetObjectiveSense MinimiseObjective, Sheet:=TestSheet

OpenSolver.SetDecisionVariables (TestSheet.Range(Cells(2, 9), Cells(2, 19))), Sheet:=TestSheet

End Sub

I always get the runtime error 424 ‘Object required’ in line 3. The name of the worksheet is spelled right. If I delete line 3 the error occurs in line 4. What I’m doing wrong?

Thanks for any help

Erik

how can I set model parameters only using integers? I don’t want them working as float.

You need to add them as constraints.

Hello, I wan to use OpenSlove to deal with an amount of data. However, the input of the model can only accept maxmium 16 inputs. How can I choose more inputs?

If I use selector to choose more than 16 inputs, the model went wrong and returns error logs.

I can’t use open solver because the error: warning the following constraint(s) do not appear to be linear. If I press continue nothing happens. What to do? Thank you for your help.

Hi Andrew, I have noticed a bug in the Open Solver. It incorrectly identifies a linear constraint as non-linear (part of the linearity check is reproduced below). I am pretty certain that my formulation is correct, and I have managed to solve it on another platform. Is this a known error?

This error only arises if the formula in cell G7 is changed from SUM(G12:G75) to SUMPRODUCT(G12:G75,E12:E75), where G12:G75 contains binary variables and E12:E75 contains constants

LINEARITY CHECK LOG

In the constraint: G7 <= I7,

the model appears to be non-linear in the decision variables: G12, G13, G14, G15, G16, G17, G18, G19, G20, G21, G22, G23, G24, G25, G26, G27, G28, G29, G30, G31, G32, G35, G36, G37, G38, G39, G40, G41, G42, G43, G44, G45, G46, G47, G48, G51, G52, G53, G54, G55, G56, G57, G58, G59, G60, G61, G62, G63, G64, G67, G68, G69, G70, G71, G72, G73, G74, G75

Thanks for the report. Please confirm that E12:E75 are all constants (i.e. simple numeric values). Andrew

Yes, the range E12:E75 are all numeric values.

Are they numeric constants, i.e. values you typed in and not formulae in the cells?

E12:E75 are numeric constants and not formulae in the cells.

G12:G75 are binary variables (not formulae). The error only arises when the formula in cell G7 is changed from SUM(G12:G75) to SUMPRODUCT(G12:G75,E12:E75)

Are you happy sending the spreadsheet to me? False non-linearity reports can often arise because of numerical issues where the coefficients are very large or very small; such models are poorly behaved both for solving and for linearity checking. It would be helpful to have an example of such a case that we could include in our testing. If you are happy, are you able to send the spreadsheet to email hidden; JavaScript is required ? Thanks, Andrew

Greetings, Dr. Mason

I have a number of large Minimum Cost Network Flow problems to do. These should have, among their solutions, entirely integer allocation sets, which I prefer to non-integer solutions.

In lieu of integer constraints, OpenSolver returns non-integer allocations with the correct objective function value. This suggests to me that it is using a barrier algorithm. (?) Is there a way to demand the Simplex algorithm for these – or to otherwise guide the solver? With large problems (75k variables), I fear that the introduction of integer variables adds significant time, even in the MCNF realm. (Perhaps I am deceived in this estimation.)

Note that I can reproduce the difficulty even with a very small problem, for which the Excel solver yields integer allocations and OpenSolver does not.

Also, OpenSolver’s .lp file indicates that it recognizes the network problem. (As one would expect.)

/ Network!$I$2:$L$25 < 1

/ Network!$I$30:$L$33 = Network!$I$37:$L$40

/ Network!$O$2:$O$25 < 1

Any hints?

Thanks!

-Larry Curcio

Larry: OpenSolver uses CBC, which uses the simplex method. How fractional are your solutions; values like 0.9999 and 1 are equivalent for all practical purposes, and you should treat them as such. However, if you get 1/2 or 1/3 in a solution, then I’d be surprised, but as you say such solutions may still be optimal. It is possible that CBC is finding the solutions using a heuristic, but I’d be surprised. By the way, the “Network” reference in the .lp file is your sheet name, not a network identification. Andrew

Hello, I am attempting to run open solver on my Macbook air. I was able to successfully download the program, but when I engage any of the buttons on the solver, it does not respond. I have attempted to uninstall, then re-install excel and the solver, but had no luck. Any suggestions?

Greetings,

I am trying to run OpenSolver via VBA but I am getting a “Runtime Error -2147220503, Automation Error” and I can’t seem to find out why. My code is appended below.

——-

Sub C_Solve()

Dim Schedule As Worksheet

Set Schedule = Sheets(“Data”)

With Schedule

‘C Crew Last Row

Dim crewlRowC As Long

Dim crewblRowC As Long

crewlRowC = Cells(Rows.Count, 2).End(xlUp).Row

crewblRowC = .Range(.Cells(118, 2), .Cells(crewlRowC, 2)).End(xlDown).Row

‘C MaxDuty Row

Dim lRowC As Long

Dim blRowC As Long

lRowC = Cells(Rows.Count, 20).End(xlUp).Row

blRowC = .Range(.Cells(1, 20), .Cells(lRowC, 20)).End(xlDown).Row

‘CP MaxDuty Row

Dim lRowCP As Long

Dim blRowCP As Long

lRowCP = Cells(Rows.Count, 22).End(xlUp).Row

blRowCP = .Range(.Cells(1, 22), .Cells(lRowCP, 22)).End(xlDown).Row

End With

‘Reset all previously used models

OpenSolver.ResetModel Sheet:=Schedule

‘Set Solver

OpenSolver.SetChosenSolver “Bonmin”, Sheet:=Schedule

‘Objective definition

OpenSolver.SetObjectiveFunctionCell Schedule.Cells(3, 26), Sheet:=Schedule

OpenSolver.SetObjectiveSense MaximiseObjective, Sheet:=Schedule

‘Variables definition

OpenSolver.SetDecisionVariables Union(Schedule.Range(Cells(2, 118), Cells(2, crewblRowC)), Schedule.Range(Cells(32, 118), Cells(32, crewblRowC))), Sheet:=Schedule

‘Constraints definition

‘1. Variables are binary

OpenSolver.AddConstraint Union(Schedule.Range(Cells(2, 118), Cells(2, crewblRowC)), Schedule.Range(Cells(32, 118), Cells(32, crewblRowC))), RelationBIN, Sheet:=Schedule

‘2. Max of 1 crew scheduled per day

OpenSolver.AddConstraint Schedule.Range(Cells(2, 143), Cells(32, 143)), RelationEQ, Cells(25, 6), Sheet:=Schedule

‘3. Max duty count

OpenSolver.AddConstraint Schedule.Range(Cells(33, 118), Cells(33, crewblRowC)), RelationLE, Schedule.Range(Cells(20, 2), Cells(20, blRowC)), Sheet:=Schedule

‘4. Consec duty count

OpenSolver.AddConstraint Schedule.Range(Cells(34, 118), Cells(34, crewblRowC)), RelationEQ, Cells(25, 9), Sheet:=Schedule

OpenSolver.RunOpenSolver Sheet:=Schedule

End Sub

——

Appreciate any help. Thanks alot.

Apologies, this has been resolved with some improvement to the code.

I’ve now transitioned to Windows products due to the fact I couldn’t use opensolver on google. I am now getting an “Error 4551: Your organization used device guard to block this app”. what can I do? Do i need to pay money to get this unblocked. I have no problem doing so. I just need this solver to work.

We have not had this reported to us before. No, it is nothing to do with paying money. From my Googling, it looks like a Windows feature used on work machines. Maybe your IT department can help? Please let us know how you get on. Andrew

No IT. Use solver for Daily Fantasy. I got it working by changing the Engine to NEOS using COIN-OR CBC (Linear Solver). I believe I was trying to solve with the COIN-OR.

Hi, I have a problem with my model (Vehicle routing problem with split delivery). Even though open solver reported an optimal solution is found, some constraints are not satisfied. What am I accustomed to fix this problem? Could you please help me? Regards…

Hi,

I keep getting an error message “Method ‘Range’ of object ‘_Worksheet’ failed” when using the non-linear engines.

Any thoughts on what I’m doing wrong ?

Thanks

David: Are you using the latest beta release? From memory, this error is a VBA problem that we added a small delay to fix. Andrew

Andrew,

Yes I am. Seems to be an issue with how Excel looks at the Add-In, I need to disable then enable OpenSolver between runs, not a big issue.

Thanks,

David

Hello,

I am helping a user with his new install of OpenSolver v2.8.5.

When he tried to choose a different Solver of, COIN-OR Bonmin (Non-linear solver) he gets the message; https://projects.coin-or.org/Bonmin

Unable to find Bonmin (“Bonmin.exe”) Folders searched:

We are very locked down here and I am questioning if he needs a newer version of OpenSolver ot to load/install bonmin.exe?

Thanks,

Brett

You need the Advanced version of OpenSolver. And no, it is nothing to do with COIN-OR’s move to GitHub. Andrew

Hello, I am helping a user with OpenSolver v2.8.5 add-in, it was just recently installed.

When he tried to choose a different Solver of, COIN-OR Bonmin (Non-linear slover) he gets the message;

https://projects.cain-or.org/Bonmin

Unable to find Bonmin (“Bonmin.exe”) Folders searched:

We are very locked down and I am questioning if he needs a newer version of OpenSolver or to load/install bonmin.exe?

Could it be related to https://projects.coin-or.org/Bonmin has moved to https://github.com/coin-or/Bonmin an issue?

Thanks,

Brett

You need the Advanced version of OpenSolver which includes Bonmin. And no, it is nothing to do with COIN-OR’s move to GitHub. Make sure that you can run the bonmin.exe execuable from a command line; if you don’t have permissions to do so, then OpenSolver won’t be able to either. Andrew