-
Notifications
You must be signed in to change notification settings - Fork 2
/
lrsnashlib.h
73 lines (56 loc) · 2.52 KB
/
lrsnashlib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*******************************************************/
/* lrsnashlib is a library of routines for computing */
/* computing all nash equilibria for two person games */
/* given by mxn payoff matrices A,B */
/* */
/* */
/* Main user callable function is */
/* lrs_solve_nash(game *g) */
/* */
/* Sample driver: lrsnash.c */
/* Derived from nash.c in lrslib-060 */
/* by Terje Lensberg, October 26, 2015: */
/*******************************************************/
/* minor mod 2018.2.12 to set Q->fname="nash" */
/*************/
/* Games */
/*************/
#define MAXSTRAT 200
#define ROW 0
#define COL 1
typedef struct {
long num;
long den;
} ratnum;
typedef struct {
long nstrats[2];
ratnum payoff[MAXSTRAT][MAXSTRAT][2];
// For auxiliary information
void *aux;
} game;
typedef struct {
char name[100];
int fwidth[MAXSTRAT][2]; // Column field widths (for output)
} gInfo;
int lrs_solve_nash(game * g);
long nash2_main(lrs_dic * P1, lrs_dat * Q1, lrs_dic * P2orig,
lrs_dat * Q2, long *numequilib, lrs_mp_vector output, long linindex[]);
/* lrs driver, argv[2]= 2nd input file for nash equilibria */
long lrs_getfirstbasis2(lrs_dic ** D_p, lrs_dat * Q, lrs_dic * P2orig, lrs_mp_matrix * Lin, long no_output,
long linindex[]);
long getabasis2(lrs_dic * P, lrs_dat * Q, lrs_dic * P2orig, long order[], long linindex[]);
long lrs_nashoutput(lrs_dat * Q, lrs_mp_vector output, long player);
/* returns TRUE and prints output if not the origin */
int lrs_solve_nash_legacy (int argc, char *argv[]);
void BuildRep(lrs_dic * P, lrs_dat * Q, const game * g, int p1, int p2);
void FillFirstRow(lrs_dic * P, lrs_dat * Q, int n);
void FillLinearityRow(lrs_dic * P, lrs_dat * Q, int m, int n);
void FillConstraintRows(lrs_dic * P, lrs_dat * Q, const game * g, int p1, int p2, int firstRow);
void FillNonnegativityRows(lrs_dic * P, lrs_dat * Q, int firstRow, int lastRow, int n);
void printGame(game * g);
void setFwidth(game *g, int len);
void resetNashSolver(); /* Call this function for every new game to be solved */
void initFwidth(game *g);
void updateFwidth(game *g, int col, int pos, char *str);
static long Debug_flag;
static long Verbose_flag;