Skip to content

Latest commit

 

History

History
50 lines (41 loc) · 1.8 KB

cplex_instruction.md

File metadata and controls

50 lines (41 loc) · 1.8 KB

Instruction for CPLEX Python API

1. Download and install CPLEX Optimization Studio

Download IBM ILOG CPLEX Optimizer, then install it step by step.

2. Download and install "Visual C++ Redistributable Packages for Visual Studio 2013"(Windows only)

Visual C++ Redistributable Packages for Visual Studio 2013

3. Install python.

SPSS Modeler prefer Anaconda python (2.7).

4. Install CPLEX python package

Go to {CPLEX Optimization Studio install folder}\cplex\python\2.7{os} and run "python setup.py install"

Notes:

  • a. refer to this link for more detail information.

5. Run "pip install docplex"

Ensure pip enable, and run pip install docplex to install docplex package.

6. Download sample code

Download sample code from github docplex example.

7. In console run

python \examples\mp\modeling\diet.py

Configure success if get result.

Model: diet
 - number of variables: 9
   - binary=0, integer=0, continuous=9
 - number of constraints: 7
   - linear=7
 - parameters: defaults
* model solved as function:
objective: 2.690
  "Spaghetti W/ Sauce"=2.155
  "Lowfat Milk"=1.831
  "Chocolate Chip Cookies"=10.000
  "Hotdog"=0.930
* KPI: Total Calories=2000.000
* KPI: Total Calcium=800.000
* KPI: Total Iron=11.278
* KPI: Total Vit_A=8518.433
* KPI: Total Dietary_Fiber=25.000
* KPI: Total Carbohydrates=256.806
* KPI: Total Protein=51.174