Show / Hide Table of Contents

    Select + Setup a Solver

    Prerequisites

    • Model-Class created

    Find the right solver for you

    OPTANO Modeling offers a wide range of commercial, free-to-use and/or open source solvers. Depending on your project, there are several factors to consider:

    1. Performance of the solver
      • In most cases, the commercial solvers' performance is better than that of the free solvers. On some models/instances, this might not be true. Furthermore, the performance of some free solvers might suffice, if the actual models are not too difficult to solve/time is not a limiting factor.
      • A rough overview/estimation of the solver performance can be retrieved from our internal benchmark:
        • TODO: run + add benchmark results... :)
    2. Solver-specific features
      • An overview of the basic feature sets, that are supported through, or emulated by OPTANO Modeling can be found here.
    3. Price of the solver Depending of the size and/or the stage of your project, different solvers might be suitable. Optano Modeling offers a wide range of different commercial and non-commercial solvers, all integrated through a single .net/C# API:
      • Commercial Solvers
        • Gurobi
        • CPLEX
        • SCIP Opt
        • FICO Xpress
      • Free Solvers
        • HiGHS
        • GLPK
        • Microsoft Z3
        • MIPCL (discontinued)
    4. License model
      • Even if a solver is open source, it might be under a very restrictive license. For example, the GLPK Solver is licensed under the GPL v3 license. Currently it is not juristically settled, whether the usage of the GLPK API (i.e. 'calling of public methods') requires the calling software to also be licensed under the GPL v3 license. This basically prevents all (non open source) commercial usage.
      • For the evaluation/PoC, we recommend to resort to solvers that are under MIT, LGPL, Apache v2, or comparable license. These are actually free to use - even in commercial applications.
        • NOTE: Make sure that you comply to all regulations of the actual license texts. The above recommendation should only guide you to the 'correct' direction, and is not intended as legal advice.

    Solver-specific hints

    Gurobi

    We recommend to use the OPTANO.Modeling.Gurobi package for integrating Gurobi into your solution. The package comes with all DLLs (runtime binaries and .net API), so that no separate installation of the solver is required.

    NOTE: Make sure to properly set up your license file, e.g. by following the Gurobi recommendations.

    Highs

    Ergo Code (the makers of HiGHS) provide a How-To on their website. TL;DR:

    • Download the pre-compiled binaries here.
      • Windows: if in doubt, choose the file ending in x86_64-w64-mingw32-cxx11.tar.gz.
    • Download the compiler support libraries.
      • I only tested/used the linked version. Feel free to use/test a more recent release.
      • Use 7-zip to unpack the .gz and then the .tar package.
    • Copy the DLLs from CompilerSupportLbrariesXYZ/bin into the bin folder of the HiGHS package.
      • Open the CMD and call highs --help to make sure that all required DLLs are present.
    • Either add all DLLs from the HiGHS binary folder as resources to your project and set them to Copy always/if newer, or add the bin folder to your PATH variable.

    GLPK

    The OPTANO.Modeling.GLPK package provides a solver adapter to connect OPTANO.Modeling to the GLPK solver. In order to make your program run, you need to download (and/or compile) GLPK. The package/source code can be found here (GNU FTP).
    The following files need to be added to your project:

    • libglpk-cli.dll (as reference)
    • glpk_4_65.dll (as resource with copy always)
    • libglpk_cli_native.dll (as resource with copy always)

    To do that, add the following lines to your .csproj file. NOTE: Make sure to adjust the (relative) paths to the actual location of the DLLs on your system.

      // [...]
      <ItemGroup>
        <Reference Include="libglpk-cli">
          <HintPath>../some/path/libglpk-cli.dll</HintPath>
        </Reference>
      </ItemGroup>
    
      <ItemGroup>
        <None Update="glpk_4_65.dll">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </None>
        <None Update="libglpk_cli_native.dll">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </None>
      </ItemGroup>
      // [...]
    

    System.IO.FileNotFoundException

    If you do not properly reference the binaries, you might be greeted with an exception that looks like this:

    Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'libglpk-cli, Version=1.10.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
    File name: 'libglpk-cli, Version=1.10.0.0, Culture=neutral, PublicKeyToken=null'
       at OPTANO.Modeling.GLPK.GLPKSolver.BuildSolverModelAdapterSpecific(Int32 prioLevel)
       at OPTANO.Modeling.Optimization.SolverBase.CallBuildOnAdapter(Int32 prioLevel, Boolean isResolve)
       at OPTANO.Modeling.Optimization.SolverBase.BuildConfigureAndSolveOnAdapter(Int32 prioLevel, Dictionary`2 variableValues, Boolean isResolve, TimeSpan gloablElapsedTime)
       at OPTANO.Modeling.Optimization.SolverBase.BuildConfigureAndSolveOnAdapter(Int32 prioLevel, Dictionary`2 variableValues, Boolean isResolve)
       at OPTANO.Modeling.Optimization.SolverBase.SolveSingleStageModel(Dictionary`2 startSolution, Boolean isResolve, List`1 objectiveStages)
       at OPTANO.Modeling.Optimization.SolverBase.SolveNonNative(Dictionary`2 variableValues, Boolean isResolve)
       at OPTANO.Modeling.Optimization.SolverBase.Solve(Model model, Dictionary`2 variableValues)
       at Program.Main(String[] args) in C:\temp\glpk\Program.cs:line 19
    

    Next step

    Go to Solving the Model

    Back to top Copyright © OPTANO GmbH generated with DocFX
    Privacy Policy | Impressum – Legal Notice