How to: Configure IBM CPLEX with Apple Xcode

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.

1

Select OS X Application and Command Line Tool.

2

Give your project a name and save it in your computer.

3

Under Build Phases, select Link Binary with Libraries, and click the plus icon to add one item.

4

You will look for CoreFoundation.framework, and repeat the process and look for IOKit.framework.

5

6

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.

7

8

Repeat these steps to add the CPLEX library files as indicated below.

9

10

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.

11

12

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.

13

14

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.

16

15

17

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!





Published by

Leandro Coelho

Was this useful? Pay me a coffee to help me keep this site running.