Exemple #1
0
void outbehavstrat(int pl, Rat *rplan, Bool bnewline)
{
    char s[MAXSTRL];
    int i;
    Move c;
    Iset h;
    Rat rprob, bprob;

    for (h = firstiset[pl]; h < firstiset[pl+1]; h++)
        for (c = h->move0, i=0; i < h->nmoves; c++, i++)
            {
            rprob = rplan[ c - firstmove[pl] ];
            if ( rprob.num != 0)
                {
                movetoa(c, pl, s);
                printf(" %s", s);
                bprob = ratdiv( rprob, rplan[ h->seqin - firstmove[pl]]);
                if (!ratiseq(bprob, ratfromi(1) ) )
                    {
                    rattoa(bprob, s);
                    printf(":%s", s);
                    }
                }
            }
    if (bnewline)
        printf("\n");
}
Exemple #2
0
int  propermixisets(int pl, Rat *rplan)
{
    int mix = 0;
    int i;
    Move c;
    Iset h;

    for (h = firstiset[pl]; h < firstiset[pl+1]; h++)
        for (c = h->move0, i=0; i < h->nmoves; c++, i++)
            if ( rplan[ c - firstmove[pl] ].num != 0  &&
                !ratiseq( rplan[ c - firstmove[pl] ],
                          rplan[ h->seqin - firstmove[pl]]) )
                {
                mix++ ;
                break ;
                }
    return mix;
}
Exemple #3
0
/* Checks the two equlibria are equal */
int equilibriumisEqual(Equilibrium e1, Equilibrium e2)
{
	int i;
	int result = 1;
	int n = e1.lcpdim;
	
	Rat* strat1 = getStrategies(e1);
	Rat* strat2 = getStrategies(e2);
	
	/* Check the two strategies are equal represented by the equlibrium
	 * Ignore the payoff variables when checking equality */
	for(i = 2; i < n; ++i)
	{
		if(!(result = ratiseq(strat1[i], strat2[i])))
		{
			break;
		}
	}
	
	free(strat1);
	free(strat2);
	return result;
}
Exemple #4
0
Bool iseqrealplantoprob(int pl, Rat *rplan, Bool bcomplain)
{
    int i;
    char s[MAXSTRL];
    Bool isok=1;

    for (i = 0; i < nseqs[pl]; i++)
        if (! ratiseq(rplan[i], (firstmove[pl] + i)->realprob))
	    {
	    isok = 0;
            if (bcomplain)
                {
                seqtoa(firstmove[pl] + i, pl, s);
                printf ("Player %d, move %s has realprob ", pl, s);
                rattoa( (firstmove[pl] + i)->realprob, s);
                printf ("%s", s);
                rattoa( rplan[i], s);
                printf (", but should be %s\n", s);
                }
            else
                break;
            }
    return isok ;
}
Exemple #5
0
void outmixed(int pl, Rat *mixed, Bool bnewline)
{
    int i;
    char s[MAXSTRL];
    Rat prob;

    for (i = 0; i < nstrats[pl]; i++)
        {
        prob = mixed[i] ;
        if ( prob.num != 0)
            {
            strattomovetuple (i, pl);
            movetupletoa(pl, s);
            printf(" %s", s);
            if (!ratiseq(prob, ratfromi(1) ) )
                {
                rattoa(prob, s);
                printf(":%s", s);
                }
            }
        }
    if (bnewline)
        printf("\n");
}