Problem deploying OPTANO using CPLEX in a Linux Docker container

239 views
Skip to first unread message

Jim Nardecchia

unread,
Jul 18, 2018, 5:10:17 PM7/18/18
to OPTANO Modeling
Hey there

I am trying to containerize a .NET Core application I wrote that uses OPTANO along with CPLEX and run it in a Linux container (I had previously successfully containerized the same app using Gurobi). In my container I have installed the Linux version of CPLEX to /opt/, when I run the application I get System.IO.FileNotFoundException "Could not load file or assembly 'ILOG.Concert, Version-12.8.0.0' ...' The system cannot find the file specified." thrown from OPTANO.Modeling.Optimization.Solver.Cplex128.CplexSolver.InitializeSolverInstance().

That file "ILOG.Concert" is one needed by the app if it's running in Windows, and it is supplied by the Windows install of CPLEX, but it is not supplied in the Linux install of CPLEX. My question is does the CplexSolver in OPTANO.Modeling require this or is there some way it can be changed to use the corresponding Linux file instead. For clarity I have the 5 files I need to run the app in Windows deployed alongside the application and also in the cplex file in /opt/ with the rest of the Linux CPLEX installed files.

If there's something about any of this you need clarity on please feel free to ask, I know there are a lot of variables here and I've withheld several specifics to try and keep to the point, but if more info is necessary I can provide it.

ORCONOMY Team

unread,
Jul 18, 2018, 6:45:10 PM7/18/18
to OPTANO Modeling
Hi,

OPTANO Modeling uses Concert to build up the model. A solution might be an additional SolverAdapter CplexNative, which uses the optano modeling's built-in matrix generator (and replaces Concert).
I'll check with the development team.

Getting back to you as soon as possible,
jp



ORCONOMY Team

unread,
Jul 18, 2018, 6:53:50 PM7/18/18
to optano-...@googlegroups.com
Just a different approach.
Do you have ilog.concert.dll available as well?

using ildasm.exe, it identifies as dotnet dll.
You might just copy it into your application's folder and restart your application.

Best,
jp

manifest
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 4:0:0:0
}
.assembly ILOG.Concert
{
[...]

Best,
jp

Jim Nardecchia

unread,
Jul 18, 2018, 7:41:34 PM7/18/18
to OPTANO Modeling
Hey there thanks for the reply. The error message doesn't specify but yes I have ILOG.Concert.dll, ILOG.Concert.xml, ILOG.CPLEX.dll, ILOG.CPLEX.xml, and cplex1280.dll in the assembly folder and in the CPLEX Linux install folders.

ORCONOMY Team

unread,
Jul 19, 2018, 12:08:17 PM7/19/18
to optano-...@googlegroups.com
Using Debian 9.1 I have successfully solved a simple model with CPLEX 12.8.

Please follow this:

  • Install CPLEX 12.8 on linux (pretty simple how-to: http://www-01.ibm.com/support/docview.wss?uid=swg21444285)
  • Create a new folder
    mkdir ~/cplextrial
    cd ~/
    cplextrial
  • Creat a dotnet project and add OPTANO.Modeling
    dotnet new console
    dotnet add
    package OPTANO.Modeling
  • Copy your ILOG.Cplex.dll and ILOG.Concert.DLL to cplextrial (I could not find them in the linux installation folder, but they are in a windows installation folder)
  • start your favorite code editor and add the ItemGroups to your cplextrial.csproj file (most likely this will do the trick)
    <Project Sdk="Microsoft.NET.Sdk">

     
    <PropertyGroup>
       
    <OutputType>Exe</OutputType>
       
    <TargetFramework>netcoreapp2.0</TargetFramework>
     
    </PropertyGroup>
     
    <ItemGroup>
       
    <Reference Include="ILOG.Concert" CopyToOutputDirectory="PreserveNewest">
         
    <HintPath>ILOG.Concert.dll</HintPath>
       
    </Reference>
     
    </ItemGroup>
       
    <ItemGroup>
       
    <Reference Include="ILOG.CPLEX" CopyToOutputDirectory="PreserveNewest">
         
    <HintPath>ILOG.CPLEX.dll</HintPath>
       
    </Reference>
     
    </ItemGroup>
       
    <ItemGroup>
         
    <PackageReference Include="OPTANO.Modeling" Version="2.8.1.343" />
       
    </ItemGroup>

    </Project>
  • Create a simple model in the Program.cs such as
    using System;
    using OPTANO.Modeling.Optimization;
    using OPTANO.Modeling.Optimization.Enums;
    using OPTANO.Modeling.Optimization.Solver.Cplex128;

    namespace cplextrial
    {
       
    class Program
       
    {
           
    static void Main(string[] args)
           
    {
               
    Console.WriteLine("Hello World!");
               
    var solver = new CplexSolver();
               
    Console.WriteLine(solver.ToString());
               
    var model = new Model();
               
    var x = new Variable("x", 0, double.PositiveInfinity, VariableType.Integer);
               
                model
    .AddConstraint(x == 1);
                model
    .AddObjective(new Objective(x));
                solver
    .Solve(model);

           
    }
       
    }
    }
  • Run the application and check the output for
    Loaded '/home/optano/cplextrial/bin/Debug/netcoreapp2.0/ILOG.Concert.dll'. Module was built without symbols.
    Loaded '/home/optano/cplextrial/bin/Debug/netcoreapp2.0/ILOG.CPLEX.dll'. Module was built without symbols.
    CPXPARAM_MIP_Tolerances_AbsMIPGap                
    0
    CPXPARAM_MIP_Tolerances_MIPGap                  
    0
    CPXPARAM_MIP_Limits_CutsFactor                  
    4
    Found incumbent of value 1.000000 after 0.00 sec. (0.00 ticks)
    Tried aggregator 1 time.
    MIP
    Presolve eliminated 1 rows and 1 columns.
    All rows and columns eliminated.
    Presolve time = 0.00 sec. (0.00 ticks)
    Root node processing (before b&c):
     
    Real time             =    0.00 sec. (0.00 ticks)
    Parallel b&c, 4 threads:
     
    Real time             =    0.00 sec. (0.00 ticks)
     
    Sync time (average)   =    0.00 sec.
     
    Wait time (average)   =    0.00 sec.
                             
    ------------
    Total (root+branch&cut) =    0.00 sec. (0.00 ticks)
  • Cheers,
    jp


Jim Nardecchia

unread,
Jul 19, 2018, 5:47:06 PM7/19/18
to OPTANO Modeling
Thanks for this, I am able to get this working if I do everything you said from within a Linux container (create project, edit files, build, run). One thing is I needed to copy some of the linux CPLEX files into the output directory of my project.

ORCONOMY Team

unread,
Jul 20, 2018, 2:16:10 AM7/20/18
to OPTANO Modeling
The referenced files will be copied, if
CopyToOutputDirectory="PreserveNewest"
is an attribute of the itemgroup (I have added this to the example above)

You might copy other folders or files by
<ItemGroup>
  <Folder Include="$(SolutionDir)config\" CopyToOutputDirectory="Always" />
</ItemGroup>

Build makes use of plenty placeholders such as $(SolutionDir)

Best,
jp
Reply all
Reply to author
Forward
0 new messages