0% found this document useful (0 votes)
10 views19 pages

OR LP Python

The document discusses the application of Python in industrial engineering, specifically using CPLEX as an optimization tool. It outlines the benefits of the Python API for CPLEX, including its ease of use and integration with other libraries, and provides examples of linear programming and optimization problems. Additionally, it includes exercises related to the binary knapsack problem and model formulation for production constraints.

Uploaded by

thu.phamngocthu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views19 pages

OR LP Python

The document discusses the application of Python in industrial engineering, specifically using CPLEX as an optimization tool. It outlines the benefits of the Python API for CPLEX, including its ease of use and integration with other libraries, and provides examples of linear programming and optimization problems. Additionally, it includes exercises related to the binary knapsack problem and model formulation for production constraints.

Uploaded by

thu.phamngocthu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Chapter : Applied python in industrial Engineering – Optimization tool

Approach

Lê Đức Đạo, Phd


Industrial System Enginerring Department
Faculty of Mechanical Engineering
Ho Chi Minh City University Of Science and Technology
Phone: 0937286746
Email: [email protected]
OVERVIEW OF CPLEX
CONNECTORS
• CPLEX core routines are coded in C.
• CPLEX has a tool interactive optimizer for quick diagnostics
• CPLEX provides various wrappers and connectors for other programming languages
and applications.
• C++
• Java
• .NET
• MATLAB
• Python
• Excel
OVERVIEW OF CPLEX
CONNECTORS
WHY PYTHON API?
 Open source scripting language
 Easy to learn and maintain
 Provides procedural, functional and object-oriented paradigms
 Interpreted language
 Provides other mature libraries for visualizations, statistical analysis and other
scientific computing
 Combined capabilities of other CPLEX APIs and Interactive CPLEX
• Can be used instead of interactive CPLEX
• Has capabilities to do iterative solves, callbacks like other CPLEX APIs
INSTALL CPLEX FUNCTION
TO PYTHON
CPLEX BASIS ON LINEAR
PROGRAMMING

Two decision variable x and y


CPLEX BASIS ON LINEAR
PROGRAMMING

Optimal solution

Can we solve If
we add one
5 𝑥+ 4 𝑦=10
decision variable
z to the model
CPLEX BASIS ON LINEAR
PROGRAMMING
Import Cplex function

Import decision variable

Import constraint

Import objective and called solved functio

Result
CPLEX BASIS ON LINEAR
PROGRAMMING
CPPLEX BASIS ON LINEAR
PROGRAMMING
Import Cplex function

Different type of decision Import decision variable


variable

Import constraint
CPLEX BASIS ON LINEAR
PROGRAMMING
Solution with different type of result
x=.binary_var
y=continuous_var
z=integer_var
OPTIMIZATION PROBLEM

Production time of
Foldyphone=1.5

Production time
of tiny phone=2
MODEL FORMULATION
number of foldyphone production
number of tinyphone production
Production time
of
Objective function
Foldyphone=1.5
Maximize 900 +1100
Constraints
>=200
>=500 Production
1.5 + 2 time of tiny
phone=2
OR OPTIMIZATION TOOL
BASED ON CPLEX-PYTHON
FUNCTION
Import Cplex function

Import manufacturing product

Import parameter
OR OPTIMIZATION TOOL
BASED ON CPLEX-PYTHON
FUNCTION
Number of production constraint

Total Production Constraint


OR OPTIMIZATION TOOL
BASED ON CPLEX-PYTHON
FUNCTION
OBJ and
called solve
function
BINARY KNAPSACK
PROBLEM – IN CLASS
EXERCISES

Objective
Optimize the bag's capacity for high-value
products.

Constraint
The total weight stored in bag should be less
than bag capacity
BUILD THE MODEL – IN
CLASS EXERCISES
Objective

Max

Constraints
SOLVE THE MODEL IN CLASS
EXERCISES
 Work in group for solving the model using cplex-python

You might also like