E3: WRITE A PROGRAM FOR MAXIMIN CRITERIA IN OPERATION RESEARCH

 E3: WRITE A PROGRAM FOR MAXIMIN CRITERIA


#include<iostream.h>

#include<conio.h>


void main()

{   clrscr();

    int a[10][10]; //max1,min1;

   cout<<"Enter the no. of rows and column :-";

   int r,c;

    cin>>r>>c;

    cout<<"Enter the entries:-";

    for(int i=1;i<=r;i++)

      {

        for(int j=1;j<=c;j++)

{

  gotoxy(18+4*j,2+3*i);

  cin>>a[i][j];

}

      }

   /*  for(i=1;i<=r;i++)

{

  for(int j=1;j<=c;j++)

    {

cout<<" "<<a[i][j];

    }

cout<<"\n";

        }*/

    cout<<"\n Calculation for MAXMIN criteria:-";

    int min[10];

    for(i=1;i<=r;i++)

      {

        min[i]=a[i][1];

        for(int j=1;j<=c;j++)

  {

    if(min[i]>=a[i][j])

    min[i]=a[i][j];

  }

cout<<"\n\n min="<<min[i];

      }

   int maximin;

    int pos=1;

   for(i=1;i<=r;i++)

      {

        maximin=min[1];

        if(maximin<min[i])

{

    maximin=min[i];

  pos=i;

}

      }

  

   cout<<"\n maximin= "<<maximin;

     cout<<"\n the selection of best action takes place on "<<pos;

       getch();

}





OUTPUT


Enter the no. of rows and column :-3  4

Enter the entries:-                                                             

                                                                                

                                                                                

                      8   0  -10   6                                                  

                                                                                

                                                                                

                     -4  12  18 -2                                                

                                                                                

                                                                                

                      14  6    0   8    

Calculation for MAXMIN criteria:-              

                                                                                

 min= -10                                                                        

                                                                                

 min= -4                                                                         

                                                                                

 min= 0                                                                          

 maximin= 0


 the selection of best action takes place on 3                                  

                                                                                

                                                                                

                                                                                

                                                                                

                                                                                

                                                                                

                                                                                

                                                                                

                  




                                                              

                         


No comments:

Post a Comment

This Blog helps you to learn basics to high level programming coding and practicals.
conceptual understanding

c program, Advance coding, c++ program, simple program, Advance language

online quiz Application project page MCA final year project

  Here we making a quiz application ppt presentation for college project so that our project idea will like to our professor and teacher  fi...