Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Problem With .NET Examples Throwing Exceptions

    Posted 11/14/09 11:16 PM

    Originally posted by: SystemAdmin


    [char507 said:]

    Hi,

    I'm currently beginning our effort to call our CPLEX model from some C# code and I figured exploring the examples located under: 
        C:\ILOG\OPL63\examples\opl_interfaces\dotnet\x64_windows_vs2008\CSharp
    would be a good place to start.  In particular, i've been trying to get the SteelMill or Warehouse example to work.  These applications build correctly when provided the reference to oplall.dll however, they throw an exception when run. 

    From the line
    OplFactory.DebugMode = true
    A TypeInitializationException is thrown from ILOG.OPL.OplFactory.  The inner exception says
    The type initializer for 'ILOG.OPL.opl_lang_wrap' threw an exception.

    Commenting this line out of the code just throws an exception on the next line.  I'm kind of at a loss as to what i'm doing wrong but it has to be something extremely simple.  Any help would be greatly appreciated as this is quite a roadblock for me!



    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Problem With .NET Examples Throwing Exceptions

    Posted 11/19/09 02:13 AM

    Originally posted by: SystemAdmin


    [vblanchard said:]

    Usually, this type of error comes up when some OPL DLLs are not found at runtime. Can you make sure that you have <OPL_install_dir>\bin\your_port within your PATH environment variable for the machine?
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Problem With .NET Examples Throwing Exceptions

    Posted 11/28/09 05:04 PM

    Originally posted by: char507


    Where would I check this? I'm trying to explicitly add the 'opl63_dotnet.dll' and the 'cplex121.dll' files explicitly as references in the VS2008 project. However, i'm getting an error that says "A reference to this .dll could not be added. Please make sure that the file is accessible and that it is a valid assembly or COM component"
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Problem With .NET Examples Throwing Exceptions

    Posted 12/04/09 10:34 AM

    Originally posted by: char507


    Problem Solved. I didn't realize these .dlls had to be windows environment variables.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Problem With .NET Examples Throwing Exceptions

    Posted 02/10/10 01:25 PM

    Originally posted by: evanr


    I am having similar issues. After adding the OPL directory to my system PATH variable I now receiving a new error:

    The type initializer for 'ILOG.OPL.OplFactory' threw an exception.
    Unable to cast object of type 'System.TypeInitializationException' to type 'java.lang.Throwable'.

    at ILOG.OPL.OplFactory..ctor()
    at Warehouse.Warehouse.Main(String[] args) in C:\ILOG\OPL551\examples\dotnet\x86_windows_vs2008\Warehouse\Warehouse.cs:line 86
    at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()

    Any help would be greatly appreciated!!!!
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Problem With .NET Examples Throwing Exceptions

    Posted 02/18/10 02:34 PM

    Originally posted by: nestanx


    Hi, buddy,I just got the same problem like you recently. Have you solved it? I really need some help.......
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: Problem With .NET Examples Throwing Exceptions

    Posted 02/18/10 02:36 PM

    Originally posted by: nestanx


    My email address is jzhang12@rockets.utoledo.edu
    hope we could solve it together.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 8.  Re: Problem With .NET Examples Throwing Exceptions

    Posted 02/18/10 05:15 PM

    Originally posted by: evanr


    I resolved this problem. A couple things that help

    1) Include the oplall.dll in the .NET project (found in <OPL root>\bin\)
    2) Ensure that the J# runtime has been installed (pre-requisite for deployment) and add references to vjscor and vjslib to the .NET project
    3) Ensure that the OPL license environment variable is set. The variable is called ILOG_LICENSE_FILE and should point to the .ilm license
    4) The OPL objects have runtime assembly requirements that throw runtime exceptions if they are not found in the appropriate path. I resolved this problem by including the required dlls as 'content' in my .NET project, and so ensuring that they are deployed. See: http://www-01.ibm.com/support/docview.wss?uid=swg21401507
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 9.  Re: Problem With .NET Examples Throwing Exceptions

    Posted 02/19/10 11:05 AM

    Originally posted by: nestanx


    Thank you, pal.
    I solved the problem just like you told me.
    I really appreciate it.
    _
    #DecisionOptimization
    #OPLusingCPLEXOptimizer