Document not found! Please try again

CPLEX Tutorial Handout

76 downloads 2978 Views 362KB Size Report
modeling facilities to allow the programmer to embed CPLEX optimizers in C++, Java, ... Library is a C library that allows the programmer to embed ILOG CPLEX.
CPLEX Tutorial Handout What Is ILOG CPLEX? ILOG CPLEX is a tool for solving linear optimization problems, commonly referred to as Linear Programming (LP) problems, of the form: Maximize (or Minimize)

c1x1 + c2x2 +...+ cnxn

subject to

a11x1 + a12x2 +...+ a1nxn ~ b1 a21x1 + a22x2 +...+ a2nxn ~ b2 ... am1x1 + am2x2 +...+ amnxn ~ bm

with these bounds

l1 ... ln

x1

u1

xn

un

where ~ can be , , or =, and the upper bounds ui and lower bounds li may be positive infinity, negative infinity, or any real number. The elements of data you provide as input for this LP are: Objective function coefficients

c1, c2, ... , cn

Constraint coefficients

a11, a21, ... , an1 ... am1, am2, ..., amn

Right-hand sides

b1, b2, ... , bm

Upper and lower bounds

u1, u2, ... , un and l1, l2, ... , ln

The optimal solution that ILOG CPLEX computes and returns is: Variables

x1, x2, ... , xn

ILOG CPLEX also can solve several extensions to LP: • Network Flow problems, a special case of LP that CPLEX can solve much faster by exploiting the problem structure. • Quadratic Programming (QP) problems, where the LP objective function is expanded to include quadratic terms. • Mixed Integer Programming (MIP) problems, where any or all of the LP or QP variables are further restricted to take integer values in the optimal solution and where MIP itself is extended to include constructs like Special Ordered Sets (SOS) and semi-continuous variables. ILOG CPLEX Components CPLEX comes in three forms to meet a wide range of users' needs:

1





The CPLEX Interactive Optimizer is an executable program that can read a problem interactively or from files in certain standard formats, solve the problem, and deliver the solution interactively or into text files. The program consists of the file cplex.exe on Windows platforms or cplex on UNIX platforms. Concert Technology is a set of C++, Java, and .NET class libraries offering an API that includes modeling facilities to allow the programmer to embed CPLEX optimizers in C++, Java, or .NET applications. The following table lists the files that contain the libraries. Microsoft Windows

UNIX

C++

ilocplex.lib concert.lib libilocplex.a libconcert.a

Java

cplex.jar

cplex.jar

C#.NET ILOG.CPLEX.dll ILOG.CONCERT.dll •

The CPLEX Callable Library is a C library that allows the programmer to embed ILOG CPLEX optimizers in applications written in C, Visual Basic, FORTRAN, or any other language that can call C functions.The library is provided in files cplex.lib and cplex.dll on Windows platforms, and in libcplex.a, libcplex.so, and libcplex.sl on UNIX platforms.

Solving an LP with ILOG CPLEX The problem to be solved is: Maximize

x1 + 2x2 + 3x3

subject to

-x1 + x2 + x3 x1 - 3x2 + x3

with these bounds

0 0 0

x1 x2 x3

20 30

40 + +

Using the Interactive Optimizer The following sample is screen output from a CPLEX Interactive Optimizer session where the model of an example is entered and solved. CPLEX> indicates the CPLEX prompt, and text following this prompt is user input. Welcome to CPLEX Interactive Optimizer 9.0.0 with Simplex, Mixed Integer & Barrier Optimizers Copyright (c) ILOG 1997-2003 CPLEX is a registered trademark of ILOG Type 'help' for a list of available commands. Type 'help' followed by a command name for more information on commands. CPLEX> enter example Enter new problem ['end' on a separate line terminates]: maximize x1 + 2 x2 + 3 x3

2

subject to -x1 + x2 + x3