In this tutorial I will describe how to configure Apple Xcode to use IBM CPLEX with Concert technology in a C++ project. This tutorial assumes you already have CPLEX installed. If this is not the case, follow the How to Download and Install a full version of CPLEX (for Mac, obviously).
First, start Xcode and select “Create a new Xcode project”. This is also available from the File menu.
Select OS X Application and Command Line Tool.
Give your project a name and save it in your computer.
Under Build Phases, select Link Binary with Libraries, and click the plus icon to add one item.
You will look for CoreFoundation.framework, and repeat the process and look for IOKit.framework.
Then you will click the plus icon and click the Add other button. Navigate through the installation folders of CPLEX as indicated below and add the libconcert.a file.
Repeat these steps to add the CPLEX library files as indicated below.
Now in the Build Settings, navigate down to Search Paths and update the Header Search Paths with the “include” folders of both CPLEX and Concert, and the Library Search Paths with the appropriate “lib” folders of both CPLEX and Concert.
Navigate a bit further to the Custom Compiler Flags and under Other C Flags add -DIL_STD, and under Language C++ select the standard library as indicated below.
You are now ready to start coding. For this tutorial, I used the facility.cpp example that ships with CPLEX. See the source file and the data file below, as well as the result of the optimization.
Enjoy it and happy coding!
Thanks to Rabie Jaballah.
This was useful? Buy me a cup of coffee to help me keep this website running!