1 / 16

Using ILOG Cplex

Using ILOG Cplex. Mathematical Programming Problem. Seeks to optimize an objective function subject to constraints. Types of mathematical programming problems Linear Programming Mixed Integer Programming Non-linear Programming. ILOG CPLEX. Efficient Fast Industry standard

Download Presentation

Using ILOG Cplex

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Using ILOG Cplex

  2. Mathematical Programming Problem • Seeks to optimize an objective function subject to constraints. • Types of mathematical programming problems • Linear Programming • Mixed Integer Programming • Non-linear Programming

  3. ILOG CPLEX • Efficient • Fast • Industry standard • offers C, C++, Java, and C#.NET libraries that solve linear programming (LP) and related problems.

  4. Characteristics of Linear Programming • Objective function (min or max) is a linear function. • Constraint types are ,=, or . • If f is a linear function and if b is a real number, then the equation • f(x1,x2,…,xn) = b is called a linear equation, and the inequalities • f(x1,x2,…,xn) ≤b, and • f(x1,x2,…,xn) ≥b are called linear inequalities. • Linear equations and linear inequalities are both referred to as linear constraints.

  5. Feasible and Optimal Solutions • Variables x1,x2,…,xnthat satisfy all the constraints of an LP problem are said to constitute a feasible solution. • A feasible solution that maximizes ( or minimizes) the objective function is called an optimal solution, the corresponding value of the objective function is called the optimal value. • Optimal solution may not be unique.

  6. Additional Types of Variables • All integer • All variables are restricted to have integer values • Mixed integer • some variables are restricted to have integer values • Binary • variables are restricted to have integer values of either 0 or 1

  7. ILOG CPLEX Optimizer • The data provided as input to the solver are: • Objective function coefficients  c1, c2, ... , cn • Constraint coefficients,  a11, a21, ... , an1,... am1, am2, ..., amn • Right-hand sides constants, b1, b2, ... , bm • Upper and lower bounds u1, u2, ... , unand l1, l2, ... , ln • The optimal solution that ILOG CPLEX computes and returns is: • Value of the variables x1, x2, ... , xn • Objective value

  8. Using Cplex • ILOG CPLEX comes in three forms: • The ILOG CPLEX Interactive Optimizer • can read a problem interactively or from files in certain standard formats, • solve the problem, and deliver the solution interactively or into text files. • ILOG Concert • a set of libraries to allow a programmer to embed ILOG CPLEX optimizers in C++, Java, or C#.NET applications. • The ILOG CPLEX Callable Library • 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.

  9. Example 3 • Let us consider the following LP problem • Maximize  x1 + 2x2 + 3x3 • subject to  • -x1 + x2 + x3 ≤ 20  • x1 - 3x2 + x3 ≤ 30   • with these bounds  • 0 ≤ x1 ≤ 40  • 0 ≤ x2 ≤ +   • 0 ≤ x3 ≤ +   • Let us consider the following LP problem • Maximize  x1 + 2x2 + 3x3 • subject to  • -x1 + x2 + x3 ≤ 20  • x1 - 3x2 + x3 ≤ 30   • with these bounds  • 0 ≤ x1 ≤ 40  • 0 ≤ x2 ≤ +   • 0 ≤ x3 ≤ +  

  10. Before Running CPLEX • Login to cplex.cs.uwindsor.ca • Make sure you add the following lines to the bottom of .profile file in your home directory if [ -d /opt/ibm/ILOG/CPLEX_Studio124/cplex/bin/x86-64_sles10_4.1 ]; then PATH=${PATH}:/opt/ibm/ILOG/CPLEX_Studio124/cplex/bin/x86-64_sles10_4.1 fi • May need to set the ‘view hidden files’ option, if you are using SSH

  11. Starting ILOG CPLEX Interactive Optimizer • Steps • Set up your path(s) and log in to cplex.cs.uwindsor.ca server • Open a shell • At the command prompt, type and enter cplex • And you are there • yourname@cplex:~$ cplex • CPLEX>

  12. ILOG CPLEX Interactive Optimizer • > cplex • CPLEX> enter Enter name for problem: myProblem Enter new problem ['end' on a separate line terminates]: maximize x1 + 2x2 + 3 x3 subject to -x1 + x2 + x3 <= 20 x1 - 3x2 + x3 <=30 bounds 0 <= x1 <= 40 0 <= x2 0 <= x3 end Example 3 • Let us consider the following LP problem • Maximize  x1 + 2x2 + 3x3 • subject to  • -x1 + x2 + x3 ≤ 20  • x1 - 3x2 + x3 ≤ 30   • with these bounds  • 0 ≤ x1 ≤ 40  • 0 ≤ x2 ≤ +   • 0 ≤ x3 ≤ +  

  13. Interactive Optimizer • CPLEX> • CPLEX> opt Tried aggregator 1 time. No LP presolve or aggregator reductions. Presolve time = 0.00 sec. Iteration log . . . Iteration: 1 Dual infeasibility = 0.000000 Iteration: 2 Dual objective = 202.500000 Dual simplex - Optimal: Objective = 2.0250000000e+02 Solution time = 0.00 sec. Iterations = 2 (1) • CPLEX> dis sol var - Variable Name Solution Value x1 40.000000 x2 17.500000 x3 42.500000 • CPLEX> quit • grid-2:~> • Reporting the solution: • the objective function value • the problem solution time in seconds • the total iteration count • the Phase I iteration count (in parentheses) • Interrupting the Optimization Process • control –c

  14. Some ILOG CPLEX Commands • Cplex: start the ILOG CPLEX Interactive Optimizer • Enter: enter a new problem • Read: read problem or basis information from a file • Optimize: solve the problem • Display: display problem, solution, or parameter settings • Solution • Variable • - (for all nonzero variables) • Ex. CPLEX> display solution variables -

  15. Interactive – Reading lp file • Let us consider the following LP problem • Maximize  x1 + 2x2 + 3x3 • subject to  • -x1 + x2 + x3 ≤ 20  • x1 - 3x2 + x3 ≤ 30   • with these bounds  • 0 ≤ x1 ≤ 40  • 0 ≤ x2 ≤ +   • 0 ≤ x3 ≤ +   • CPLEX> read Name of file to read: 567ex3.lp Problem 'myProblem.lp' read. Read time = 0.01 sec. • CPLEX> opt Tried aggregator 1 time. No LP presolve or aggregator reductions. Presolve time = 0.00 sec. Iteration log . . . Iteration: 1 Dual infeasibility = 0.000000 Iteration: 2 Dual objective = 202.500000 Dual simplex - Optimal: Objective = 2.0250000000e+02 Solution time = 0.00 sec. Iterations = 2 (1) • CPLEX> dis sol var - Variable Name Solution Value x1 40.000000 x2 17.500000 x3 42.500000 • CPLEX> quit Text file content maximize obj: x1 + 2x2 + 3x3 subject to c1: -x1 + x2 + x3 <= 20 c2: x1 - 3 x2 + x3 <=30 Bounds 0 <= x1 <= 40 0 <= x2 0 <= x3 End

  16. Some additional Commands • Help: provide information on CPLEX commands • Set: set parameters • Write: write problem or solution information to a file • Add: add constraints to problem • Change: change the problem • Mipopt: solve a mixed integer program • Type either the full command name, or any shortened version that uniquely identifies that name. • ILOG CPLEX does not distinguish between upper- and lower-case letters.

More Related