Install CPLEX#
CPLEX comes with a variety of tools and interfaces including a full-featured integrated development environment (IDE). However, we require only two components, the lightweight cplex and docplex Python packages.
Academic users#
Academic users cannot use the versions of cplex and docplex that are installed automatically when you install M4OPT using pip. Instead, they need to use the Python packages that come with the full academic software distribution of IBM ILOG CPLEX Optimization Studio, following the instructions below.
In a Web browser, navigate to the IBM SkillsBuild site.
Click the Log in or Sign up button in the top-right corner of the page. Select College software downloads. Register using your institutional email address (for example, one that ends in
.edu).Note
If you encounter issues with being recognized as part of an academic institution, you can refer to the guide on creating an IBM Cloud account for assistance.
Navigate to Data Science in the left sidebar and then click ILOG CPLEX Optimization Studio. Under Download method, select HTTP. Then click the Download button.
In the Part number search box, enter
G0D3KML. Then click the Search button. This should bring up the search result,IBM ILOG CPLEX Optimization Studio V22.1.2 Multiplatform Multilingual eAssembly.Important
It is important that you select version 22.1.2 because this is the version of CPLEX that is currently used by M4OPT.
Following the onscreen instructions, download and run the appropriate installer for your operating system.
Hint
If you are installing CPLEX on a remote Linux system, copy the installer file (e.g.
cplex_studio2212.linux_x86_64.bin) to that system. Launch the installer by running the commandsh cplex_studio2212.linux_x86_64.bin.Make a note of where the installer placed ILOG CPLEX Optimization Studio (for example,
/opt/ibm/ILOG/CPLEX_Studio2212). In the Python environment in which you have installed M4OPT, run the following command to enable your full academic version, updating the path as appropriate for your system:$ docplex config --upgrade /opt/ibm/ILOG/CPLEX_Studio2212
All others#
IBM offers a variety of license options for CPLEX and differentiates between “development” and “production” use.
A particularly cost-effective and flexible option for non-production use is the “Developer Subscription”. It allows a single authorized user to install and run an unlimited number of concurrent solves with an unlimited number of threads on an unlimited number of machines.
If you purchase a Developer Subscription, then activating the full version of CPLEX is particularly straightforward, because no software downloads are required. Follow these two steps:
IBM will have sent you your CPLEX Studio API key by email. Find this key.
Set the environment variables
CPLEX_STUDIO_KEYandCPLEX_STUDIO_KEY_SERVERby running these commands, replacingxxxxxxxxxxwith your API key:export CPLEX_STUDIO_KEY=xxxxxxxxxx export CPLEX_STUDIO_KEY_SERVER=https://scx-cos.docloud.ibm.com/cos/query/v1/apikeys
Consider adding these commands to your login shell’s profile script.