Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Compile using old CPLEX version

    Posted Thu February 21, 2013 06:07 PM

    Originally posted by: SystemAdmin


    I have several versions of cplex and I want to compile using an old one.

    The current command line is : $(CXX) $(CFLAGS) -o x x.o -lilocplex -lconcert -lcplex -lm -lpthread

    Thanks for your suggestions,
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Compile using old CPLEX version

    Posted Thu February 21, 2013 06:29 PM

    Originally posted by: T_O


    Where is the problem? Just change the actual include and library path to the older CPLEX version and hope that the API is compatible.

    Best regards,
    Thomas
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Compile using old CPLEX version

    Posted Thu February 21, 2013 07:05 PM

    Originally posted by: SystemAdmin


    Hi thanks for your answer,

    I am not familiar with the compilation arguments, and I do not know how to change the include and library path to the older CPLEX version.

    The libraries are stored in the folder named /home/modules/modulefiles

    and how I can change the above command to use cplex-studio/12.1 version?

    I am sorry for a such easy question, but I have no clue from where I should start because of my UNIX/linux knowledge.

    MInh.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Compile using old CPLEX version

    Posted Thu February 21, 2013 07:21 PM

    Originally posted by: T_O


    Ok. First of all, somewhere your include and library paths must be defined (otherwise the compiler would not be able do locate CPLEX). Could you post the output of the following command:
    env | grep _PATH
    


    Best regards,
    Thomas

    P.S.: You could set include and library paths using -I and -L, but i don't know which one is preferred then. So let's find out, where your path is set.
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Compile using old CPLEX version

    Posted Thu February 21, 2013 07:39 PM

    Originally posted by: SystemAdmin


    Thanks for your kindly help, this is the output of the grep :

    LIBRARY_PATH=/home/ibm/cplex-studio/12.5.0.0/cpoptimizer/lib/x86-64_sles10_4.1/static_pic:/home/ibm/cplex-studio/12.5.0.0/opl/lib/x86-64_sles10_4.1/static_pic:/home/ibm/cplex-studio/12.5.0.0/concert/lib/x86-64_sles10_4.1/static_pic:/home/ibm/cplex-studio/12.5.0.0/cplex/lib/x86-64_sles10_4.1/static_pic
    LD_LIBRARY_PATH=/home/ibm/cplex-studio/12.5.0.0/opl/bin/x86-64_sles10_4.1:/home/ibm/cplex-studio/12.5.0.0/cplex/bin/x86-64_sles10_4.1:/home/sungrid/sge-6.0u3/lib/lx24-amd64:/usr/lib64/mpi/gcc/openmpi/lib64
    LIBRARY_PATH_EXPANDED=-L/home/ibm/cplex-studio/12.5.0.0/cpoptimizer/lib/x86-64_sles10_4.1/static_pic -L/home/ibm/cplex-studio/12.5.0.0/opl/lib/x86-64_sles10_4.1/static_pic -L/home/ibm/cplex-studio/12.5.0.0/concert/lib/x86-64_sles10_4.1/static_pic -L/home/ibm/cplex-studio/12.5.0.0/cplex/lib/x86-64_sles10_4.1/static_pic
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Compile using old CPLEX version

    Posted Fri February 22, 2013 02:06 AM

    Originally posted by: SystemAdmin


    If you are unfamiliar with Linux/Unix and Makefiles then I think there is an easier way. CPLEX comes with example code and a Makefile to build them. In your CPLEX installation there should be a directory cplex/examples/x86-64_sles10_4.1/static_pic (in very old version 'sles' maybe 'debian'). Do the following
    1. Change to that directory.
    2. Run 'make lpex1'. This will compile the lpex1.o object file as well as the lpex1 binary. From the output you can see which flags you need to supply for compilation.
    3. Do this for each version you have.
    4. Adjust your own build process accordingly.
    What may be even easier is to copy cplex/examples/x86-64_sles10_4.1/static_pic/Makefile to your own Makefile (in the directory where x.c is). The only things you need to change are
    1. Replace the string "lpex1" by "x" (so that the x.c source file is compiled into the "x" binary.
    2. Change the two assignments
    
    CPLEXDIR      = ../../.. CONCERTDIR    = ../../../../concert
    

    into (replacing /path/to/COS with the respective CPLEX installation directory)
    
    CPLEXDIR      = /path/to/COS/cplex CONCERTDIR    = /path/to/COS/concert
    

    3. Run 'make x'
    4. Optionally delete everything that is not needed from the copied Makefile.
    Note that the example Makefile has also rules to build C++ and Java examples.

    If you run into further troubles with that then please specify
    • which version of CPLEX causes the trouble,
    • where that version is installed,
    • what exactly are the error messages you see.

    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Compile using old CPLEX version

    Posted Fri February 22, 2013 04:58 AM

    Originally posted by: T_O


    Ok, thank you. I don't yet see where the include path comes from (I guess it comes from the flags).

    Either follow Daniel's approach or provide the output of
    env | grep cplex
    


    For your information:
    It should be sufficient to change some environement variables for the compile command. Something like

    LIBRARY_PATH=/foo/bar/lib OTHER_VARIABLE_WHICH_I_DONT_KNOW_YET=something your_old_build_command ...

    Best regards,
    Thomas
    #CPLEXOptimizers
    #DecisionOptimization