IBM Support

Using common shell features like command history, command-line editing, or tab-completion of file names within the Interactive Optimizer

Question & Answer


Question

How can I use common shell features like command history, command-line editing, or tab-completion of file names within the Interactive Optimizer?

Answer

The Interactive Optimizer does not support these features by itself. However, if your system has GNU readline installed, you can equip the Interactive Optimizer with command history, command-line editing, and tab-completion of file names by using a binary wrapper such as RLwrap for the CPLEX executable. RLwrap is released according to the GPL (open source license) and is available at http://freecode.com/projects/rlwrap. Note that some Linux versions come with this utility already installed.

Windows users should note that Cygwin normally has GNU readline already installed.

After compiling and installing, you can execute the Interactive Optimizer the following way in order to have access to a command history, command-line editing, and tab-completion of file names:


% rlwrap -c cplex

If you seek more flexibility and functionality from the Interactive Optimizer, consider using CPLEX's Python API as an alternative. Python is an interpreted language, so you can use it interactively. CPLEX's Python API, available in versions 12.1 and later, enables you to perform many more operations than the Interactive Optimizer, with only a slight increase in the number of statements. And, recent versions of Python include modules you can import that implement shell features such as readline, history and tab completion. You simply import the modules at the start of your Python session, instead of having to install and learn how to use the wrapper described above. See document 1425643 for the details.

[{"Product":{"code":"SSSA5P","label":"IBM ILOG CPLEX Optimization Studio"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Interactive Optimizer","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF014","label":"iOS"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"12.6;12.5;12.4;12.3;12.2","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

cplex/FAQ/153

Document Information

Modified date:
16 June 2018

UID

swg21400070