Download as pdf or txt
Download as pdf or txt
You are on page 1of 42

Problem 1:

An appliance company manufactures heaters and ACs. The production of one heater requires 2
hrs in the parts division and 1 hr in the assembly division of the company. The production of
one AC requires 1hr in the parts division and 2 hrs in the assembly division. The parts division
is operated for atmost 8 hrs a day and the assembly division for atmost 10 hrs a day. The profit
released upon sale is Rs. 3000 per heater and Rs. 5000 per AC. Formulate a LPP and find the
no. of heaters and ACs the company should manufacture per day in order to maximize the
profit?

Program:
#include <stdio.h>
#include <math.h>
#define CMAX 10
#define VMAX 10
int NC, NV, NOPTIMAL,P1,P2,XERR;
double TS[CMAX][VMAX];
void Data() {
double R1,R2;
char R;
int I,J;
printf("\n SIMPLEX METHOD\n\n");
printf(" MAXIMIZE (Y/N) ? "); scanf("%c", &R);
printf("\n NUMBER OF VARIABLES OF THE FUNCTION ? ");
scanf("%d", &NV);
printf("\n NUMBER OF CONSTRAINTS ? "); scanf("%d", &NC);
if (R == 'Y' || R=='y')
R1 = 1.0;
else
R1 = -1.0;
printf("\n INPUT COEFFICIENTS OF THE FUNCTION:\n");
for (J = 1; J<=NV; J++) {
printf(" #%d ? ", J); scanf("%lf", &R2);
TS[1][J+1] = R2 * R1;
}
printf(" Right hand side ? "); scanf("%lf", &R2);
TS[1][1] = R2 * R1;
for (I = 1; I<=NC; I++) {
printf("\n CONSTRAINT #%d:\n", I);
for (J = 1; J<=NV; J++) {
printf(" #%d ? ", J); scanf("%lf", &R2);
TS[I + 1][J + 1] = -R2;
}
printf(" Right hand side ? "); scanf("%lf", &TS[I+1][1]);
}
printf("\n\n RESULTS:\n\n");
for(J=1; J<=NV; J++) TS[0][J+1] = J;
for(I=NV+1; I<=NV+NC; I++) TS[I-NV+1][0] = I;
}
void Pivot();
1
void Formula();
void Optimize();
void Simplex() {
e10: Pivot();
Formula();
Optimize();
if (NOPTIMAL == 1) goto e10;
}
void Pivot() {
double RAP,V,XMAX;
int I,J;
XMAX = 0.0;
for(J=2; J<=NV+1; J++) {
if (TS[1][J] > 0.0 && TS[1][J] > XMAX) {
XMAX = TS[1][J];
P2 = J;
}
}
RAP = 999999.0;
for (I=2; I<=NC+1; I++) {
if (TS[I][P2] >= 0.0) goto e10;
V = fabs(TS[I][1] / TS[I][P2]);
if (V < RAP) {
RAP = V;
P1 = I;
}
e10:;}
V = TS[0][P2]; TS[0][P2] = TS[P1][0]; TS[P1][0] = V;
}
int I,J;
void Formula() {;
for (I=1; I<=NC+1; I++) {
if (I == P1) goto e70;
for (J=1; J<=NV+1; J++) {
if (J == P2) goto e60;
TS[I][J] -= TS[P1][J] * TS[I][P2] / TS[P1][P2];
e60:;}
e70:;}
TS[P1][P2] = 1.0 / TS[P1][P2];
for (J=1; J<=NV+1; J++) {
if (J == P2) goto e100;
TS[P1][J] *= fabs(TS[P1][P2]);
e100:;}
for (I=1; I<=NC+1; I++) {
if (I == P1) goto e110;
TS[I][P2] *= TS[P1][P2];
e110:;}
}
void Optimize() {
int I,J;
for (I=2; I<=NC+1; I++)
2
if (TS[I][1] < 0.0) XERR = 1;
NOPTIMAL = 0;
if (XERR == 1) return;
for (J=2; J<=NV+1; J++)
if (TS[1][J] > 0.0) NOPTIMAL = 1;
}
void Results() {
int I,J;
if (XERR == 0) goto e30;
printf(" NO SOLUTION.\n"); goto e100;
e30:for (I=1; I<=NV; I++)
for (J=2; J<=NC+1; J++) {
if (TS[J][0] != 1.0*I) goto e70;
printf(" VARIABLE #%d: %f\n", I, TS[J][1]);
e70: ;}
printf("\n ECONOMIC FUNCTION: %f\n", TS[1][1]);
e100:printf("\n");
}
void main() {
data();
simplex();
results();
getch();
}

3
Program output:

4
Problem 2:
A firm has 240, 370, and 180 kg of wood, plastic and steel respectively. The firm produces two
products A and B. Each unit of A requires 1,3 and 2 kg of wood, plastic and steel respectively.
The corresponding requirement for each unit of B is 3,4 and 1 kg respectively.. If A sells for
Rs.4 and B sells for Rs. 6 per unit, what product mix should the firm produce to have maximum
gross income? Formulate and solve.

Program:
#include <stdio.h>
#include <math.h>
#include <conio.h>
#define CMAX 10 //max. number of variables in economic function
#define VMAX 10 //max. number of constraints
int NC, NV, NOPTIMAL,P1,P2,XERR;
double TS[CMAX][VMAX];

void Data() {
double R1,R2;
char R;
int I,J;
printf("\n LINEAR PROGRAMMING\n\n");
printf(" MAXIMIZE (Y/N) ? "); scanf("%c", &R);
printf("\n NUMBER OF VARIABLES OF ECONOMIC FUNCTION ? "); scanf("%d", &NV);
printf("\n NUMBER OF CONSTRAINTS ? "); scanf("%d", &NC);
if (R == 'Y' || R=='y')
R1 = 1.0;
else
R1 = -1.0;
printf("\n INPUT COEFFICIENTS OF ECONOMIC FUNCTION:\n");
for (J = 1; J<=NV; J++) {
printf(" #%d ? ", J); scanf("%lf", &R2);
TS[1][J+1] = R2 * R1;
}
printf(" Right hand side ? "); scanf("%lf", &R2);
TS[1][1] = R2 * R1;
for (I = 1; I<=NC; I++) {
printf("\n CONSTRAINT #%d:\n", I);
for (J = 1; J<=NV; J++) {
printf(" #%d ? ", J); scanf("%lf", &R2);
TS[I + 1][J + 1] = -R2;
}
printf(" Right hand side ? "); scanf("%lf", &TS[I+1][1]);
}
printf("\n\n RESULTS:\n\n");
for(J=1; J<=NV; J++) TS[0][J+1] = J;
for(I=NV+1; I<=NV+NC; I++) TS[I-NV+1][0] = I;
}
void Pivot();
void Formula();
5
void Optimize();
void Simplex() {
e10: Pivot();
Formula();
Optimize();
if (NOPTIMAL == 1) goto e10;
}

void Pivot() {
double RAP,V,XMAX;
int I,J;

XMAX = 0.0;
for(J=2; J<=NV+1; J++) {
if (TS[1][J] > 0.0 && TS[1][J] > XMAX) {
XMAX = TS[1][J];
P2 = J;
}
}
RAP = 999999.0;
for (I=2; I<=NC+1; I++) {
if (TS[I][P2] >= 0.0) goto e10;
V = fabs(TS[I][1] / TS[I][P2]);
if (V < RAP) {
RAP = V;
P1 = I;
}
e10:;}
V = TS[0][P2]; TS[0][P2] = TS[P1][0]; TS[P1][0] = V;
}
void Formula() {;
//Labels: e60,e70,e100,e110;
int I,J;

for (I=1; I<=NC+1; I++) {


if (I == P1) goto e70;
for (J=1; J<=NV+1; J++) {
if (J == P2) goto e60;
TS[I][J] -= TS[P1][J] * TS[I][P2] / TS[P1][P2];
e60:;}
e70:;}
TS[P1][P2] = 1.0 / TS[P1][P2];
for (J=1; J<=NV+1; J++) {
if (J == P2) goto e100;
TS[P1][J] *= fabs(TS[P1][P2]);
e100:;}
for (I=1; I<=NC+1; I++) {
if (I == P1) goto e110;
TS[I][P2] *= TS[P1][P2];
e110:;}
}
6
void Optimize() {
int I,J;
for (I=2; I<=NC+1; I++)
if (TS[I][1] < 0.0) XERR = 1;
NOPTIMAL = 0;
if (XERR == 1) return;
for (J=2; J<=NV+1; J++)
if (TS[1][J] > 0.0) NOPTIMAL = 1;
}
void Results() {
//Labels: e30,e70,e100;
int I,J;

if (XERR == 0) goto e30;


printf(" NO SOLUTION.\n"); goto e100;
e30:for (I=1; I<=NV; I++)
for (J=2; J<=NC+1; J++) {
if (TS[J][0] != 1.0*I) goto e70;
printf(" VARIABLE #%d: %f\n", I, TS[J][1]);
e70: ;}
printf("\n ECONOMIC FUNCTION: %f\n", TS[1][1]);
e100:printf("\n");
}
void main() {
data();
simplex();
results();
getch();
}

7
Program output:

8
Problem 3:
A timber company cuts raw timber – oak and pine logs into wooden boards. First the bark is
removed and then logs are cut into board pieces. How many feet of each of the logs should be
processed per week to maximize the profits if the profits per thousand feet of boards are
Rs.1800 and Rs.1200 for oak and pine respectively, while the processing time and capacity for
each process are given in the table?

Per 1000 ft Oak (hr) Pine (hr) Capacity per week


Debarking 2 3 60
Cutting 2.4 1.2 48
Profit per 1000 ft Rs. 1800 Rs. 1200 -

Program:
#include <stdio.h>
#include <math.h>
#define CMAX 10
#define VMAX 10
int NC, NV, NOPTIMAL,P1,P2,XERR;
double TS[CMAX][VMAX];
void Data() {
double R1,R2;
char R;
int I,J;
printf("\n SIMPLEX METHOD\n\n");
printf(" MAXIMIZE (Y/N) ? "); scanf("%c", &R);
printf("\n NUMBER OF VARIABLES OF THE FUNCTION ? ");
scanf("%d", &NV);
printf("\n NUMBER OF CONSTRAINTS ? "); scanf("%d", &NC);
if (R == 'Y' || R=='y')
R1 = 1.0;
else
R1 = -1.0;
printf("\n INPUT COEFFICIENTS OF THE FUNCTION:\n");
for (J = 1; J<=NV; J++) {
printf(" #%d ? ", J); scanf("%lf", &R2);
TS[1][J+1] = R2 * R1;
}
printf(" Right hand side ? "); scanf("%lf", &R2);
TS[1][1] = R2 * R1;
for (I = 1; I<=NC; I++) {
printf("\n CONSTRAINT #%d:\n", I);
for (J = 1; J<=NV; J++) {
printf(" #%d ? ", J); scanf("%lf", &R2);
TS[I + 1][J + 1] = -R2;
}
printf(" Right hand side ? "); scanf("%lf", &TS[I+1][1]);
}
printf("\n\n RESULTS:\n\n");
for(J=1; J<=NV; J++) TS[0][J+1] = J;
9
for(I=NV+1; I<=NV+NC; I++) TS[I-NV+1][0] = I;
}
void Pivot();
void Formula();
void Optimize();
void Simplex() {
e10: Pivot();
Formula();
Optimize();
if (NOPTIMAL == 1) goto e10;
}
void Pivot() {
double RAP,V,XMAX;
int I,J;
XMAX = 0.0;
for(J=2; J<=NV+1; J++) {
if (TS[1][J] > 0.0 && TS[1][J] > XMAX) {
XMAX = TS[1][J];
P2 = J;
}
}
RAP = 999999.0;
for (I=2; I<=NC+1; I++) {
if (TS[I][P2] >= 0.0) goto e10;
V = fabs(TS[I][1] / TS[I][P2]);
if (V < RAP) {
RAP = V;
P1 = I;
}
e10:;}
V = TS[0][P2]; TS[0][P2] = TS[P1][0]; TS[P1][0] = V;
}
int I,J;
void Formula() {;
for (I=1; I<=NC+1; I++) {
if (I == P1) goto e70;
for (J=1; J<=NV+1; J++) {
if (J == P2) goto e60;
TS[I][J] -= TS[P1][J] * TS[I][P2] / TS[P1][P2];
e60:;}
e70:;}
TS[P1][P2] = 1.0 / TS[P1][P2];
for (J=1; J<=NV+1; J++) {
if (J == P2) goto e100;
TS[P1][J] *= fabs(TS[P1][P2]);
e100:;}
for (I=1; I<=NC+1; I++) {
if (I == P1) goto e110;
TS[I][P2] *= TS[P1][P2];
e110:;}
}
10
void Optimize() {
int I,J;
for (I=2; I<=NC+1; I++)
if (TS[I][1] < 0.0) XERR = 1;
NOPTIMAL = 0;
if (XERR == 1) return;
for (J=2; J<=NV+1; J++)
if (TS[1][J] > 0.0) NOPTIMAL = 1;
}
void Results() {
int I,J;
if (XERR == 0) goto e30;
printf(" NO SOLUTION.\n"); goto e100;
e30:for (I=1; I<=NV; I++)
for (J=2; J<=NC+1; J++) {
if (TS[J][0] != 1.0*I) goto e70;
printf(" VARIABLE #%d: %f\n", I, TS[J][1]);
e70: ;}
printf("\n ECONOMIC FUNCTION: %f\n", TS[1][1]);
e100:printf("\n");
}
void main() {
data();
simplex();
results();
getch();
}

