Installation on Linux is pretty easy: extract the archive appropriate to your particular OS and architecture, unpack it somewhere, and park the license file someplace you can find it. (Details are spelled out in a Quick Start guide.) That leaves the question of how you're going to run the interactive optimizer.
I decided to use a mix of two approaches on my systems, which run Linux Mint (which shares most of its plumbing with Ubuntu). One approach was to create a run.sh file in the CPLEX installation directory. The contents were pretty simple:
#!/bin/bash
export ILOG_LICENSE_FILE=<absolute_path_to_file>/access.ilm
<absolute_path_to_binary>/cplex
export ILOG_LICENSE_FILE=<absolute_path_to_file>/access.ilm
<absolute_path_to_binary>/cplex
I ran chmod +x run.sh in a terminal to make it executable, then added it to Mint's main menu (mint-menu) by right-clicking the menu, selecting Edit menu, selecting an appropriate submenu, clicking New item, making the type Application in Terminal, and making the command
It's also handy to be able to run the interactive optimizer from an arbitrary directory (so that I don't have to type in paths when I load files). Mint provides a convenient Open in Terminal command as part of the context menu for the file browser. (This can be added to Ubuntu by creating a shell script for it.) To make CPLEX available anywhere, in any terminal window, I created a .bash_profile file in my home directory (since I didn't already have one) and added the following lines:
export ILOG_LICENSE_FILE=<absolute_path>/access.ilm
alias cplex=<absolute_path>/cplex
alias cplex=<absolute_path>/cplex
Technically I think the alias command might belong in .bashrc (which I also didn't have) rather than .bash_profile, but it works there, and why create two files if I only need one? So now I can run CPLEX's interactive optimizer in any directory.
Turns out I ended up putting the alias and export in .bashrc after all. Just installed the academic version of CPLEX Studio 12.2 (CPLEX, OPL, CPOptimizer on Linux, same plus OPL Studio on Windows). I also bit the bullet and put the access.ilm file (a separate download) in its default location (/usr/ilog/ilm), which means I don't need to screw around exporting its location.
ReplyDeleteI did All you recomended, but when I am runing runfile it returns:"CPLEX Error 32201: ILM Error 16: CPLEX: license file not found or unreadable.
ReplyDeleteExiting " What's wrong? Help please.
thanks
kaveh
I assume that you have a valid license file installed somewhere. Run "printenv | grep ILOG" in a terminal and verify that the path it gives to the license file correctly points to the license file.
ReplyDeleteAlso, are you running the interactive optimizer, using the callable library, or running the IDE? I had to create a batch file to start the IDE. (The batch file contains the EXPORT command described above.)
I could use the interactive optimizer on Linux. But I can't find the way to run *.mod files(the example in "opl/examples/opl/" directory) What should I do?
ReplyDeletethanks
Stanly
kuokuo321@gmail.com
As of version 12.3 (possibly 12.2), the Linux distribution of CPLEX includes the OPL IDE. You should be able to run opl/oplide/oplide from a terminal. In the IDE, you can open one of the examples with File > New > Example...; click the folder of IBM examples and use the wizard's many options to find the example you want.
ReplyDeleteIf you prefer a command line version, in a terminal you can run opl/bin//oplrun. Executed without any arguments, it will give you a typical help message. You may need to preface it with 'export LD_LIBRARY_PATH=...' where ... is the path to the folder containing oplrun.
Hi, im following your answers about Opl-Cplex, and i have a question... do you know how call a csv in Linux's Opl-Cplex? Thanks
ReplyDeleteI use CPLEX (frequently) but not OPL. You might find what you need in this thread on the developerWorks OPL/CPLEX forum: http://www.ibm.com/developerworks/forums/thread.jspa?threadID=367312.
Delete