0% found this document useful (0 votes)
107 views36 pages

Introduction To CPLEX

This document provides an introduction to CPLEX Optimization Studio, which includes the OPL modeling language, an integrated development environment, the CPLEX optimizer engine, and the CP optimizer engine. It discusses downloading and installing CPLEX, creating a CPLEX project with model, data, and external data files, and the structure of a CPLEX model file, data file, and external data files. It also provides examples of mathematical models and how to code them in OPL to be solved by CPLEX. Finally, it discusses working with CPLEX in class, including using CPLEX to solve optimization problems.

Uploaded by

Minh Hoàng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views36 pages

Introduction To CPLEX

This document provides an introduction to CPLEX Optimization Studio, which includes the OPL modeling language, an integrated development environment, the CPLEX optimizer engine, and the CP optimizer engine. It discusses downloading and installing CPLEX, creating a CPLEX project with model, data, and external data files, and the structure of a CPLEX model file, data file, and external data files. It also provides examples of mathematical models and how to code them in OPL to be solved by CPLEX. Finally, it discusses working with CPLEX in class, including using CPLEX to solve optimization problems.

Uploaded by

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

Introduction to CPLEX

Đỗ Vĩnh Trúc
CONTENTS
• I. INTRODUCTION to CPLEX
• II. Structure of a CPLEX Model
• III. Practice with code
• IV. Works in class

Đỗ Vĩnh Trúc
I. Introduction
• CPLEX Optimization Studio is composed of:
– OPL, the Optimization Programming Language, used
to write mathematical models.
– An integrated development environment (IDE) that
enables you to develop and test the models.
– The CPLEX Optimizer engine, to find solutions to
models that require mathematical programming
techniques.
– The CP Optimizer engine, to find solutions to models
that require constraint programming techniques.

Đỗ Vĩnh Trúc
I. Download and Installation
• Register a member at
http://www-
304.ibm.com/ibm/university/academic/pub/pag
e/academic_initiative

Đỗ Vĩnh Trúc
Download and Installation
• Login to IBM Academic Initiative
• Download IBM ILOG CPLEX
OPTIMIZATION STUDIO 12.6.2 for
Windows 32 , or 64, or MAC

Đỗ Vĩnh Trúc
Download and Installation
• Download and installation

Đỗ Vĩnh Trúc
Main Screen

Đỗ Vĩnh Trúc
CREATE A PROJECT
• Click File->New->OPL Project
• Project name:
– Enter name of project
• Create Model:
– Add a new model
• Create Data
– Use a data file

Đỗ Vĩnh Trúc
Đỗ Vĩnh Trúc
Example 1
• Basic LP Example
• Min 0.12x+0.15y
• Subject to: 60x+60y>=300
• 12x+6y>=36
• 10x+30y>=90
• x>=0; y>=0

Đỗ Vĩnh Trúc
Input the program

Đỗ Vĩnh Trúc
How to run the model?
• Drag and drop example01.mod to Run
Configurations, and you see

Đỗ Vĩnh Trúc
How to run the model?
• Right click on Configuration1 -> Run this
• See the result

Đỗ Vĩnh Trúc
Modify the example01
• In example01 project, click
• File->New->Model
• Enter example02
• Copy example01 and
• Paste to example02

Đỗ Vĩnh Trúc
• Add the following code
• Drag and drop to Run Configurations
• Configuration2 is added
• Run the model

Đỗ Vĩnh Trúc
Result

Đỗ Vĩnh Trúc
II. Structure of a CPLEX Project
• Model File: *.mod
• Data File: *.dat (optional)
• External Data File: Excel file, Access File
(optional)
• Text File: Result file (optional)
These files must be stored in the same folder

Đỗ Vĩnh Trúc
Model File
• Declare:
– The size of indexes (int)
– Range of indexes (range)
– Parameters (float, int)
– Decision variables (dvar; data type float+, int+,
Boolean)
– Objective function (minimize, maximize)
– Constraints (sum(), forall())

Đỗ Vĩnh Trúc
Data File
• Declare value of variables in Model file
• Connect to Excel, Access file
• Read/Write data from/to Excel, Access file

Đỗ Vĩnh Trúc
External Data File
• Excel/Access:
– Store data
– Write result

Đỗ Vĩnh Trúc
Text File
• Write more details from solution to a text file,
for example t1.txt, t2.txt,…

Đỗ Vĩnh Trúc
III. Practice with CODE

Đỗ Vĩnh Trúc
Mathematical Model
0 If arc i → j is not included
Let xi j = 
1 If arc i → j is included

Min  c x
i j
ij ij

Subject t o :
1 if i = 1

x -x
j
ij
k
ki = 0 i f i = 2, m - 1
-1 i f i = m

x i j = 0 or 1

Đỗ Vĩnh Trúc
Case 1: Only *.mod

Đỗ Vĩnh Trúc
Case 2: *.Mod and *.dat

Đỗ Vĩnh Trúc
*.dat file content

Đỗ Vĩnh Trúc
Case 3: *.mod, *.dat, *.xlsx

Đỗ Vĩnh Trúc
*.dat

Đỗ Vĩnh Trúc
*.xlsx

Đỗ Vĩnh Trúc
Result

Đỗ Vĩnh Trúc
IV. Works in Class
• 1.Using Cplex to solve

Đỗ Vĩnh Trúc
Đỗ Vĩnh Trúc
2. Using cplex to solve

Đỗ Vĩnh Trúc
Đỗ Vĩnh Trúc
Đỗ Vĩnh Trúc
Thank you for your
listening and
practicing
Đỗ Vĩnh Trúc

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy