Roll No.: 101 Practical 18: Program To Implement Minimin Criterion
Roll No.: 101 Practical 18: Program To Implement Minimin Criterion
: 101
Practical 18 : Program to implement Minimin criterion.
#include<iostream.h>
#include<conio.h>
class Optimism
{
private :
int r,c;
long int ns[20][20],maxn[20],mins[20],payoff;
public :
void showdata();
private :
void getdata();
void calculate();
void showmat();
};
void Optimism :: getdata()
{
cout<<"\nEnter the no. of states of nature : ";
cin>>r;
cout<<"\nEnter the no. of alternatives : ";
cin>>c;
cout<<"\nEnter "<<r*c<<" values :";
for (int i=1;i<=r;i++)
{
for (int j=1;j<=c;j++)
{
cin>>ns[i][j];
}
}
}
void Optimism :: showmat()
{
for (int i=1;i<=r;i++)
{
for (int j=1;j<=c;j++)
{
cout<<ns[i][j]<<"\t";
}
cout<<"\n";
}
}
{
min = mins[i];
}
}
payoff = min;
}
void Optimism :: showdata()
{
calculate();
cout<<"\nPayoff = "<<payoff;
}
void main()
{
clrscr();
Optimism O;
O.showdata();
getch();
}
Output :
Enter the no. of states of nature : 3
Enter the no. of alternatives : 3
Enter 9 values :700000 500000 300000 300000 450000 300000 150000 0 300000
The Payoff Matrix :
700000 500000 300000
300000 450000 300000
150000 0
300000
Opportunity Loss Matrix :
0
200000 400000
150000 0
150000
150000 300000 0
Payoff = 0