11
Program output:

12
Problem 4:
Find the initial basic feasible solution by using Least Cost Method.
Distribution Centers (Destinations)
1 2 3 4 Supply
1 2 3 11 7 6
Plant 2 1 0 6 1 1
(Origins) 3 5 8 15 9 10
Requirement 7 5 3 2

Program:
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>
#define MAX 50
enum boolean{FALSE,TRUE};
class lcmethod{
int data[MAX][MAX];
int requered[MAX];
int capacity[MAX];
int allocation[MAX][MAX];
int no_of_rows,no_of_columns,no_of_allocation;
public:
lcmethod(){
for(int i=0;i<MAX;i++){
capacity[i]=0;
requered[i]=0;
for(int j=0;j<MAX;j++){
data[i][j]=0;
allocation[i][j]=0;
}
}
no_of_rows=no_of_columns=no_of_allocation=0;
}
void setColumn(int no){no_of_columns=no;};
void setRow(int no){no_of_rows=no;}
void getData();
void getCapacity();
void getRequiredValue();
void makeAllocation();
boolean checkValue(int [],int);
int getMinVal(int [][MAX]);
int getTotalMinVal(int [][MAX],int);
void getMinValsPos(int,int [][MAX],int[][2],int [][2]);
void display();
};
void lcmethod::getMinValsPos(int value,int temp_data[][MAX],int ans[][2],int pos[][2]){

13
int k=0;
for(int i=0;i<no_of_rows;i++)
for(int j=0;j<no_of_columns;j++)
if(temp_data[i][j]==value){
ans[k][0]=i;
ans[k][1]=j;
pos[k][0]=requered[j];
pos[k++][1]=capacity[i];
}
}
int lcmethod::getTotalMinVal(int temp_data[][MAX],int value){
int no=0;
for(int i=0;i<no_of_rows;i++)
for(int j=0;j<no_of_columns;j++)
if(temp_data[i][j]==value)
no++;
return no;
}
int lcmethod::getMinVal(int temp_data[][MAX]){
int min=temp_data[0][0];

for(int i=0;i<no_of_rows;i++)
for(int j=0;j<no_of_columns;j++)
if(temp_data[i][j]<min)
min=temp_data[i][j];

return min;
}
boolean lcmethod::checkValue(int arr[],int no){
for(int i=0;i<no;i++)
if(arr[i]!=0)
return FALSE;
return TRUE;
}
void arrayCopy(int start,int end,int array1[],int start1,int array2[]){
for(int i=start,j=start1;i<end;i++,j++)
array2[j]=array1[i];
}
int getTotal(int array[],int no){
int sum=0;
for(int i=0;i<no;i++)
sum+=array[i];
return sum;
}
void copy2DArray(int startRow,int startCol,int endRow,int endCol,int array[][MAX],int
start1Row,int start1Col,int ans[][MAX]){
for(int i=startRow,k=start1Row;i<endRow;i++,k++)
for(int j=startCol,l=start1Col;j<endCol;j++,l++)
ans[k][l]=array[i][j];
}
int getMaxVal(int array[MAX],int no){
14
int max=0;
for(int i=0;i<no;i++)
if(array[i]>max)
max=array[i];
return max;
}
int getMaxValPos(int array[MAX],int no,int value){
for(int i=0;i<no;i++)
if(value==array[i])
return i;
return -1;
}
void lcmethod::makeAllocation(){
int i=0,j=0,min,total_min;
int temp_requered[MAX]={0};
int temp_capacity[MAX]={0};
int temp_data[MAX][MAX]={0};
int position[MAX][2]={0};
int dataPos[MAX][2]={0};
int sum_of_cap,sum_of_req;
sum_of_cap=getTotal(capacity,no_of_rows);
sum_of_req=getTotal(requered,no_of_columns);
if(sum_of_cap!=sum_of_req){
if(sum_of_cap>sum_of_req){
for(j=0;j<no_of_rows;j++)
data[j][no_of_columns]=0;
requered[no_of_columns]=sum_of_cap-sum_of_req;
no_of_columns++;
}
else{
for(j=0;j<no_of_columns;j++)
data[no_of_rows][j]=0;
capacity[no_of_rows]=sum_of_req-sum_of_cap;
no_of_rows++;
}
}
i=j=0;
arrayCopy(0,no_of_rows,capacity,0,temp_capacity);
arrayCopy(0,no_of_columns,requered,0,temp_requered);
copy2DArray(0,0,no_of_rows,no_of_columns,data,0,0,temp_data);
while(!checkValue(temp_capacity,no_of_rows) ||
!checkValue(temp_requered,no_of_columns)){
min=getMinVal(temp_data);
total_min=getTotalMinVal(temp_data,min);
getMinValsPos(min,temp_data,position,dataPos);
int minPosValue[MAX]={0};
for(i=0;i<no_of_rows;i++){
if(dataPos[i][0]<dataPos[i][1])
minPosValue[i]=dataPos[i][0];
else
minPosValue[i]=dataPos[i][1];
15
}
int max=getMaxVal(minPosValue,total_min);
int maxvalPos=getMaxValPos(minPosValue,total_min,max);
i=position[maxvalPos][0];
j=position[maxvalPos][1];
if(temp_capacity[i]>temp_requered[j]){
allocation[i][j]=temp_requered[j];
for(int k=0;k<no_of_rows;k++)
temp_data[k][j]=9999;
temp_capacity[i]-=temp_requered[j];
temp_requered[j]=0;
}
else if(temp_capacity[i]<temp_requered[j]){
allocation[i][j]=temp_capacity[i];
for(int k=0;k<no_of_columns;k++)
temp_data[i][k]=9999;
temp_requered[j]-=temp_capacity[i];
temp_capacity[i]=0;
}
else{
int k;
allocation[i][j]=temp_capacity[i];
for(k=0;k<no_of_rows;k++)
temp_data[k][j]=9999;
for(k=0;k<no_of_columns;k++)
temp_data[i][k]=9999;
temp_requered[j]=temp_capacity[i]=0;
}
no_of_allocation++;
}
}
void lcmethod::getCapacity(){
cout<<"Enter capacity for each source : \n";
for(int i=0;i<no_of_rows;i++){
cout<<"s"<<i+1<<" : ";
cin>>capacity[i];
}
}
void lcmethod::getRequiredValue(){
cout<<"Enter required unit value for each destination : \n";
for(int i=0;i<no_of_columns;i++){
cout<<"d"<<i+1<<" : ";
cin>>requered[i];

}
}
void lcmethod::display(){
int i;
cout<<"\nGiven data :\n";
cout<<setw(9);
for(i=0;i<no_of_columns;i++)
16
cout<<"D"<<i+1<<setw(4);
cout<<setw(5)<<"cap"<<endl<<setw(0);
for(i=0;i<no_of_rows;i++){
cout<<setw(3)<<"S"<<i+1;
for(int j=0;j<no_of_columns;j++)
cout<<setw(5)<<data[i][j];
cout<<setw(5)<<capacity[i]<<endl;
}
cout<<setw(4)<<"req";
for(i=0;i<no_of_columns;i++)
cout<<setw(5)<<requered[i];

cout<<"\n\n After allocation :\n";


for(i=0;i<no_of_rows;i++){
for(int j=0;j<no_of_columns;j++){
if(allocation[i][j]!=0)
cout<<setw(5)<<data[i][j]<<"*"<<setw(2)<<allocation[i][j];
else
cout<<setw(8)<<data[i][j];
}
cout<<endl;
}
int k=0,sum=0;
for(i=0;i<no_of_rows;i++){
for(int j=0;j<no_of_columns;j++){
if(allocation[i][j]!=0){
cout<<"("<<data[i][j]<<" * "<<allocation[i][j]<<")";
if(k<no_of_allocation-1){
cout<<"+";
k++;
}
sum+=data[i][j]*allocation[i][j];
}
}
}
cout<<"\nAnswer : "<<sum;
if((no_of_rows+no_of_columns-1)==no_of_allocation){
cout<<"\nhere "<<no_of_rows<<"+"<<no_of_columns<<"-1 ="<<no_of_allocation<<" no. of
allocations";
cout<<"\n So this problem is non-degenarated solution";
}
else{
cout<<"\nhere "<<no_of_rows<<"+"<<no_of_columns<<"-1 !="<<no_of_allocation<<"no of
allocations";
cout<<"\n So this problem is degenarated solution";
}
}
void lcmethod::getData(){
cout<<"Enter source to destination data:"<<endl;
for(int i=0;i<no_of_rows;i++){
cout<<"Enter "<<i<<"th row : ";
17
for(int j=0;j<no_of_columns;j++){
cin>>data[i][j];
}
}
}
void main(){
clrscr();
lcmethod lcm;
int r,c;
cout<<"Enter the no. of Rows : ";
cin>>r;
cout<<"Enter the no. of Columns : ";
cin>>c;

lcm.setColumn(c);
lcm.setRow(r);

lcm.getData();
lcm.getCapacity();
lcm.getRequiredValue();
lcm.makeAllocation();
clrscr();
lcm.display();
getch();
}

18
Program output:

19
Problem 5:
Find the basic feasible solution of the following transportation problem by using North West
Corner Rule.
Distribution Centers (Destinations)
1 2 3 4 5 Supply
A 4 3 1 2 6 80
Plant B 5 2 3 4 5 60
(Origins) C 3 5 6 3 2 40
D 2 4 4 5 3 20
Requirement 60 60 30 40 10

Program:
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>
#define MAX 50
enum boolean{FALSE,TRUE};
class nwcmethod{
int data[MAX][MAX];
int requered[MAX];
int capacity[MAX];
int allocation[MAX][MAX];
int no_of_rows,no_of_columns,no_of_allocation;
public:
nwcmethod(){
for(int i=0;i<MAX;i++){
capacity[i]=0;
requered[i]=0;
for(int j=0;j<MAX;j++){
data[i][j]=0;
allocation[i][j]=0;
}}
no_of_rows=no_of_columns=no_of_allocation=0;
}
void setColumn(int no){no_of_columns=no;};
void setRow(int no){no_of_rows=no;}
void getData();
void getCapacity();
void getRequiredValue();
void makeAllocation();
boolean checkValue(int [],int);
void display();
};
boolean nwcmethod::checkValue(int arr[],int no){
for(int i=0;i<no;i++)
if(arr[i]!=0)
20
return FALSE;
return TRUE;
}
void arrayCopy(int start,int end,int array1[],int start1,int array2[]){
for(int i=start,j=start1;i<end;i++,j++){
array2[j]=array1[i];
}
}
int getTotal(int array[],int no){
int sum=0;
for(int i=0;i<no;i++)
sum+=array[i];
return sum;
}
void nwcmethod::makeAllocation(){
int i=0,j=0;
int temp_requered[MAX]={0};
int temp_capacity[MAX]={0};
int sum_of_cap,sum_of_req;
sum_of_cap=getTotal(capacity,no_of_rows);
sum_of_req=getTotal(requered,no_of_columns);
if(sum_of_cap!=sum_of_req){
if(sum_of_cap>sum_of_req){
for(j=0;j<no_of_rows;j++)
data[j][no_of_columns]=0;
requered[no_of_columns]=sum_of_cap-sum_of_req;
no_of_columns++;
}
else{
for(j=0;j<no_of_columns;j++)
data[no_of_rows][j]=0;
capacity[no_of_rows]=sum_of_req-sum_of_cap;
no_of_rows++;
}}
i=j=0;
arrayCopy(0,no_of_rows,capacity,0,temp_capacity);
arrayCopy(0,no_of_columns,requered,0,temp_requered);
while(!checkValue(temp_capacity,no_of_rows) ||
!checkValue(temp_requered,no_of_columns)){
if(temp_capacity[i]>temp_requered[j]){
allocation[i][j]=temp_requered[j];
temp_capacity[i]-=temp_requered[j];
temp_requered[j]=0;
j++;
}
else if(temp_capacity[i]<temp_requered[j]){
allocation[i][j]=temp_capacity[i];
temp_requered[j]-=temp_capacity[i];
temp_capacity[i]=0;
i++;
}
21
else{
allocation[i][j]=temp_capacity[i];
temp_capacity[i]=temp_requered[j]=0;
i++;
j++;
}
no_of_allocation++;
}}
void nwcmethod::getCapacity(){
cout<<"enter capacity for each source : \n";
for(int i=0;i<no_of_rows;i++){
cout<<"s"<<i+1<<" : ";
cin>>capacity[i];
}
}
void nwcmethod::getRequiredValue(){
cout<<"enter required unit value for each destination : \n";
for(int i=0;i<no_of_columns;i++){
cout<<"d"<<i+1<<" : ";
cin>>requered[i];
}}
void nwcmethod::display(){
int i;
cout<<"\ngiven data :\n";
cout<<setw(9);
for(i=0;i<no_of_columns;i++)
cout<<"D"<<i+1<<setw(4);
cout<<setw(5)<<"cap"<<endl<<setw(0);
for(i=0;i<no_of_rows;i++){
cout<<setw(3)<<"S"<<i+1;
for(int j=0;j<no_of_columns;j++)
cout<<setw(5)<<data[i][j];
cout<<setw(5)<<capacity[i]<<endl;
}
cout<<setw(4)<<"req";
for(i=0;i<no_of_columns;i++)
cout<<setw(5)<<requered[i];

cout<<"\n\n after allocation :\n";


for(i=0;i<no_of_rows;i++){
for(int j=0;j<no_of_columns;j++){
if(allocation[i][j]!=0)
cout<<"\t"<<data[i][j]<<"*"<<allocation[i][j];
else
cout<<"\t"<<data[i][j];
}
cout<<endl;
}
int k=0,sum=0;
for(i=0;i<no_of_rows;i++){
for(int j=0;j<no_of_columns;j++){
22
if(allocation[i][j]!=0){
cout<<"("<<data[i][j]<<"*"<<allocation[i][j]<<")";
if(k<no_of_allocation-1){
cout<<"+";
k++;
}
sum+=data[i][j]*allocation[i][j];
}
}
}
cout<<"\nanswer : "<<sum;
if((no_of_rows+no_of_columns-1)==no_of_allocation){
cout<<"\nhere "<<no_of_rows<<"+"<<no_of_columns<<"-1 ="<<no_of_allocation<<" no. of
allocations";
cout<<"\n so this problem is non-degenarated solution";
}
else{
cout<<"\nhere "<<no_of_rows<<"+"<<no_of_columns<<"-1 !="<<no_of_allocation<<"no of
allocations";
cout<<"\n so this problem is degenarated solution";
}
}
void nwcmethod::getData(){
cout<<"enter source to destination data:"<<endl;
for(int i=0;i<no_of_rows;i++){
cout<<"enter "<<i<<"th row : ";
for(int j=0;j<no_of_columns;j++){
cin>>data[i][j];
}
}
}
void main(){
clrscr();
nwcmethod m1;
int r,c;
cout<<"enter no of Rows : ";
cin>>r;
cout<<"enter no of columns : ";
cin>>c;

m1.setColumn(c);
m1.setRow(r);

m1.getData();
m1.getCapacity();
m1.getRequiredValue();
m1.makeAllocation();
clrscr();
m1.display();
getch();
}
23
Program output:

