Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Executing a CP model

    Posted 06/14/12 07:48 AM

    Originally posted by: JorisK


    Dear,

    I'm trying to run the example model Sports.java which comes with the installation of Ilog Studio. However, whenever I try to execute the java program, I get the following error:

    
    Native code library failed to load: ensure the appropriate library (opl124.dll/.so) is in your path. Exceptions: /opt/ILOG/CPLEX_Studio124/opl/bin/x86-64_sles10_4.1/libopl124.so: libicuuc.so.42: cannot open shared object file: No such file or directory no opl_lang_wrap_cpp in java.library.path no opl_core_wrap_cpp_java124 in java.library.path no opl_core_wrap_cpp in java.library.path /opt/ILOG/CPLEX_Studio124/cpoptimizer/bin/x86-64_sles10_4.1/libcp_wrap_cpp_java124.so: libcplex124.so: cannot open shared object file: No such file or directory no cp_wrap_cpp in java.library.path no concert_wrap_cpp_java124 in java.library.path no concert_wrap_cpp in java.library.path   Exception in thread 
    "main" java.lang.ExceptionInInitializerError at ilog.concert.cppimpl.IloEnv.<init>(IloEnv.java:49) at ilog.concert.IloModelerImpl.<init>(IloModelerImpl.java:34) at ilog.cp.IloCP.<init>(IloCP.java:119) at ilog.cp.IloCP.<init>(IloCP.java:112) at sports.Sports.main(Sports.java:69) Caused by: java.lang.RuntimeException: Native code library failed to load: ensure the appropriate library (opl124.dll/.so) is in your path. Exceptions: /opt/ILOG/CPLEX_Studio124/opl/bin/x86-64_sles10_4.1/libopl124.so: libicuuc.so.42: cannot open shared object file: No such file or directory no opl_lang_wrap_cpp in java.library.path no opl_core_wrap_cpp_java124 in java.library.path no opl_core_wrap_cpp in java.library.path /opt/ILOG/CPLEX_Studio124/cpoptimizer/bin/x86-64_sles10_4.1/libcp_wrap_cpp_java124.so: libcplex124.so: cannot open shared object file: No such file or directory no cp_wrap_cpp in java.library.path no concert_wrap_cpp_java124 in java.library.path no concert_wrap_cpp in java.library.path   at ilog.concert.IloJNILoader.loadJNI(IloJNILoader.java:80) at ilog.concert.cppimpl.concert_wrapJNI.<clinit>(concert_wrapJNI.java:15) ... 5 more
    


    Some system information:
    -OS: Kubuntu (Linux)
    -Development: Eclipse
    -Cplex version: CPLEX_Studio124

    Referenced Libraries: ILOG.CP.jar , oplall.jar
    Default VM Arguments: -Djava.library.path=/opt/ILOG/CPLEX_Studio124/opl/bin/x86-64_sles10_4.1/:/opt/ILOG/CPLEX_Studio124/cplex/bin/x86-64_sles10_4.1/:/opt/ILOG/CPLEX_Studio124/opl/oplide/:/opt/ILOG/CPLEX_Studio124/cpoptimizer/bin/x86-64_sles10_4.1/

    Hopefully somebody know what is going wrong. BTW, is there any customer support service for ILOG CP?
    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Executing a CP model

    Posted 06/14/12 10:27 AM

    Originally posted by: JorisK


    Ok, after several hours I managed to find the solution how to get rid of the famous "Native code library failed to load: ensure the appropriate library (oplXXX.dll/.so) is in your path." error under linux/java/eclipse. This is how you resolve it.

    1. Obviously, first install Cplex_StudioXXX
    2. Copy the oplall.jar and ILOG.CP.jar files which you find somewhere in the install dir to your eclipse project, and add them to your build path. Make sure they are visible under "Referenced Libraries". Make sure you do not add cplex.jar to your buildpath as well, because then the error will change from opl124.dll to opl10.dll which
    3. Next, go to Window->preferences->Installed JRE->select your JRE and click edit. Under Default VM Argument, set: -Djava.library.path=/opt/ILOG/CPLEX_Studio124/opl/bin/x86-64_sles10_4.1/:/opt/ILOG/CPLEX_Studio124/cplex/bin/x86-64_sles10_4.1/:/opt/ILOG/CPLEX_Studio124/opl/oplide/:/opt/ILOG/CPLEX_Studio124/cpoptimizer/bin/x86-64_sles10_4.1/ obviously adjusted to your own system configuration.

    4. Go to Run->Run Configurations->select the tab Environment (it might be hidden behind the ">>"). Under Environment variables, click new. Make a new variable as follows (again, adjusted to your own configuration):
    Name: LD_LIBRARY_PATH
    Value: /opt/ILOG/CPLEX_Studio124/cpoptimizer/bin/x86-64_sles10_4.1/:/opt/ILOG/CPLEX_Studio124/cplex/bin/x86-64_sles10_4.1/:$LD_LIBRARY_PATH
    hit ok and click run.

    This resolved my problem. In /opt/ILOG/CPLEX_Studio124/cpoptimizer/examples/x86-64_sles10_4.1/static_pic/ I found a makefile which explains how to run the java class from the command line. Below I've pasted some relevant parts:

    
    CONCERTDIR = ../../../../concert CPLEXDIR = ../../../../cplex JAVA = $(JAVA_HOME)/bin/java JAVAC = $(JAVA_HOME)/bin/javac JAVAFLAGS = -d64 CPCLASSPATH = ../../../lib/ILOG.CP.jar LIBRARYPATH = ../../../bin/x86-64_sles10_4.1:$(CPLEXDIR)/bin/x86-64_sles10_4.1 JAVAEXDIR = ../../../examples/src/java   all: java   java: Sports.class   execute: execute_java   clean: rm -f sports *.
    
    class   FORCE:   $(JAVAC): @echo 
    "####################################" @echo 
    "Error: cannot find the javac command" @echo 
    "Please ensure that JAVA_HOME is set correctly" @echo 
    "Currently, JAVA_HOME = $(JAVA_HOME)" @exit 1   Sports.class: $(JAVAC) $(JAVAC) -d . -classpath $(CPCLASSPATH) $(JAVAEXDIR)/Sports.java Sports.run: Sports.class FORCE LD_LIBRARY_PATH=$(LIBRARYPATH):$$LD_LIBRARY_PATH $(JAVA) $(JAVAFLAGS) -classpath $(CPCLASSPATH):. Sports   execute_java: Sports.run
    


    Here Sports.class is an example class which is shipped with the ILOG CPLEX studio. Note, the above code originates from a much larger make file. The original makefile also contains the compilation/run instructions for the other example classes, as well as for the C++ examples!

    It is pretty pity that such an advanced, nice software package as ILOG Cplex Studio is that difficult to install under linux. Given IBM's resources, it can't be that hard to write a proper installation manual right?
    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: Executing a CP model

    Posted 06/14/12 10:29 AM

    Originally posted by: JorisK


    Most important to fix: set your LD_LIBRARY_PATH as is mentioned in: http://techtavern.wordpress.com/2010/07/12/opl-java-loading-dynamic-linu-libraries/
    #CPOptimizer
    #DecisionOptimization