Decision Optimization

Decision Optimization

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

 View Only
  • 1.  CP Optimizer on OSX and Java

    Posted Tue March 07, 2017 02:24 AM

    Originally posted by: MBecker


    Hi,

     

    I am trying to get CP Optimizer (12.7) working on OSX, using Java in Eclipse.


    I followed steps I found in a blog post online, in a similar way I managed to get CPLEX working in the same setup.

    Unfortunately CP doesn't seem to work the same way.

    If I try to run the example SchedSequence.java I get the following error (see below).

    What confuses me is that on OSX there is no OPL. I hope someone can clear things up!

    Native code library failed to load: ensure the appropriate library (opl1270.dll/.so) is in your path.
    Exceptions:
    no opl1270 in java.library.path
    no opl_lang_wrap_cpp in java.library.path
    no opl_core_wrap_cpp_java1270 in java.library.path
    no opl_core_wrap_cpp in java.library.path
    no cp_oaas1270 in java.library.path
    no cp_oaas in java.library.path
    /Users/mbr04/Applications/IBM/ILOG/CPLEX_Studio127/cpoptimizer/bin/x86-64_osx/libcp_wrap_cpp_java1270.jnilib: dlopen(/Users/mbr04/Applications/IBM/ILOG/CPLEX_Studio127/cpoptimizer/bin/x86-64_osx/libcp_wrap_cpp_java1270.jnilib, 1): Library not loaded: /nfs/home/cplexadmin/jenkins/agent-optbld30x/workspace/distrib-branch12.7/label/x64-osx.optbld30x/bin/x86-64_osx/static_pic/libcplex1270.jnilib
      Referenced from: /Users/mbr04/Applications/IBM/ILOG/CPLEX_Studio127/cpoptimizer/bin/x86-64_osx/libcp_wrap_cpp_java1270.jnilib
      Reason: image not found
    no cp_wrap_cpp in java.library.path
    no concert_wrap_cpp_java1270 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:128)
            at ilog.cp.IloCP.<init>(IloCP.java:121)
            at SchedSequence.<clinit>(SchedSequence.java:82)
    Caused by: java.lang.RuntimeException: Native code library failed to load: ensure the appropriate library (opl1270.dll/.so) is in your path.
    Exceptions:
    no opl1270 in java.library.path
    no opl_lang_wrap_cpp in java.library.path
    no opl_core_wrap_cpp_java1270 in java.library.path
    no opl_core_wrap_cpp in java.library.path
    no cp_oaas1270 in java.library.path
    no cp_oaas in java.library.path
    /Users/mbr04/Applications/IBM/ILOG/CPLEX_Studio127/cpoptimizer/bin/x86-64_osx/libcp_wrap_cpp_java1270.jnilib: dlopen(/Users/mbr04/Applications/IBM/ILOG/CPLEX_Studio127/cpoptimizer/bin/x86-64_osx/libcp_wrap_cpp_java1270.jnilib, 1): Library not loaded: /nfs/home/cplexadmin/jenkins/agent-optbld30x/workspace/distrib-branch12.7/label/x64-osx.optbld30x/bin/x86-64_osx/static_pic/libcplex1270.jnilib
      Referenced from: /Users/mbr04/Applications/IBM/ILOG/CPLEX_Studio127/cpoptimizer/bin/x86-64_osx/libcp_wrap_cpp_java1270.jnilib
      Reason: image not found
    no cp_wrap_cpp in java.library.path
    no concert_wrap_cpp_java1270 in java.library.path
    no concert_wrap_cpp in java.library.path
    
            at ilog.concert.IloJNILoader.loadJNI(IloJNILoader.java:88)
            at ilog.concert.cppimpl.concert_wrapJNI.<clinit>(concert_wrapJNI.java:15)
            ... 5 more
    

     


    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: CP Optimizer on OSX and Java

    Posted Tue March 07, 2017 05:03 AM

    Originally posted by: rdumeur


    Dear MBecker,

     

    An easy way to know what are the setting to run java examples is to go in the

    <cplex_studio_installdir>/cpoptimizer/examples/x86-64_osx/static_pic
    
    

    and run the java examples:

    make execute_java

    This will print execution command like:

    DYLD_LIBRARY_PATH=../../../bin/x86-64_osx:../../../../cplex/bin/x86-64_osx:$DYLD_LIBRARY_PATH /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java  -classpath ../../../lib/ILOG.CP.jar:. PlantLocation
    

    so if you add

    DYLD_LIBRARY_PATH=<cplex_studio_installdir>/cpoptimizer/bin/x86-64_osx:<cplex_studio_installdir>/cplex/bin/x86-64_osx:$DYLD_LIBRARY_PATH
    

    to your environment, your program should run.

    I hope this helps,

     

    Cheers,

     


    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: CP Optimizer on OSX and Java

    Posted Wed March 08, 2017 02:48 AM

    Originally posted by: MBecker


    Thank you for the fast answer! I managed to get the examples to run, so the rest should be manageable :) 


    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: CP Optimizer on OSX and Java

    Posted Wed March 22, 2017 10:26 AM

    Originally posted by: MohammadAbdollahi


    MBecker.

     

    How did you get cpoptimizer working? I have the same platform (java + osx) and have the same error. when I'm updating DYLD_LIBRARY_PATH it ain't working. I highly appreciate your advice. Thanks!


    #CPOptimizer
    #DecisionOptimization


  • 5.  Re: CP Optimizer on OSX and Java

    Posted Tue March 28, 2017 12:06 PM

    Originally posted by: MBecker


    Hi,

     

    I managed to get the examples to execute using the script that is provided. (make execute_java)

    So I now know that CP works on my OSX installation under Java. 

    What I didn't manage yet is to find the correct settings for the path variables to get it working in Eclipse (unfortunately I didn't had much time to look int that lately). 

    Any help in that would be great!


    #CPOptimizer
    #DecisionOptimization


  • 6.  Re: CP Optimizer on OSX and Java

    Posted Tue March 28, 2017 01:41 PM

    Originally posted by: MohammadAbdollahi


    I got the examples running as well. If you open up the makefile you see that for every example the DYLD_LIBRARY_PATH is set to have .dll files for cpoptimizer (bin/x_86-64_osx). However, I'm not able to set this path variable, and I do not know why it is not working. I tried to export the path in .bash_profile, but it ain't working. I appreciate any help in this regard.


    #CPOptimizer
    #DecisionOptimization


  • 7.  Re: CP Optimizer on OSX and Java

    Posted Mon April 03, 2017 03:58 AM

    Originally posted by: MBecker


    I had the same issues with trying to set this variable outside of the makefile. Any hep would be great to resolve this!


    #CPOptimizer
    #DecisionOptimization


  • 8.  Re: CP Optimizer on OSX and Java

    Posted Mon April 03, 2017 11:52 AM

    Originally posted by: MohammadAbdollahi


    I added DYLD_LIBRARY_PATH to my IDE ( I'm using eclipse) environment. To do so, in your run configuration, you should add .dll files for both cplex ad cpoptimizer in your dynamic library path. I attached a screen shot of where to find it. 


    #CPOptimizer
    #DecisionOptimization


  • 9.  Re: CP Optimizer on OSX and Java

    Posted Tue April 04, 2017 04:48 AM

    Originally posted by: MBecker


    Did it work like this?

     

    I added both to the build path and linked where to find the native libraries.

    Then I also set the variables similar as you did. But still the same error.

    I attached screenshots of both configurations. (I try to get the SchedSequence example to work in eclipse)

    Is there anything different to the way you solved it?

    Any hints would be greatly appreciated :) 


    #CPOptimizer
    #DecisionOptimization