24
Problem 6:
Find the initial basic feasible solution by using Vogel’s Approximation Method.
Distributions Centers
D1 D2 D3 D4 Supply
Plants S1 3 1 7 4 250
(Origins) S2 2 6 5 9 350
S3 8 3 3 2 400
Requirements 200 300 350 150

Program:
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>
#define MAX 50
enum boolean{FALSE,TRUE};
class voggelsmethod{
int data[MAX][MAX];
int requered[MAX];
int capacity[MAX];
int allocation[MAX][MAX];
int no_of_rows,no_of_columns,no_of_allocation;
public:
lcmethod(){
for(int i=0;i<MAX;i++){
capacity[i]=0;
requered[i]=0;
for(int j=0;j<MAX;j++){
data[i][j]=0;
allocation[i][j]=0;
}
}
no_of_rows=no_of_columns=no_of_allocation=0;
}
void setColumn(int no){no_of_columns=no;};
void setRow(int no){no_of_rows=no;}
void getData();
void getCapacity();
void getRequiredValue();
void makeAllocation();
boolean checkValue(int [],int);
int getMinVal(int [],int);
int getTotalMinVal(int [],int,int);
int getMinValsPos(int,int [],int);
void display();
int getPanalty(int [],int);
};

25
int voggelsmethod::getPanalty(int array[],int no){
int i,j,temp;
for(i=0;i<no;i++)
for(j=i+1;j<no;j++)
if(array[i]>array[j]){
temp=array[i];
array[i]=array[j];
array[j]=temp;
}
return array[1]-array[0];
}
int voggelsmethod::getMinVal(int array[],int no){
int min=array[0];
for(int i=0;i<no;i++)
if(array[i]<min)
min=array[i];
return min;
}
int voggelsmethod::getMinValsPos(int value,int temp_data[],int no){
int k=0;
for(int i=0;i<no;i++)
if(temp_data[i]==value)
return i;
return -1;
}
int voggelsmethod::getTotalMinVal(int array[],int n,int value){
int no=0;
for(int i=0;i<n;i++)
if(array[i]==value)
no++;
return no;
}
boolean voggelsmethod::checkValue(int arr[],int no){
for(int i=0;i<no;i++)
if(arr[i]!=0)
return FALSE;
return TRUE;
}
void arrayCopy(int start,int end,int array1[],int start1,int array2[]){
for(int i=start,j=start1;i<end;i++,j++)
array2[j]=array1[i];
}
int getTotal(int array[],int no){
int sum=0;
for(int i=0;i<no;i++)
sum+=array[i];
return sum;
}
void copy2DArray(int startRow,int startCol,int endRow,int endCol,int array[][MAX],int
start1Row,int start1Col,int ans[][MAX]){
for(int i=startRow,k=start1Row;i<endRow;i++,k++)
26
for(int j=startCol,l=start1Col;j<endCol;j++,l++)
ans[k][l]=array[i][j];
}
int getMaxVal(int array[MAX],int no){
int max=0;
for(int i=0;i<no;i++)
if(array[i]>max)
max=array[i];
return max;
}
int getMaxValPos(int array[MAX],int no,int value){
for(int i=0;i<no;i++)
if(value==array[i])
return i;
return -1;
}
void voggelsmethod::makeAllocation(){
int i=0,j=0,min,total_min;
int temp_requered[MAX]={0};
int temp_capacity[MAX]={0};
int temp_data[MAX][MAX]={0};
int position[MAX]={0};
int dataPos[MAX]={0};
int sum_of_cap,sum_of_req;
sum_of_cap=getTotal(capacity,no_of_rows);
sum_of_req=getTotal(requered,no_of_columns);
if(sum_of_cap!=sum_of_req){
if(sum_of_cap>sum_of_req){
for(j=0;j<no_of_rows;j++)
data[j][no_of_columns]=0;
requered[no_of_columns]=sum_of_cap-sum_of_req;
no_of_columns++;
}
else{
for(j=0;j<no_of_columns;j++)
data[no_of_rows][j]=0;
capacity[no_of_rows]=sum_of_req-sum_of_cap;
no_of_rows++;
}
}
i=j=0;
arrayCopy(0,no_of_rows,capacity,0,temp_capacity);
arrayCopy(0,no_of_columns,requered,0,temp_requered);
copy2DArray(0,0,no_of_rows,no_of_columns,data,0,0,temp_data);
int rowPanalty[MAX]={0};
int colPanalty[MAX]={0};
int panaltyData[MAX]={0},n=0;
while(!checkValue(temp_capacity,no_of_rows) ||
!checkValue(temp_requered,no_of_columns)){

for(i=0;i<no_of_rows;i++){
27
arrayCopy(0,no_of_columns,temp_data[i],0,panaltyData);
if(temp_capacity[i]!=0)
rowPanalty[i]=getPanalty(panaltyData,no_of_columns);
else
rowPanalty[i]=0;
}
for(i=0;i<no_of_columns;i++){
for(j=0;j<no_of_rows;j++)
panaltyData[j]=temp_data[j][i];
if(requered[i]!=0)
colPanalty[i]=getPanalty(panaltyData,no_of_rows);
else
colPanalty[i]=0;
}
int maxRowPanalty=getMaxVal(rowPanalty,no_of_rows);
int maxColPanalty=getMaxVal(colPanalty,no_of_columns);
int maxPanRow[MAX]={0};
int maxPanCol[MAX]={0};
if(maxRowPanalty>maxColPanalty){
i=getMaxValPos(rowPanalty,no_of_rows,maxRowPanalty);
for(j=0;j<no_of_columns;j++)
maxPanRow[j]=temp_data[i][j];
min=getMinVal(maxPanRow,no_of_columns);
j=getMinValsPos(min,maxPanRow,no_of_columns);
}
else{
j=getMaxValPos(colPanalty,no_of_columns,maxColPanalty);
for(i=0;i<no_of_rows;i++)
maxPanCol[i]=temp_data[i][j];
min=getMinVal(maxPanCol,no_of_rows);
i=getMinValsPos(min,maxPanCol,no_of_rows);
}

if(temp_capacity[i]>temp_requered[j]){
allocation[i][j]=temp_requered[j];
for(int k=0;k<no_of_rows;k++)
temp_data[k][j]=9999;
temp_capacity[i]-=temp_requered[j];
temp_requered[j]=0;
}
else if(temp_capacity[i]<temp_requered[j]){
allocation[i][j]=temp_capacity[i];
for(int k=0;k<no_of_columns;k++)
temp_data[i][k]=9999;
temp_requered[j]-=temp_capacity[i];
temp_capacity[i]=0;
}
else{
int k;
allocation[i][j]=temp_capacity[i];
for(k=0;k<no_of_rows;k++)
28
temp_data[k][j]=9999;
for(k=0;k<no_of_columns;k++)
temp_data[i][k]=9999;
temp_requered[j]=temp_capacity[i]=0;
}
n++;
}
no_of_allocation=n;
}
void voggelsmethod::getCapacity(){
cout<<"enter capacity for each source : \n";
for(int i=0;i<no_of_rows;i++){
cout<<"s"<<i+1<<" : ";
cin>>capacity[i];
}
}
void voggelsmethod::getRequiredValue(){
cout<<"enter required unit value for each destination : \n";
for(int i=0;i<no_of_columns;i++){
cout<<"d"<<i+1<<" : ";
cin>>requered[i];

}
}
void voggelsmethod::display(){
int i;
cout<<"\ngiven data :\n";
cout<<setw(9);
for(i=0;i<no_of_columns;i++)
cout<<"D"<<i+1<<setw(4);
cout<<setw(5)<<"cap"<<endl<<setw(0);
for(i=0;i<no_of_rows;i++){
cout<<setw(3)<<"S"<<i+1;
for(int j=0;j<no_of_columns;j++)
cout<<setw(5)<<data[i][j];
cout<<setw(5)<<capacity[i]<<endl;
}
cout<<setw(4)<<"req";
for(i=0;i<no_of_columns;i++)
cout<<setw(5)<<requered[i];

cout<<"\n\n after allocation :\n";


for(i=0;i<no_of_rows;i++){
for(int j=0;j<no_of_columns;j++){
if(allocation[i][j]!=0)
cout<<setw(5)<<data[i][j]<<"*"<<setw(2)<<allocation[i][j];
else
cout<<setw(8)<<data[i][j];
}
cout<<endl;
}
29
int k=0,sum=0;
for(i=0;i<no_of_rows;i++){
for(int j=0;j<no_of_columns;j++){
if(allocation[i][j]!=0){
cout<<"("<<data[i][j]<<" * "<<allocation[i][j]<<")";
if(k<no_of_allocation-1){
cout<<"+";
k++;
}
sum+=data[i][j]*allocation[i][j];
}
}
}
cout<<"\nanswer : "<<sum;
if((no_of_rows+no_of_columns-1)==no_of_allocation){
cout<<"\nhere "<<no_of_rows<<"+"<<no_of_columns<<"-1 ="<<no_of_allocation<<" no. of
allocations";
cout<<"\n so this problem is non-degenarated solution";
}
else{
cout<<"\nhere "<<no_of_rows<<"+"<<no_of_columns<<"-1 !="<<no_of_allocation<<"no of
allocations";
cout<<"\n so this problem is degenarated solution";
}
}
void voggelsmethod::getData(){
cout<<"enter source to destination data:"<<endl;
for(int i=0;i<no_of_rows;i++){
cout<<"enter "<<i<<"th row : ";
for(int j=0;j<no_of_columns;j++){
cin>>data[i][j];
}
}}
void main(){
clrscr();
voggelsmethod v;
int r,c;
cout<<"enter no of Rows : ";
cin>>r;
cout<<"enter no of columns : ";
cin>>c;
v.setColumn(c);
v.setRow(r);
v.getData();
v.getCapacity();
v.getRequiredValue();
v.makeAllocation();
clrscr();
v.display();
getch();
}
30
Program output:

