d284f45nftegze.cloudfront.netd284f45nftegze.cloudfront.net/sunilvgnr1/finalreport.d… · web...
TRANSCRIPT
Development of graphical method for game problem NOV 2014
SYNOPSIS
INTRODUCTION
The main aim of the project is to introduce the concept of Game Theory and development of graphical method for 2 strategy game problems by using the graphical solution procedure. Game theory might be better described as Strategy Theory, or Theory of Interactive Decision Making, also It can be defined as a systematic study of strategic interactions among rational individuals A strategic situation involves two or more interacting players who make decisions while trying to anticipate the actions and reactions by others.
OBJECTIVE:
To describe the types of game problem based on the strategy of players. Developing algorithm for graphical method to solve 2 strategy game problems. Automated system to solve game problems.
Technical features of a project
It provides an insight and perspective into problem environment related with a multi dimensional phenomenon. This generally results in clear picture of the true problem.
It makes a scientific and mathematical analysis of the problem situations. It also considers all possible aspects and remedies associated with the problem.
It gives an opportunity to the decision maker to formulate his strategies consistent with the constraints and the objectives.
Tools used in the project for implementation
Java™ SE 7. Java™ SE Development Kit 7 Java™ SE Runtime Environment 7. Gedit 3.14.1 text editor for Linux.
Dept.of MCA,RVCE Page | 1
Development of graphical method for game problem NOV 2014
Introduction
Literature survey
The word “competition” is typical vocabulary when dealing with private industry,
athletic events, or with games. However it need not be constrained to simply those
arenas. One more subtle area, yet with larger implications of competition is within
international diplomacy. Nations or groups of nations vie for their interests over
those with dissimilar ones. Here the competition is to establish you and your allies
policy over the alternative policies. A particular branch of mathematics focuses on
exactly the dynamics of how this interplay of competing interests play out - Game
Theory. Although some might not think policy setting should be referred to as a
“game” the dynamics are very much the same [1].
Monetary policy signalling and financial market imperfections are
evaluated in the context of a pay-off matrix, with an underlying theme of studying
the behaviour of risk taker and risk averse. The approach is based on a pay-off
matrix with two players, two strategies and four outcomes with the objective to
indentify the behavioural pattern of risk taker and risk averse given perfect
information and imperfect information [2].
A large part of problems in biology and environmental sciences is focused on the
setting of deterministic or stochastic laws describing the evolution of systems
formed by two or more interacting individuals. The result of any interaction
usually depends on the behaviour adopted by the involved units. The behaviour of
such individuals is often described by means of game theory [3].
A contest model of an n-team professional sports league. Teams can have different
drawing potentials and different managerial skills to transform a given set of
playing talents into playing performance. The analysis demonstrates that there
exists a unique non-trivial Nash equilibrium under the general conditions (i.e., the
revenue functions of the teams are concave, the production functions of the teams Dept.of MCA,RVCE Page | 2
Development of graphical method for game problem NOV 2014
are strictly increasing and concave, etc). The proof uses the share function
approach with the following two reasons: one is to avoid the proliferation of
dimensions associated with the best response function approach and the other is to
be able to analyze sporting contests involving many heterogeneous teams [4].
The penalty-kick game, in which a soccer goalkeeper and a kicker face each other,
has become an important example in the applied game-theory literature to analyze
mixed-strategy Nash equilibrium. The reason of this importance probably has to
do with the fact that it is a game whose solution generates a clear theoretical
prediction and, at the same time, it is relatively easy to gather data about actual
outcomes of the game. All the game-theoretic literature that we know about
penalty kicks analyzes this situation as a game of complete information, i.e., as a
game in which the two players know the characteristics of each other, and hence
they know the expected payoffs that they will receive in the different strategy
profiles of the game [5].
Considering the novel issue of endogenous timing in two-player games, with
important modelling implications for several models in industrial economics. In a
prepay stage, players decide whether to select actions in the basic game at the first
opportunity or to wait until they observe their rivals’ first period actions. In one
extended game, players first decide when to select actions without committing to
actions in the basic game. The equilibrium has a simultaneous play sub game
unless payoffs in a sequential play sub game Pareto dominate those payoffs. In
another extended game, deciding to select at the first turn requires committing to
an action. They show that both sequential play outcomes are the equilibrium only
in nominated strategies [6].
In mathematics, a saddle point is a point in the range of a function that is
a stationary point but not a local extremism. The name derives from the fact that
the prototypical example in two dimensions is a surface that curves up in one
Dept.of MCA,RVCE Page | 3
Development of graphical method for game problem NOV 2014
direction, and curves down in a different direction, resembling a saddle or
a mountain pass. In terms of contour lines, a saddle point in two dimensions gives
rise to a contour that appears to intersect itself [7].
Critical points of a function of two variables are those points at which both
partial derivatives of the function are zero. A critical point of a function of a
single variable is a local maximum, a local minimum, or neither. With
functions of two variables there is a fourth possibility - a saddle point [8].
Explanation:
Dept.of MCA,RVCE Page | 4
Development of graphical method for game problem NOV 2014
The problem may originally be a 2 x n or a m x 2 game or a problem might have been reduced to such size after applying the dominance rule. In either case, we can use graphical method to solve the problem. By using the graphical approach, it is aimed to reduce a game to the order of 2 x 2 by identifying and eliminating the dominated strategies, and then solve it by the analytical method used for solving such games. The resultant solution is also the solution to the original problem. Although the game value and the optimal strategy can be read off from the graph, we generally adopt the analytical method (for 2 x 2 games) to get the answer.
Dept.of MCA,RVCE Page | 5
Development of graphical method for game problem NOV 2014
Conclusion
There are many methods exists to solve game problems. But Graphical solution
method will be the feasible solution for solving two strategy game problems. And gives
a high accuracy.
3.Software Requirement Specification
Hardware requirement :
Processor : Intel p IV or later
Hard disks : Minimum 512 MB
RAM : 512 MB
Software requirement :
Operating System : Windows XP/2003 or Linux 10 or later
Editor : Notepad, WordPad, Gedit text editor
Compiler : JVM compiler
Language : Java Programming language
IDE : JDK Runtime Environment 7
Dept.of MCA,RVCE Page | 6
Development of graphical method for game problem NOV 2014
Functional Requirements
Introduction:
As there are two types of game problems 2*n or m*2 ,User will be able to choose either 2*n or m*2 game problem.
The automated system will provide proper input platform for users . Will draw the graph based on the strategy pay –off matrix.
Input:
Inputs should be the matrix of type integer known as Pay-off matrix. A pay-off matrix can be either 2*n matrix or m*2 matrix. After analysing the graph user should choose the 2*2 strategy matrix for further
results of the game
Processing:
According to the pay matrix lines of strategies will draw on the graphical area. Based on the intersection on the lines the calculation of result will be done. Displays the results.
Output:
Plots the lines based on the pay –off matrix of game problem. Plotted Graph will help to choose 2*2 martix as strategies of game problem for
further calculation. The result block will have the results of the game problem as
Strategy of A1,A2. Strategy of B1,B2. Value of the game.
Performance requirements: Response time : 0.2 seconds for inputs acceptation ,0.2 seconds for results
Workload : It must be able to support 4 inputs/a min, Workload will not be
affect the performances
Dept.of MCA,RVCE Page | 7
Development of graphical method for game problem NOV 2014
Scalability: System supports the scalability as it can further add more features to
it.
Platform: As automated system is developed using java .It can be implemented
irrespective of platform. But it requires JVM to be installed in any OS of
windows XP or higher
4.Project Implementation
Methodology:
Project is breaks down into four modules; each block diagram of modules is given below
Block diagram of modules:
Fig 1: input box for 2*4 matrix
The fig 1 shows the module in which values of 2*4 pay – off matrix can be inserted. This module will helps to plot the graph of B1, B2, B3, B4 strategies of Player B on the A1 and A2 strategy values.
Dept.of MCA,RVCE Page | 8
Development of graphical method for game problem NOV 2014
Fig 2: input Box for 4*2 matrix
The fig 2 shows the module in which values of 4*2 pay – off matrix can be inserted. This module will helps to plot the graph of A1, A2, A3, A4 strategies of Player A on the B1 and B2 strategy values.
Dept.of MCA,RVCE Page | 9
Development of graphical method for game problem NOV 2014
Fig 3: Graphical area where lines are drawn.
The fig 3 shows the module in which two lines are horizontally drawn . This module will helps to plot the lines of B1, B2, B3, B4 strategies of Player B on the A1 and A2 strategy values. Or A1, A2, A3, A4 strategies of Player A on the B1 and B2 strategy values for the 2*n and m*2 matrix input respectively .
Dept.of MCA,RVCE Page | 10
Development of graphical method for game problem NOV 2014
Fig 4: Module to enter the 2*2 matrix.
The fig 4 is the module in which 2*2 matrix can be added manually by analysing plotted graph for further calculation of the game problem.
Fig 5: Result module
The fig 5 shows the result module in which result of the game problem will be displayed after calculation.
Dept.of MCA,RVCE Page | 11
Development of graphical method for game problem NOV 2014
Flowchart of the Logic
Fig 6: shows the flowchart of the logic used.
Dept.of MCA,RVCE Page | 12
Development of graphical method for game problem NOV 2014
Conclusion
The automated system succeeds in solving the 2*n or, m*2 strategy game
problem by the graphical solution method without any exceptions and provides the
resultant strategies of each player and value of the game.
The concept can be used to implement any graphical analysis in business
industries and certain strategical areas of computation.
Dept.of MCA,RVCE Page | 13
Development of graphical method for game problem NOV 2014
Source code
import java.awt.*;import java.applet.*;import java.applet.AppletStub;import java.awt.Graphics;import java.awt.GridLayout;import java.awt.Color;import java.awt.event.*;import java.text.DecimalFormat;
/*<applet code="UserInput" width=1400 height=1000> </applet>*/
public class GraphicalMethod extends Applet{ TextField t[] = new TextField[8]; TextField p[] = new TextField[8]; TextField o[] = new TextField[8];
public void init() {
setLayout(null);int f l=22;
setForeground(Color.red);//creating textboxs
for(int i=0;i<8;i++){
t[i] = new TextField(8);p[i] = new TextField(8);o[i] = new TextField(8);add(t[i]);add(p[i]);add(o[i]);p[i].setText("0");t[i].setText("0");o[i].setText("0");
}//result array for (int i=0,j=0,k=0;i<4;i++,j+=50)
{Dept.of MCA,RVCE Page | 14
Development of graphical method for game problem NOV 2014
o[i].setBounds(150+j,400+k,30,40);if(i==1){ j=-50;
k+=50;}
}//for 2*n matrix setting bonds
for (int i=0,j=0,k=0;i<8;i++,j+=50){
t[i].setBounds(150+j,100+k,30,40);if(i==3){
j=-50;k+=50;
}}
// setting bounds for m*2
for (int i=0,j=0,k=0;i<8;i++,j+=50){
p[i].setBounds(550+k-fl,100+j,30,40);if(i==3){ j=-50;
k+=50;}
}
}//closing init
public void paint(Graphics g) {
int[] x=new int[8]; int[] E=new int[8]; int[] xo=new int[4];
String[] s=new String[8]; String[] so=new String[4]; String[] w=new String[8];
float a,b,c,d,pvalue=0,psvalue=0,qvalue=0,qsvalue=0,value=0; int fl=20;int fff=0;g.drawString("\n ENTER 2 * N PAY-OFF MATRIX ",130,40);
//2*n naming g.drawString(" [A1] ",100,120); g.drawString(" [A2] ",100,170);
Dept.of MCA,RVCE Page | 15
Development of graphical method for game problem NOV 2014
g.drawString(" [B1] ",150,90); g.drawString(" [B2] ",200,90); g.drawString(" [B3] ",250,90);
g.drawString(" [B4] ",300,90);g.drawString(" ENTER THE VALUE OF LINES IN 2 * 2 MATRIX " ,80,290);g.drawString(" USING INTERSECTION OF LINES " ,90,310);
g.drawString(" [A1] ",100,430); g.drawString(" [A2] ",100,480);
g.drawString(" [B1] ",150,380); g.drawString(" [B2] ",200,380);
//M*2 naming g.drawString("\n ENTER M * 2 PAY-OFF MATRIX ",450,40);g.drawString(" [A1] ",500-fl,120);g.drawString(" [A2] ",500-fl,170);g.drawString(" [A3] ",500-fl,220);g.drawString(" [A4] ",500-fl,270);
g.drawString(" [B1] ",550-fl,90);g.drawString(" [B2] ",600-fl,90);
//getting array value from textboxs for(int i=0;i<8;i++)
{try
{ s[i] = t[i].getText();
x[i]= Integer.parseInt(s[i]); w[i] = p[i].getText();
E[i]= Integer.parseInt(w[i]); }
catch(Exception e) {}}
//getting result array for(int i=0;i<4;i++)
{try
{ so[i]=o[i].getText();
xo[i]= Integer.parseInt(so[i]); }
catch(Exception e) {}}
//horizontal lines
Dept.of MCA,RVCE Page | 16
Development of graphical method for game problem NOV 2014
g.drawLine(830,100,830,600); g.drawLine(1280,100,1280,600);
//numbersfor(int i=0,j=0;i<10;i++,j+=25){
g.drawString(String.valueOf(-i),815,350+j); g.drawString(String.valueOf(i),815,350-j); g.drawString(String.valueOf(-i),1285,350+j); g.drawString(String.valueOf(i),1285,350-j);
}
int fg=125;
//for 2*2 matrix g.drawLine(100-fl,450-fg,300-fl,450-fg);
g.drawLine(100-fl,650-fg,300-fl,650-fg); g.drawLine(100-fl,450-fg,100-fl,650-fg); g.drawLine(300-fl,450-fg,300-fl,650-fg);
//border for 2*n g.drawLine(75,50,375,50); g.drawLine(75,220,375,220); g.drawLine(375,50,375,220); g.drawLine(75,50,75,220);
//border for m*n g.drawLine(400+fl,50,650+fl,50); g.drawLine(400+fl,320,650+fl,320); g.drawLine(650+fl,50,650+fl,320); g.drawLine(400+fl,50,400+fl,320);
//border for result g.drawLine(330-0,350-0,730-0,350-0); g.drawLine(330-0,650-0,730-0,650-0);
g.drawLine(330-0,350-0,330-0,650-0); g.drawLine(730-0,350-0,730-0,650-0);
//border for Graphical area g.drawString(" LINE PLOTTING AREA BASED ON THE STRETAGY OF A1 A2 ",840,40);
g.drawLine(780,50,1330,50); g.drawLine(780,50,780,650); g.drawLine(1330,50,1330,650); g.drawLine(780,650,1330,650);
//drawing lines
Dept.of MCA,RVCE Page | 17
Development of graphical method for game problem NOV 2014
g.drawLine(830,(350+(-25*x[0])),1280,(350+(-25*x[4]))); g.drawString(" [B1] ",830,(350+(-25*x[0])));
g.drawLine(830,(350+(-25*x[1])),1280,(350+(-25*x[5])));g.drawString(" [B2] ",830,(350+(-25*x[1])));
g.drawLine(830,(350+(-25*x[2])),1280,(350+(-25*x[6])));g.drawString(" [B3] ",830,(350+(-25*x[2])));
g.drawLine(830,(350+(-25*x[3])),1280,(350+(-25*x[7])));g.drawString(" [B4] ",830,(350+(-25*x[3])));
//drawing line for m*2g.drawLine(830,(350+(-25*E[0])),1280,(350+(-25*E[4])));g.drawString(" [A1] ",830,(350+(-25*E[0])));
g.drawLine(830,(350+(-25*E[1])),1280,(350+(-25*E[5]))); g.drawString(" [A2] ",830,(350+(-25*E[1])));
g.drawLine(830,(350+(-25*E[2])),1280,(350+(-25*E[6])));g.drawString(" [A3] ",830,(350+(-25*E[2])));
g.drawLine(830,(350+(-25*E[3])),1280,(350+(-25*E[7]))); g.drawString(" [A4] ",830,(350+(-25*E[3])));
a=xo[0];b=xo[1];c=xo[2];d=xo[3];
//calculationpvalue=(d-c)/((a+d)-(b+c));psvalue=1-pvalue;qvalue=(b-c)/((a+d)-(b+c));qsvalue=1-qvalue;value= ((a*d)-(b*c))/((a+d)-(b+c));
DecimalFormat df = new DecimalFormat("###.##");
//result formatg.drawString(" RESULT OF THE GAME PROBLEM ",410,400);g.drawString("Stretegy Of P( A1,A2 ) = ",350+fl,450);g.drawString("Stretegy Of Q( B1,B2 ) = ",350+fl,500); g.drawString("VALUE OF THE GAME [ V ] = ",350+fl,550);
Dept.of MCA,RVCE Page | 18
Development of graphical method for game problem NOV 2014
//printing valuesg.drawString(String.valueOf((df.format(Math.abs(pvalue)))),520+fl,450);
g.drawString(String.valueOf((df.format(Math.abs(psvalue)))),600+fl,450);
g.drawString(String.valueOf((df.format(Math.abs(qvalue)))),520+fl,500);
g.drawString(String.valueOf((df.format(Math.abs(qsvalue)))),600+fl,500);
g.drawString(String.valueOf((df.format(Math.abs(value)))),530+fl,550);}
public boolean action(Event event, Object obj) { repaint(); return true; }}
Dept.of MCA,RVCE Page | 19
Development of graphical method for game problem NOV 2014
Output
Fig 7: Starting Page.
Fig 7 Depicts initial stage of project output having line plotting area and input areas using pay off matrix.
Dept.of MCA,RVCE Page | 20
Development of graphical method for game problem NOV 2014
Fig 8 : plotted graph and the result for given 2*n pay –off matrix
Fig 8 depicts module in which values of 2*4 pay – off matrix can be inserted. This module will helps to plot the graph of B1, B2, B3, B4 strategies of Player B on the A1 and A2 strategy values. Result box will display the strategies of A1 ,A2,B1,B2 and the value of the game.
Dept.of MCA,RVCE Page | 21
Development of graphical method for game problem NOV 2014
Fig 9: plotted graph and results for given pay –off of m*2 strategy game problem.
Fig 9 depicts module in which values of 4*2 pay – off matrix can be inserted. This module will helps to plot the graph of A1, A2, A3, A4 strategies of Player on the B1 and B2 strategy values. Result box will display the strategies of A1 ,A2,B1,B2 and the value of the game.
Dept.of MCA,RVCE Page | 22
Development of graphical method for game problem NOV 2014
References
[1].Aumann, R.J. "game theory." The New Palgrave Dictionary of Economics. Second Edition. Eds. Steven N. Durlauf and Lawrence E. Blume. Palgrave Macmillan, 2008. pp. 460–82.
[2].Frederick S. Hillier & Gerald J. Lieberman, Introduction to Operations Research, McGraw-Hill: Boston MA; 8th. (International) Edition, 2005.
[3].Hamdy A. Taha, Operations Research: An Introduction, Prentice Hall; 9th. Edition, 2011.
[4]. Wayne Winston, Operations Research: Applications and Algorithms, Duxbury Press; 4th. Edition, 2003.
[5].Camerer, Colin (2003), Behavioral Game Theory: Experiments in Strategic Interaction, Russell Sage Foundation,ISBN 978-0-691-09039-9 Description and Introduction, pp. 1-25.
[6]. Martin Shubik, 2002. "Game Theory and Experimental Gaming," in R. Aumannand S. Hart, ed., Handbook of Game Theory with Economic Applications, Elsevier, v. 3, pp. 2327–2351. doi:10.1016/S1574-0005(02)03025-4.
[7]. Vernon L. Smith, 1992. "Game Theory and Experimental Economics: Beginnings and Early Influences," in E. R. Weintraub, ed., Towards a History of Game Theory, pp. 241–282.
[8]. Eric Rasmusen (2007). Games and Information, 4th ed. Description and chapter-preview. [9]. David M. Kreps (1990). Game Theory and Economic Modelling. Description. R. Aumann and S. Hart, ed. (1992, 2002). Handbook of Game Theory with Economic Applications v. 1, ch. 3–6 and v. 3, ch. 43.
[10]. Roger B. Myerson (1991). Game Theory: Analysis of Conflict, Harvard University Press,. 1. Chapter-preview links, pp. vii–xi.
[11]. Gintis, Herbert (2000), Game theory evolving: a problem-centered introduction to modelling strategic behaviour, Princeton University Press, ISBN 978-0-691-00943-8
Dept.of MCA,RVCE Page | 23