Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  question on run my own Cplex problem coded in c++ on Linux platform

    Posted 09/08/10 06:42 PM

    Originally posted by: billtheguy


    I have cplex121 installed on my Linux system. I run the verification of installation successfully. I can execute the examples and the results is right as described on the user's manual.

    But in all your documents ILOG provides, I can't find how to run my own problem. Now I am doing it in an inconvenient way, I copy my c++ code to the example "blend.cpp" and use "make blend" "./blend" to get my results. If I create my own myproblem.cpp file, and "make myproblem", the terminal tells me "make: *** No rule to make target `myproblem'. Stop.". So what's the right way of doing it?
    Plus, who knows how to setup IDE to use CPLEX concert?

    Thanks
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: question on run my own Cplex problem coded in c++ on Linux platform

    Posted 09/08/10 08:59 PM

    Originally posted by: EdKlotz


    > billtheguy wrote:
    > I have cplex121 installed on my Linux system. I run the verification of installation successfully. I can execute the examples and the results is right as described on the user's manual.
    >
    > But in all your documents ILOG provides, I can't find how to run my own problem. Now I am doing it in an inconvenient way, I copy my c++ code to the example "blend.cpp" and use "make blend" "./blend" to get my results. If I create my own myproblem.cpp file, and "make myproblem", the terminal tells me "make: *** No rule to make target `myproblem'. Stop.". So what's the right way of doing it?
    >
    >

    Instead of copying your program to one of the existing examples, try modifying the make file to accommodate your program. Let's have a look at how the Unix make file builds the blend.cpp example:
    blend: blend.o
    $(CCC) $(CCFLAGS) blend.o -o blend $(CCLNFLAGS)
    blend.o: $(EXSRCCPP)/blend.cpp
    $(CCC) -c $(CCFLAGS) $(EXSRCCPP)/blend.cpp -o blend.o

    So, make a copy of this, and then change all occurrences of "blend"
    to "myproblem". Put your myproblem.cpp file in the directory with
    the CPLEX examples. "make myproblem" should then work for you. As your
    programs become more complex, you will need to modify the make file accordingly,
    which means creating the dependencies between each .cpp and .o file.
    Also, if you put your program somewhere else, note that the make file uses
    relative paths for the CPLEX include files and libraries. If you change the
    location of your program, you will need to change the paths of the include
    files and libraries.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: question on run my own Cplex problem coded in c++ on Linux platform

    Posted 09/09/10 11:55 AM

    Originally posted by: billtheguy


    Thanks.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: question on run my own Cplex problem coded in c++ on Linux platform

    Posted 09/09/10 03:33 AM

    Originally posted by: SystemAdmin


    What IDE do you (want to) use?

    Ed already explained how to adapt the example Makefile. Attached is a generic Makefile that I sometimes use to build CPLEX and/or concert projects.
    Only the section labeled "Version dependent setup" must be adjusted to your installation. After you did that copy all your source files and the makefile to a directory and just run 'make' in this directory. It will compile all files ending in .c or .cpp and create a program called 'main'. It will also take care of dependencies etc. I find it rather convenient.
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: question on run my own Cplex problem coded in c++ on Linux platform

    Posted 09/09/10 11:09 AM

    Originally posted by: billtheguy


    I use code::block. Thank you.
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: question on run my own Cplex problem coded in c++ on Linux platform

    Posted 09/10/10 04:22 AM

    Originally posted by: SystemAdmin


    This should work for Code::Blocks and CPLEX 12.1 (assuming you installed CPLEX in directory /ilog):

    In Project -> Build Options select "Debug" for your project ("Release" works analogously), go to the "Search directories" tab and there to the "Compiler" sub-tab. Add directories
    /ilog/cplex121/include/ 
    /ilog/concert29/include/ 
    

    Now switch to the "Linker" subtab and add directories
    /ilog/cplex121/lib/x86-64_debian4.0_4.1/static_pic/ 
    /ilog/concert29/lib/x86-64_debian4.0_4.1/static_pic/ 
    

    Now switch to the "Linker Settings" tab and add the following libraries:
    ilocplex
    concert
    cplex
    m
    pthread
    

    Finally switch to the "Compiler Settings" tab and there to the "#defines" sub-tab. Add
    IL_STD
    

    to that list.
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: question on run my own Cplex problem coded in c++ on Linux platform

    Posted 03/23/15 01:04 AM

    Originally posted by: Mr.EU


    I didn't understand the "Linker Settings" please mention the path, or is it only need write those 5 libraries.


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: question on run my own Cplex problem coded in c++ on Linux platform

    Posted 03/23/15 01:56 AM

    If you setup the linker directories correctly then you only need to specify those 5 libraries. The linker will look for those libs in the directories that you specified in the linker directory setup.


    #CPLEXOptimizers
    #DecisionOptimization