31
Problem 7:
A departmental head has 3 sub-ordinates and 3 tasks have to be performed. The sub-ordinates
differ in their intrinsic difficulty. His estimates of the time each man would take to perform
each task are given in the matrix. How should the tasks be allocated to the sub-ordinates so as
to minimize the total man-hours?
Workers I II II
Tasks
A 8 26 17
B 13 38 4
C 38 19 18

Program:
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<iomanip.h>
#define MAX 50
enum boolean{FALSE,TRUE};

class HungarianMethod{
int data[MAX][MAX];
int allocation[MAX][MAX];
int no_of_rows,no_of_columns;
int bal_stat;

public:
HungarianMethod(){
int i,j;
for(i=0;i<MAX;i++){
for(j=0;j<MAX;j++){
data[i][j]=0;
allocation[i][j]=0;
}
}
no_of_rows=no_of_columns=bal_stat=0;
}
void setRow(int no){no_of_rows=no;}
void setColumn(int no){no_of_columns=no;}
void getData();
void makeAllocation();
void display();
void rowMinima(int [][MAX],int,int);
void columnMinima(int [][MAX],int,int);
boolean checkValue(int,int,int [][MAX]);
};
void HungarianMethod::getData(){
int i,j;
cout<<"enter cost Metrix :\n";
for(i=0;i<no_of_rows;i++){
32
cout<<"enter "<<i+1<<" row :";
for(j=0;j<no_of_columns;j++)
cin>>data[i][j];
}}
void copyArray(int startRow,int startCol,int endRow,int endCol,int temp[][MAX],int
start1row,int start1col,int ans[][MAX]){
int i,j,k,l;
for(i=startRow,k=start1row;i<endRow;i++,k++)
for(j=startCol,l=start1col;j<endCol;j++,l++)
ans[k][l]=temp[i][j];
}
int getMinVal(int temp[],int no){
int min=temp[0];
for(int i=0;i<no;i++)
if(min>temp[i])
min=temp[i];
return min;
}
int getPosition(int temp[],int no,int value){
for(int i=0;i<no;i++)
if(temp[i]==value)
return i;
return -1;
}
int countVal(int temp[],int no,int value){
int i,sum=0;
for(i=0;i<no;i++)
if(temp[i]==value)
sum++;
return sum;
}
void HungarianMethod::rowMinima(int temp[][MAX],int row,int col){
int i,j,min;
for(i=0;i<row;i++){
min=9999;
for(j=0;j<col;j++)
if(min>temp[i][j])
min=temp[i][j];
for(j=0;j<col;j++)
temp[i][j]-=min;
}}
void HungarianMethod::columnMinima(int temp[][MAX],int row,int col){
int i,j,min;
for(i=0;i<row;i++){
min=9999;
for(j=0;j<col;j++)
if(min>temp[j][i])
min=temp[j][i];
for(j=0;j<col;j++)
temp[j][i]-=min;
}}
33
boolean HungarianMethod::checkValue(int row,int col,int temp[][MAX]){
int i,j;
for(i=0;i<row;i++)
for(j=0;j<col;j++)
if(temp[i][j]==0)
return TRUE;
return FALSE;
}
void HungarianMethod::makeAllocation(){
int temp_data[MAX][MAX]={0};
int i,j;
if(no_of_rows>no_of_columns){
for(i=0;i<no_of_rows;i++)
data[i][no_of_columns]=0;
no_of_columns++;
bal_stat=1;
}else if(no_of_rows<no_of_columns){
for(i=0;i<no_of_columns;i++)
data[no_of_rows][i]=0;
no_of_rows++;
bal_stat=2;
}
copyArray(0,0,no_of_rows,no_of_columns,data,0,0,temp_data);
rowMinima(temp_data,no_of_rows,no_of_columns);
columnMinima(temp_data,no_of_rows,no_of_columns);
int min,pos,count;
int tempCol[MAX]={0};
while(checkValue(no_of_rows,no_of_columns,temp_data)){
for(i=0;i<no_of_rows;i++){
count=countVal(temp_data[i],no_of_columns,0);
if(count==1){
pos=getPosition(temp_data[i],no_of_columns,0);
allocation[i][pos]=data[i][pos];
for(j=0;j<no_of_rows;j++)
if(temp_data[j][pos]==0)
temp_data[j][pos]=9999;
}}
for(i=0;i<no_of_rows;i++){
for(j=0;j<no_of_columns;j++)
tempCol[j]=temp_data[j][i];
count=countVal(tempCol,no_of_rows,0);
if(count==1){
pos=getPosition(tempCol,no_of_rows,0);
allocation[i][pos]=data[i][pos];
for(j=0;j<no_of_columns;j++)
if(temp_data[pos][j]==0)
temp_data[pos][j]=9999;
}}
}}
void HungarianMethod::display(){
int i,j;
34
cout<<"\nGiven Cost Metrix :\n";
for(i=0;i<no_of_rows;i++)
cout<<"\t"<<char(65+i);
cout<<endl;
for(i=0;i<no_of_rows;i++){
cout<<i+1;
for(j=0;j<no_of_columns;j++)
cout<<"\t"<<data[i][j];
cout<<endl;
}
if(bal_stat!=0){
cout<<"\n\nhere the give cost metrix is not squar Matrix\n";
cout<<"so this is a unbalance problem and as a solution";
cout<<"\n we have add an extra "<<((bal_stat==1)?"column":"row")<<" with 0 value in
each\n";
}
cout<<"\n\nOpportunity Matrix :\n";
rowMinima(data,no_of_rows,no_of_columns);
columnMinima(data,no_of_rows,no_of_columns);
for(i=0;i<no_of_rows;i++){
for(j=0;j<no_of_columns;j++)
cout<<"\t"<<data[i][j];
cout<<endl;
}
int sum=0;
cout<<"\n\nJobs\t:\tMachine\t:\tCost\n";
for(i=0;i<no_of_rows;i++)
for(j=0;j<no_of_columns;j++)
if(allocation[i][j]!=0){
cout<<i+1<<"\t:\t"<<char(65+j)<<"\t:\t"<<allocation[i][j];
sum+=allocation[i][j];
cout<<endl;
}
cout<<"\nTotal Assignment Cost = "<<sum<<" RS.";
}
void main(){
clrscr();
HungarianMethod hm;
int row,col;
cout<<"enter no of row :";
cin>>row;
cout<<"enter no of column :";
cin>>col;
hm.setRow(row);
hm.setColumn(col);
hm.getData();
clrscr();
hm.makeAllocation();
hm.display();
getch();
}
35
Program output:

