You are on page 1of 6

EXPERIMENT -2

AIM:-STUDY OF LINEAR PROGRAMING PROBLEM USING LINDO SOFTWARE

PROCEDURE

LINDO: Linear, Quadratic, and Integer Programming Software


LINDO 5.3 (Linear, Interactive, Discrete Optimizer) is an interactive linear, quadratic, and integer programming system useful to a wide range of users. LINDO can be used

to solve interactive linear, quadratic, general integer and zero-one integer programming programs up to 500 rows and 1,000 columns to perform sensitivity analysis and parametric programming.

This document provides specific information on how to run LINDO on the central UNIX systems Strauss and Mahler. It also contains an example of an interactive session. The LINDO User's Manual contains complete descriptions of all LINDO commands and many examples. The User Services Reference Library (in the RDMS Lab, 002C Smith Hall) has a noncirculating copy of the LINDO User's Manual.

How to Run LINDO


To start an interactive session, type
lindo

When the program is ready for you to type a LINDO command, it displays its prompt character ":". Commands may be typed in upper or lower case. The only exception is when you type a file name since UNIX filenames are case-sensitive. To obtain interactive help, type
help

To terminate LINDO, type

quit

LINDO displays all of its output without stopping. If you want LINDO to pause after every 24 lines of output, type
page 24

Accessing UNIX Disk Files


Many LINDO commands, such as take, save, retr, dvrt, and rvrt, read from or write information to UNIX disk files. The general form of these commands is
LINDO-command-name filename

When you omit the filename, LINDO prompts you with the message
FILE NAME=

The filename you type must match the name of the file exactly. Case is important, therefore you may not refer to a file named transport.model as TRANSPORT.MODEL. The filename cannot use name-expansion such as ~smith/LPmodels/prob1, since "~smith" will be rejected. However, if user "smith" were in his home directory, he could refer to that file as LPmodels/prob1.

Typical commands: take xmplfile reads a file named "xmplfile" in the current directory which contains LINDO commands or a model formulation. The "take" command is typically used to input files created by an editor like vi or pico. Long lines in this file that must continue on subsequent lines can be broken at at any place and immediately continued on the next line. For example,
max 2a + 3.5b + 4.1c - 2.6d + 3.3e - 6.2f + 8.3g + 4.6h 7.7j + 5.6k st a+b+c+d+e+f+g+h+j+k<1 etc.

Lines in this file may not exceed 71 characters. save model2 saves the current model formulation in the UNIX file named model2 in the current directory. retr model2 retrieves the previously saved model stored in the UNIX file model2 in the current directory. dvrt output3 diverts LINDO's subsequent output from the terminal screen to the UNIX file named output3. This is useful for saving the results for later printing using the qpr command. For this example, you would later type the UNIX command
qpr -q smips output3

to print the output in Smith Hall. rvrt

("revert") causes the subsequent output to be directed to the screen again.

Sample Interactive Sessions


The following three examples illustrate how to

state and solve a linear programming problem, and save the formulation in a disk file; recover the formulation in a later session, modify the model, and find the optimal solution; and state and solve a zero-one integer programming problem.

LINDO's responses are displayed in upper-case text; the user commands and responses are in lower-case.

Example 1: Solve an LP problem.


% lindo LINDO 5.3 (June 1993) LINDO Systems, Chicago, IL University of Delaware Single Site License Licence LDW12 - 531000 : max 2x + 3y ?st ? 4x + 3y < 10 ? 3x + 5y < 12 ?end : go LP OPTIMUM FOUND AT STEP OBJECTIVE FUNCTION VALUE 1) VARIABLE X Y ROW 2) 3) 7.454545 VALUE 1.272727 1.636364 SLACK OR SURPLUS 0.000000 0.000000 2 REDUCED COST 0.000000 0.000000 DUAL PRICES 0.090909 0.545455

NO. ITERATIONS=

DO RANGE(SENSITIVITY) ANALYSIS? ?yes

RANGES IN WHICH THE BASIS IS UNCHANGED: VARIABLE X Y ROW 2 3 OBJ COEFFICIENT RANGES CURRENT ALLOWABLE ALLOWABLE COEF INCREASE DECREASE 2.000000 2.000000 0.200000 3.000000 0.333333 1.500000 CURRENT RHS 10.000000 12.000000 RIGHTHAND SIDE RANGES ALLOWABLE INCREASE 6.000000 4.666667 ALLOWABLE DECREASE 2.800000 4.500000

: save linearprob : quit

<--- Save the formulation in "linearprob"

Example 2: Retrieve the previous formulation, modify it, and resolve the problem.
% lindo LINDO 5.3 (June 1993) LINDO Systems, Chicago, IL University of Delaware Single Site License Licence LDW12 - 531000 : retr linearprob <-----Retrieve the earlier problem statement : look ROW: all <-----Look at the entire problem ("all" rows) MAX 2 X + 3 Y SUBJECT TO 2) 4 X + 3 Y <= 3) 3 X + 5 Y <= END : alter ROW: 2 VAR: rhs NEW COEFFICIENT: ?20 : alter ROW: 3 VAR: y NEW COEFFICIENT: ?10 : look all

10 12

<-----Modify the current formulation

<-----by changing the first constraint's RHS

<----and the second constraint's y-coeff.

MAX 2 X + 3 Y SUBJECT TO 2) 4 X + 3 Y <= 3) 3 X + 10 Y <= END : go LP OPTIMUM FOUND AT STEP

20 12

OBJECTIVE FUNCTION VALUE 1) VARIABLE X Y ROW 2) 3) 8.000000 VALUE 4.000000 0.000000 SLACK OR SURPLUS 4.000000 0.000000 1 REDUCED COST 0.000000 3.666667 DUAL PRICES 0.000000 0.666667

NO. ITERATIONS=

DO RANGE(SENSITIVITY) ANALYSIS? ?no : quit

Example 3: State and solve an integer programming problem where each of the three variables may only have the values 0 or 1.
% lindo LINDO 5.3 (June 1993) LINDO Systems, Chicago, IL University of Delaware Single Site License Licence LDW12 - 531000 : max 4x + 3y + 2z ?st ?2.5x + 3.1y < 5 ? .2x + .7y + .4z < 1 ?end : integer x <--- Define x, y, z to be 0/1 variables : integer y : integer z : go LP OPTIMUM FOUND AT STEP 3 OBJECTIVE VALUE = 7.71428585 FIX ALL VARS.( 1) WITH RC > 3.00000 NEW INTEGER SOLUTION OF 10 6.00000000 AT BRANCH 0 PIVOT

BOUND ON OPTIMUM: 6.000000 ENUMERATION COMPLETE. BRANCHES=

0 PIVOTS=

10

LAST INTEGER SOLUTION IS THE BEST FOUND RE-INSTALLING BEST SOLUTION... : solu <--- Inspect the final solution

OBJECTIVE FUNCTION VALUE 1) VARIABLE X Y Z ROW 2) 3) 6.000000 VALUE 1.000000 0.000000 1.000000 SLACK OR SURPLUS 2.500000 0.400000 REDUCED COST -4.000000 -3.000000 -2.000000 DUAL PRICES 0.000000 0.000000 1.000E 0

NO. ITERATIONS= 10 BRANCHES= 0 DETERM.= : quit %