A graphics based computer-aided learning package for integer programming: The branch and bound algorithm

A graphics based computer-aided learning package for integer programming: The branch and bound algorithm

Computers Educ. Vol. 23. No. 4. pp. 261-268. 1994 Copyright 0 1994 Ekvicr Sciena Led Pnntcd in Great Britain. AU rights merved Pergamoo 036&1315(94PO...

476KB Sizes 31 Downloads 131 Views

Computers Educ. Vol. 23. No. 4. pp. 261-268. 1994 Copyright 0 1994 Ekvicr Sciena Led Pnntcd in Great Britain. AU rights merved

Pergamoo 036&1315(94POO4&4

0360-1315/94 f7.ocl +o.w

A GRAPHICS BASED COMPUTER-AIDED LEARNING PACKAGE FOR INTEGER PROGRAMMING: THE BRANCH AND BOUND ALGORITHM K. V. RAMANI and T. P. RAMA

RAO

Indian Institute of Management. Ahmedabad 380015, India [fux: (79)-427896: Emuil: [email protected]] (Received

17 May

1994; accepted 30 Augurr 1994)

Abstract-In this paper, we discuss a graphics based computer-aided learning program INTEGER for understanding the Branch and Bound algorithm for solving integer programming problems. It presents the algorithm step by step, by developing the solution tree in an interactive mode. It relieves the user from the computational aspects and thereby provides a better insight into the solution methodology. Powerful screen management routines and appropriate data structures permit the users to scan any part of the solution tree at any stage of the analysis, and to view the linear programming formulation at any desired node of the solution tree. The interactive nature of INTEGER has made it more usable than other popular programs-it demonstrated a superiority over another program, LINDO. in enabling students to understand the methodology and made a great impact on classroom teaching for MBA and Executive Development Program participants in India and Singapore.

1.

INTRODUCTION

Integer programming (IP) problems arise very naturally in real life applications, some examples arc the Travclling Salesman Problem, Machine Scheduling Problem, Line Balancing Problem, and the Knapsack Problem. It is well known that solving IP problems arc harder than solving the corresponding linear programming (LP) problems mainly on account of the integer restrictions on the variables. One commonly used algorithm for solving moderate sized IP problems is the Branch and Bound algorithm.

2.

A typical

formulation

THE

BRANCH

of an IP problem

AND

BOUND

ALGORITHM

is:

n maximize

subject

c 1-I

C,X,.

to n

c

A,,,X,
i=1,2

,...,

n

(1)

X,>,O,j=l,2 ,...,n

(2)

1-l

j= I, 2, . . . , n.

X, integer,

(3)

Conceptually. the Branch and Bound algorithm employs an iterative search procedure to find the optimal integer solution. This search procedure is based on the fact that no integer solution can be better than the solution to its LP relaxation, i.e. without the integer restrictions on the variables. Below, we summarize this search procedure which involves generating a binary tree by branching, and bounding the solutions when they exhibit certain characteristics. S~cp I: First solve the IP problem as an LP relaxation. If the optimal solution for the LP satisfies the integer constraints, stop and save the solution. This is the optimal solution to the IP Problem. Else go to Step 2. 261

262

K. V. RAMANIANDII I? RAMA RAO

Srep 2: Select any variable X, (non integer) in the current LP solution and force this variable to become an integer by adding appropriate constraints. For example, if X,= B, (B, is a non-

integer value), then X, can be forced to become an integer by adding any one of the following two constraints to the current LP problem:

x,GfB,l X,z[B,J+ I where [B,] is the integer part of B,_ These two constraints give two options to branch off from the current LP problem to a new LP problem with an added constraint. Choose any one constraint, follow that branch and go to Step 3. This process is called brunching because it involves the selection of an LP problem for further consideration. Step 3: Solve the new LP. The following outcomes are possible. (i) Optimal LP solution is non-integer and is better than any LP solution obtained so far. If so, further branching from the current node is recommended and so go to Step 2. (ii) The LP is infeasible, OR the optima1 LP solution is non-integer but is worse than any IP solution obtained so far, OR the optimal LP solution satisfies the integer constraints. In all these cases, do not branch off from the current solution node. In other words, fathom the tree on this node and backtrack to the nearest node for further branching and go to Step 2. 3. THE COMPUTER

PACKAGE

Wc have dcsigncd and dcvclopcd a graphics-based computer-aided Icarning package INTEGER for dcmonstr~~ting the above starch procedure employed by the Branch and Bound algorithm. This package presents the algorithm step by step, by dcvcloping the solution tree in an interactive mode. The users can thus conccntratc more on the methodology and less on the computational aspects. Below WCdemonstrate the use of Branch and Bound algorithm to solve an IP problem using the animation. 3. I. ~e~~i~~?l.s~~~~i~~l l~~r~~l~g~~ u prepr#gr~~~l~~i~~ e.sumpIe First, the screen displays the following problem to be solved maximize 3X, f 3X, + 13X, subject to -3X1+6Xz+7X,,<8 6X,-3XZ+7XJ<8 OGX,<5 fori= I, 2, 3 where X,, XZand X, are integers. After the problem has been displayed, the package wiil take the user through the solution procedure in an interactive mode. The solution at the first node is the optimal solution to the LP Relaxation (Fig. 1). A pop-up window explains that the solution at node 1 is non-integer (X, and XZ are non-integers) and the user is prompted to select either X, or X2 to branch further. The selection is to be effected using the arrow keys. Assume the user chooses the branch corresponding to the constraint X262. maximize 3X, +3X2 -I-13X, subject to -3X,+6XL+7X,<8 6X,--3XZ+7X,<8 X2,< 2 O<,U,<5 forj= I, 2,3 where X,. X2 and X, are integers.

Computer-aided

RESULTS

Choore U\r Prect

AT KODE

a varlahle

UpArr

R DnArr



I

III BRANCH hey> In conltrm

Fig. I. Non integer solution to the LP relaxation

Fig. 2. Branching

263

learning package

problem.

o!T’from the LP solution

Again the pop-up window explains the solution to the user and prompts the user to continue (Fig. 2). Note that as the algorithm continues its systematic search, the solution tree grows bigger. Consequently, the hardware restrictions on the display monitor forces a scroll to a new screen (Fig. 3). To retain continuity, the new screen starts with the last node from where the tree has branched ofI’(Fig. 4). The process of branching continues until node 6 when an integer solution is obtained.

264

K. V. RAMANI AND T. I? RAMA Rao

.I Nonlnreger 7,

= 13.00

XI = 2.33 x2 = ?.OO x3 = O.llO

Fig. 3. Developing

the starch tree for integer solution.

6

7

Inl’ea\ihle

IntegerS1rl

z

=1?.00

XI

= 200

x? = 2.00 x3 = 0.00 FATHOMED

FATHOMED

Fig. 4. Bounding

the tree at an integer node.

Computer-aided

learning package

265

Fig. 5. End of the search proccdurc.

This node is then fathomed and the program backtracks to the most recently formed node which is node 7 in our cast. The algorithm then solves the associated LP problem at node 7. At node 7 the LP problem is found to bc infeasible, and so this node is also fathomed. Infcasibility at node 7 forces the programme to backtrack and the process continues. Finally, the algorithm backtracks to node 3 and the LP problem at node 3 is found to bc infeasible. This step also signals the end of the systematic evaluation procedure of the Branch and Bound algorithm. At this stage, the package highlights the two best optimum solutions, as displayed in Fig. 5. At any time, the user can ask for help by pressing the Fl key. The package would then display the modified LP problem at the current node, modified by the constraints added to the original LP Relaxation at node 1. For example, pressing the FI key at node 7 would display the following LP problem at node 7 (Fig. 6). On user’s request, the package also displays the solution tree (Fig. 7). 3.2. Drmonswution

rhrough II user i problem

The user is advised to have the problem written out neatly on a sheet of paper as this will facilitate correct and easy interaction with the program especially at the input stage. The first step is to define the problem parameters, i.e. whether the problem is a maximization or a minimization problem, the number of variables and the number of constraints in the problem. Then follow the instructions on the screen, as in the example, which guide the user to key in the objective function and the constraints correctly. The user has to enter all coefficients and other numbers explicitly. For example, a constraint entered as I .2X, +X1 < 2.3 is not acceptable. It should be entered as 1.2X, + lXz<2.3. Once the constraints have been input, the problem to be solved is displayed for the user to check, before proceeding with the solution. The Edit facility allows the user to make any changes at this stage. 4.

The CAL program INTEGER algorithm step by step. It develops

THE

DESIGN

FEATURES

has been designed to demonstrate the Branch and Bound the solution tree in an interactive mode based on inputs from

266

K. V. RAMANI AND T. l? Raw

RAO

The Problem Mar8mlrc U,hJKl

2 = 3 OOXI 1”

rhr

+ 3 00X2

io!lWlng

+ I3 00X?

~““\,rdl”tk:

Fig. 6. A help screen display.

I

TREE

AT A GLANCE

Fig. 7. Solution

tree a~ a glance.

the users, the inputs are mainly in the form of placing integer restrictions on a selected variable at each node of the solution tree. The package takes the users through the process of branching and bounding till the optimal solution is arrived at. Powerful screen management routines permit the users to scan any part of the solution tree at any stage of the analysis, especially when the solution tree grows too large to be accommodated on a single screen. The HELP facility enables the user to view the modified LP problem at any node of the solution tree, and display the complete solution tree at a glance upon termination of the algorithm. The package is designed using a stack data structure to support the solution methodology. INTEGER has been developed in Turbo Pascal using graphics procedures supported by Turbo

Computer-aided

learning

package

267

Tool Box. A few subroutines have been written in assembly language to enhance the speed of execution. The program can be run on IBM compatible PCs. It is highly modular in structure with independent procedures for different aspects of the programme. Global variables and local variables have been used to economise on memory requirements and provide a reasonable speed of execution. As a CAL program. it is designed to handle only moderately sized problems, where the solution tree does not have more than 20 nodes. This restriction is mainly due to the hardware limitations of the screen monitor for graphics display. 5. IMPACT

The first author of this paper first used the program for teaching MBA students at the Indian Institute of Management (1lM). Ahmedabad. India. The author was handling the course on Quantitative Methods. taught in two sections of 60 students each. For all statistical purposes, the two sections can be considered as independent samples. To test the effectiveness of the program, a simple statistical experiment was conducted on the two independent samples. The author introduced INTEGER in one section. section A. and used a standard popular program LINDO in scotion B. After the lecture, students from both the sections were given an identical set of questions to test their underst~inding of the Branch and Bound algorithm in solving IP problems. Forty-fvc students from section A demonstrated a fair degree of understanding the methodology, white only 32 students from section B exhibited the same level of understanding in answering the questions. The standard test of hypothesis for the dilfercncc between proportions was applied to the above data. using the test statistic

to test the hypothcscs

where /i, =0.750. I;2 =0.533, @=0.642, and n, =n2 =60. By rcfcrring to the arca under the standard normal curve, it can be seen that the null hypothesis is rcjcctcd at the 1% lcvcl of significance. In other words, the test results support the claim that the impact of INTEGER is high in presenting a good understanding of the Branch and Bound algorithm. This program is being cxtcnsivcly used by the authors as well as other instructors for teaching the MBA and the Exccutivc Development Programmc (EDP) participants at IIM Ahmedabad, India. The first author has also used it for teaching MBA and EDP participants at the National University of Singapore, where hc spent I year as a visiting faculty. The response from MBA and the EDP participants from both India and Singapore are very encouraging. MBA participants stern to appreciate this package more than the EDP participants in both the countries, as the MBA students feel the need to understand the algorithm in a fair amount of detail 6. CONCLUSION

Teaching the Branch and Bound algorithm for solving intcgcr programming problems has always been a challenging task for the instructors in Business Schools, as the solution procedure is highly computation bound. Availability of PC programs rclicvcd the users from long and tedious computations. But the packages do not address the solution methodology adcquatcly and so the solutions often emcrgc from “black boxes”. INTEGER has overcome this difficulty by developing the decision tree and demonstrating the algorithm step by step in an interactive mode. it encourages the users to experiment with different options to branch the tree as the solution develops and thus gain meaningful insights in learning and appreciating the Branch and Bound algorithm. Its intcractivc nature has made it more usable than other popular programs. It has made a great impact on classroom teaching for MBA and Executive Development Program participants in India and Singapore. r>t1, l-R

268

K. V. RAMASIA.VD T. P. RAMA RAO

A statistical comparison with another widely used program, students has demonstrated the former’s superiority in enabling odology at the 1% level of significance,

LINDO, with two groups of 60 students to understand the meth-