36
Problem 8:
Formulate the LPP from the following pay-off matrix and find the optimum strategies of the
players A and B in the game given below. Also find the optimum value of the game.
B 1 2 3
A
1 3 -4 2
2 1 -3 -7
3 -2 4 7

Program:
#include <stdio.h>
#include <math.h>
#define CMAX 10 //max. number of variables in economic function
#define VMAX 10 //max. number of constraints

int NC, NV, NOPTIMAL,P1,P2,XERR;


double TS[CMAX][VMAX];

void Data() {
double R1,R2;
char R;
int I,J;
printf("\n LINEAR PROGRAMMING\n\n");
printf(" MAXIMIZE (Y/N) ? "); scanf("%c", &R);
printf("\n NUMBER OF VARIABLES OF ECONOMIC FUNCTION ? "); scanf("%d", &NV);
printf("\n NUMBER OF CONSTRAINTS ? "); scanf("%d", &NC);
if (R == 'Y' || R=='y')
R1 = 1.0;
else
R1 = -1.0;
printf("\n INPUT COEFFICIENTS OF ECONOMIC FUNCTION:\n");
for (J = 1; J<=NV; J++) {
printf(" #%d ? ", J); scanf("%lf", &R2);
TS[1][J+1] = R2 * R1;
}
printf(" Right hand side ? "); scanf("%lf", &R2);
TS[1][1] = R2 * R1;
for (I = 1; I<=NC; I++) {
printf("\n CONSTRAINT #%d:\n", I);
for (J = 1; J<=NV; J++) {
printf(" #%d ? ", J); scanf("%lf", &R2);
TS[I + 1][J + 1] = -R2;
}
printf(" Right hand side ? "); scanf("%lf", &TS[I+1][1]);
}
printf("\n\n RESULTS:\n\n");
for(J=1; J<=NV; J++) TS[0][J+1] = J;
for(I=NV+1; I<=NV+NC; I++) TS[I-NV+1][0] = I;
}
37
void Pivot();
void Formula();
void Optimize();

