Help

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:

  1. The online CBC TRAC bug reporting system (which you will have to register for), or
  2. 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.

2,138 thoughts on “Help”

  1. Hi, first of all thank you for this valuable resource you have created. I just switched from CBC to Gurobi, then it shows this error message. It always work fine with CBC, I don’t know why can’t Gurobi load result to the worksheet. Please advice, thank you so much.
    ———- Error log follows ———-

    15 Mar 18 10:12:10 [OpenSolver.xlam] SolverCommon.SolveModel: Line 46
    15 Mar 18 10:12:10 [OpenSolver.xlam] OpenSolverAPI.RunOpenSolver: Line 11

    Error 1004: Method ‘LoadResultsToSheet’ of object ‘COpenSolver’ failed
    Solver: Gurobi
    OpenSolver version 2.8.5 (2016.11.3); Distribution=Advanced
    Location: “/Users/pavineererkjirattikarn/Desktop/OpenSolver2.8.5_AdvancedMac/OpenSolver.xlam”

    Excel 14.1; build 13410; 32-bit; VBA6
    Excel language: English – US
    OS: Mac 10.10.5; 64-bit
    Username: pavineererkjirattikarn

    CBC v2.9.4 (64-bit) at “/Users/pavineererkjirattikarn/Desktop/OpenSolver2.8.5_AdvancedMac/Solvers/osx/cbc”

    Gurobi v7.5.2 (64-bit) at “/usr/local/bin/gurobi_cl”

    Bonmin v1.8.4 (64-bit) at “/Users/pavineererkjirattikarn/Desktop/OpenSolver2.8.5_AdvancedMac/Solvers/osx/bonmin”

    Couenne v0.5.6 (64-bit) at “/Users/pavineererkjirattikarn/Desktop/OpenSolver2.8.5_AdvancedMac/Solvers/osx/couenne”

    NOMAD v3.7.1 (64-bit) using OpenSolverNomad v1.3.1 at “/Users/pavineererkjirattikarn/Desktop/OpenSolver2.8.5_AdvancedMac/Solvers/osx/OpenSolverNomad”

  2. Dear team,

    I am having the following problem:

    Opensolver could not find an optimal solution, and reported: infeasible

    The model contains a constraint B5=C5 for which instance 1 does not depend on the decision variables and is not satisfied.
    What does it mean? What could I do?

    Thank you in advance!

    1. Your formulae in these cells do not change as your change the decision cell values. You have a mistake to fix. Andrew

  3. Hi, can I write a VBA command to change the constraint selection and to solve. So when I execute the code, I do not have to manually press “solve” anymore?

  4. Hi, may I ask whether I can solve multiple problems in 1 sheet? (so different objective cell and constraints for each objective cell)

  5. Much thanks on a very valuable resource. Love the fact that OpenSolver can utilize more than 200 rows.

    Question: As I am not familiar with VBL or any of the programming, is there a way to add or modify constraints in the Solver to return more than 1 solution? If so, how would one ‘keep’ the solutions on a tab in the worksheet instead of overwriting previous ones? Much thanks to a great resource.

    Jesse

  6. Hi,

    My model has about 2200 variables and 40 constraints. It was working great…But now it will solve the model and not load the decision variables. Basically it freezes once it completes. I’m beginning to think the model may be too big? I only added a couple smaller constraints during my last few edits before it stopped working. The model doesn’t seem too complicated. Do you know of any ways to fix this problem?

    1. My guess is that the problem has become much harder to solve… adding just one constraint can do this. You can view the solver progress to see what’s happening under Solver Options. Andrew

  7. Hello. Finally I succeed modelling my problem using a linear model. I tested it with a ‘small scale’ (few variables and constraints) and works. When I moved to large scale model (190000 variables, 2000 of them natural, the others only for keeping model linear; more than 700000 constraints) I got a ‘out of memory’ message during constraints loading (I use VBA in order to load constraints in the model), about at 30.000 constraints….any way to exceed such limits? thanks

    1. I am not surprised! That is a large model and,I suspect, too big to solve even if OpenSolver could build the model. Wht don’t you try making it bigger step by step and see how long it takes to solve. If it keeps working then I suggest you switch to Solverstudio which may be able to handle such a large model. Please let us know how you get on. Andrew

      1. model ‘fails’ when reaching 32767 contraints and 35104 variables. I try’ll do downsize model and find max size which could be managed, and let you know later. I will also try to get used to SolverStudio, which it does not look so easy to be approached

        1. You should be adding a small number of OpenSolver “constraints” each of which has a large range of cells for its left hand (and a constant or large range for its right hand side). This can then be translated by OpenSolver into many mathematical constraint equations that are given to the solver (as shown in the .lp file). 32767 will be a limit on the number of named ranges available internally within Excel, I suspect; it is not an OpenSolver limit we impose. That said, I am still not convinced that you have created a mathematical model that any optimisation engine will be able to solve! Optimisation problems can be difficult to solve because they are big or because they have poor mathematical structure and lots of integer/binary vairables. OpenSolver adds a further reason for slow solve speeds, being that it has to extract the mathematical equations from the spreadsheet. You probably face all these challenges. SolverStudio removes this OpenSolver limitation. Andrew

  8. I’ve installed the Add-in and it seems to work fine.
    But only with the CbC solver.
    If I use a Coenn o Bonim or other solver, it says report me the following message.
    Error -2147220504: Unable to access the Bonmin solver at “C:\Program Files\Microsoft Office\Office14\ADDINS\OpenSolver2.9.0_LinearWin\Solvers\win64\bonmin.exe”
    I’ve installed the solver in the directory, so it can find the solver.
    I dont’t undertstand why it cannot access the solver.

    herein the complete log error.
    22 feb 18 11:44:01 [OpenSolver.xlam] SolverCommon.SolveModel: Line 20
    22 feb 18 11:44:01 [OpenSolver.xlam] OpenSolverAPI.RunOpenSolver: Line 11

    Error -2147220504: Unable to access the Bonmin solver at “C:\Program Files\Microsoft Office\Office14\ADDINS\OpenSolver2.9.0_LinearWin\Solvers\win64\bonmin.exe”

    Solver: Bonmin

    OpenSolver version 2.9.0 (2017.11.10); Distribution=Advanced
    Location: “C:\Program Files\Microsoft Office\Office14\ADDINS\OpenSolver2.9.0_LinearWin\OpenSolver.xlam”

    Excel 14.0; build 7191; 64-bit; VBA7
    Excel product code = {90140000-0011-0000-1000-0000000FF1CE}
    Excel language: Italian
    OS: Windows 6.1; 64-bit
    Username: bugge

    CBC v2.9.7 (64-bit) at “C:\Program Files\Microsoft Office\Office14\ADDINS\OpenSolver2.9.0_LinearWin\Solvers\win64\cbc.exe”

    No Gurobi installation was detected. The value of %GUROBI_HOME% was not set.

    Bonmin v (64-bit) at “C:\Program Files\Microsoft Office\Office14\ADDINS\OpenSolver2.9.0_LinearWin\Solvers\win64\bonmin.exe”

    Couenne v (64-bit) at “C:\Program Files\Microsoft Office\Office14\ADDINS\OpenSolver2.9.0_LinearWin\Solvers\win64\couenne.exe”

    Unable to find NOMAD (‘OpenSolverNomad.dll’). Folders searched:
    C:\Program Files\Microsoft Office\Office14\ADDINS\OpenSolver2.9.0_LinearWin\Solvers\win64

    can anybody help me?
    thanks

    1. Did you download the Advanced version? It does not look like it. You don’t need to add solvers yourself. Andrew

  9. Hi,

    I am trying to run a linear model with 14 variables xi (where 0=< xi =0 at the same time, meaning if x1>0 then x3=0 or if x3>0 then x1=0.

    How can I add this criteria while using a linear model ?

    Thank you for your help 🙂

  10. Hi,

    I am trying to run a linear model with 14 variables xi (where 0=< xi =0 at the same time, meaning if x1>0 then x3=0 or if x3>0 then x1=0.

    Could someone help me please ? 🙂

    Thank you

      1. Hi Andrew,

        Thank you for your answer.

        I tried to add to the xi variables, yi variables (binary) with the following condition: sum of xi * yi = 1.
        But, it does not work. I have the following message : No feasible Integer Solution. I don’t understand why the model tries to find an integer solution, do you ?

        Many thanks
        Leila

      2. Hi Andrew,

        How can I add a binary variable which linearly depends on x1 ?
        For example, the following function is not linear = if(x1>0;1;0)

        Thank you
        Leila

  11. Hello,

    Which solver would you recommend when I want to maximize Y for the the following function?
    Y=5*(x^3)+4*(x^2)+3*(x)+56

    Thank you,
    Alex

  12. Hello. I need to put in relation couples of variables. This seems to make my model not-linear. Generally speaking how can I keep model linear in this case? thanks

  13. Hello Andrew,
    First let me convey congratulations for the fantastic OpenSolver tool, and thank you and the team for the dedication. I have successfully used OpenSolver both for prototyping and for end-user implementations with Excel.
    I have a problem (*) where I am mostly interested to generate quickly a number of feasible solutions. Is there a CBC Solver option to stop once a feasible solution is found ? I use now the maxTime option of OpenSolver, but I have to set it at a conservative estimate to give enough time. This is a waste of time if we want a relatively high number of feasible solutions.
    (*) We are working on a scheduling problem. Due to the nature of the scheduling constraints, it cannot readily be expressed as a linear problem. We have developed a dedicated heuristic (based on Ant Colony Optimization search) to obtain solutions, but the heuristic does not scale very well with the (high) number of tasks. We are looking for a method to exclude already tasks with a low probability of being retained in the solution. By relaxing some of the constraints we can formulate the problem as a shortest path problem. The idea is to generate a sufficiently high number of feasible paths (by changing every time a bit some of the parameters of the relaxed problem), and to exclude those tasks that never were included in any feasible path, before handing the problem to the ACO heuristic.
    Thanks !
    Guy

    1. Guy: Thanks for the positive comments. To find CBC command line options, please launch cbc.exe from the command line, and use the help option (-h or -? from memory). I do a bit of work on scheduling algorithms, and I teach heuristics. Have you tried a simpler swapping algorithm? I always recommend these before anything complicated, with multiple restarts (perhaps using GRASP). Easy to code, and fast to run. I like your use of shortest path, but can’t you use a dedicated shortest path code? Be faster than an LP solver. Andrew

      1. Hello Andrew,
        thank you for the feedback and information.
        Yes we considered Dijkstra’s shortest path algorithm, but there are some additional constraints, e.g. some high priority tasks have to be included mandatorily in the set of feasible paths. It was easier to use a “brute force” approach, model it as a linear problem with the additional constraints. The ACO code was provided by our R&D, it is part of their “toolbox”.
        Thanks, Guy

  14. I get indications my model is not linear but I am not able to understand why. Here is the mathematical representation: i=1 to 212, number of component; j=1 to 52, number of products; k=1 to 8, number of suppliers (for components and/or products); Supplier of component [i] = Sc[i], which is calculated as: vc[i][1]*1+vc[i][2]*2+vc[i][3]*3+ vc[i][4]*4+vc[i][5]*5+vc[i][6]*6+vc[i][7]*7+vc[i][8]*8 , where vc[i][k] is a variable boolean . Sc[i] is an integer number (1,2,3,4,5,6,7, or 8). Supplier of product [j] = Sp[i], calculated in the same way of Sc[i], but with sets of variable vp[j][k]. For each component [i] is calculated the total quantity which is required to be delivered from supplier Sc[i] to central warehouse. In case the supplier of product [j] where component [i] is required is the same of Sc[i] then the quantity transported is zero. This matter is modelized in this way: (1-((Sc[i]=Sp[j])+0)*Q[j]*c[i][j] , where Q[j] is total quantity of product [j] and c[i][j] is the unit quantity of component [i] used in product [j]. Total quantity of component [i] which needs a transportation is SUM((1-((Sc[i]=Sp[j])+0)*Q[j]*c[i][j])[j=1 to 52]. The overall quantity of components which require a transportation is: SUM(SUM((1-((Sc[i]=Sp[j])+0)*Q[j]*c[i][j])[j=1 to 52]) [i=1 to 212]. This final formula is recognized as not linear. How can I make it linear? Thanks in advance for any help.

      1. I replaced Sc[i]=Sp[j] with another formula:
        vc[i][1]*vp[j][1]+vc[i][2]*vp[j][2]+vc[i][3]*vp[j][3]+ vc[i][4]*vp[j][4]+vc[i][5]*vp[j][5]+vc[i][6]*vp[j][6]+vc[i][7]*vp[j][7]+vc[i][8]*vp[j][8]. Where vc and vp are boolean 0-1. It works, but the problem comes again from a sub-formula because vc[i][1..8] is calculated as:
        vc [i][1] = SUMPRODUCT(vt[1][1]…vt[1][t] ; c[i][1]…c[i][t])

        vc[i][8]= SUMPRODUCT(vt[8][1]…vt[8][t] ; c[i][1]…c[i][t])
        Using these SUMPRODUCT() inside previous formula I get msg of non-linearity.

        1. You are multiplying decision cells vc and vp; that is non-linear (even if OpenSolver does not notice it). Your answer will not be correct. You need to find a linear formulation. Andrew

          1. Any suggestions about how to linearize this statement IF(A=B, 0, 100000)? I tried to search on OR-EXCHANGE and also on google but I found solution only in case of disegual (A>B, A<B) but not straight A=B. Thanks

            1. If A=B only makes sense if they are integer variables. You need to use a new binary variable Z and add two constraints A >= B-9999Z and A <= B+9999Z. Andrew

              1. Thank you Andrew. It seems that does not work:
                For example A=B (=5 )
                if Z=1, 5 >= 5 – 9999*1 (=-9994) is true, 5= 5 – 9999*0 (=5) is true, 5= B-9999Z and A <= B+9999(1-Z) but is the same

                1. To be clearer: if A=B with suggested constraints both values of Z (0 or 1) satisfy both contraints. In case of A>B or AB and A<B are true

  15. Hi Team Opensolver,

    I am having a bit of trouble with the opensolver at the moment which I think could be down to some installation problems however after deleting the Opensolver files and redownloading them the problem persists. I am trying to solve an extremely trivial optimization problem in order to test the capability of the solver before applying it to my problem.

    The problem is easily solved with Excel in-built solver but cannot seem to be solved by the Opensolver citing an error message saying that my constraint does no appear to be linear before giving the same nonsensical values for the objective and variable cells. From the aboutsolver menu it says that Opensolver is correctly installed in my documents folder. I have also shown the optimization process while solving and found this line a bit strange “Empty problem – 0 rows, 0 columns and 0 elements
    Optimal – objective value 1918.8333”.

    Have you any idea how to solve this issue or where I have went wrong? It seems to me that the spreadsheet is not communicating properly with the solver but I have no idea what to do about this. Thanks very much.

    1. Sorry it is not working. Is the .lp file showing a correct model? I assume your model is linear? Andrew

Leave a Reply

Your email address will not be published. Required fields are marked *