void Simplex() {
e10: Pivot();
Formula();
Optimize();
if (NOPTIMAL == 1) goto e10;
}

void Pivot() {
double RAP,V,XMAX;
int I,J;

XMAX = 0.0;
for(J=2; J<=NV+1; J++) {
if (TS[1][J] > 0.0 && TS[1][J] > XMAX) {
XMAX = TS[1][J];
P2 = J;
}
}
RAP = 999999.0;
for (I=2; I<=NC+1; I++) {
if (TS[I][P2] >= 0.0) goto e10;
V = fabs(TS[I][1] / TS[I][P2]);
if (V < RAP) {
RAP = V;
P1 = I;
}
e10:;}
V = TS[0][P2]; TS[0][P2] = TS[P1][0]; TS[P1][0] = V;
}

void Formula() {;
//Labels: e60,e70,e100,e110;
int I,J;

for (I=1; I<=NC+1; I++) {


if (I == P1) goto e70;
for (J=1; J<=NV+1; J++) {
if (J == P2) goto e60;
TS[I][J] -= TS[P1][J] * TS[I][P2] / TS[P1][P2];
e60:;}
e70:;}
TS[P1][P2] = 1.0 / TS[P1][P2];
for (J=1; J<=NV+1; J++) {
if (J == P2) goto e100;
TS[P1][J] *= fabs(TS[P1][P2]);
e100:;}
for (I=1; I<=NC+1; I++) {
38
if (I == P1) goto e110;
TS[I][P2] *= TS[P1][P2];
e110:;}
}
void Optimize() {
int I,J;
for (I=2; I<=NC+1; I++)
if (TS[I][1] < 0.0) XERR = 1;
NOPTIMAL = 0;
if (XERR == 1) return;
for (J=2; J<=NV+1; J++)
if (TS[1][J] > 0.0) NOPTIMAL = 1;
}

void Results() {
//Labels: e30,e70,e100;
int I,J;

if (XERR == 0) goto e30;


printf(" NO SOLUTION.\n"); goto e100;
e30:for (I=1; I<=NV; I++)
for (J=2; J<=NC+1; J++) {
if (TS[J][0] != 1.0*I) goto e70;
printf(" VARIABLE #%d: %f\n", I, TS[J][1]);
e70: ;}
printf("\n ECONOMIC FUNCTION: %f\n", TS[1][1]);
e100:printf("\n");
}
void main() {
data();
simplex();
results();
getch();
}

39
Program output:

40
Problem 9:
Draw a network for the simple project of erection of steel works for a shed. The various
activities of the project as are:
Activity Description Preceded by
A Erect site workshop -
B Fence site -
C Bend reinforcement A
D Dig foundation B
E Fabricate steel work A
F Install concrete pillars B
G Place reinforcement C,D
H Concrete foundation G,F
I Erect steel work E
J Paint steel work H,I
K Give finishing touch J

Solution:

 Activities A and B have no preceding activities and can commence immediately.

 Activities C and E can start once A has finished, while D and F can start once B has
finished.

 The remaining network is completed as follows: Activity G follows C and D. Since H is


preceded by G and F, the two have the same head event, which becomes the tail event
for H. Similarly, I and H have been shown to be preceding J. Activity K follows J.

A I
C

G H J K

D
B F

41
Problem 10:

Write down the role of computers in Operations Research.

Solution:
Operations Research (OR) is a field at the crossroads of computer science, applied
mathematics, management, and industrial engineering. Its goal is to provide automated logic-
based decision making systems, generally for control or optimization tasks such as improving
efficiency or reducing costs in industry.

Operational research is the discipline where advanced analytical skills are applied for better
decision making. Computers are widely used in many cases to prove the correctness of the
decision.

Computers have had a dramatic impact on the management of industrial production systems
and the fields of operations research and industrial engineering. The speed and data-handling
capabilities of computers allow engineers and scientists to build larger, more realistic models of
organized systems and to get meaningful solutions to those models through the use of
simulation techniques.

Operations research and computers interact in many scientific fields of vital importance to our
society. These include, among others, transportation, economics, investment strategy, inventory
control, logistics, safety, reliability, urban planning, and ecology. Computers & Operations
Research (COR) provides an international forum for the application of computers and
operations research techniques to problems in these and related fields. The common element in
all the scientific areas that this journal addresses is the need for some optimization
methodology for determining viable solutions to problems, using computers and the techniques
of operations research. However, it is not only the methodology which is of interest: the
applications are of equal importance. The two are mutually supportive, since understanding the
application helps one greatly to comprehend the optimization methods used, and vice versa.

42

You might also like