#include "sg.hpp"
#include <ctime>
int main ()
{
double delta = 2.0/3.0;
int action, state, player;
int numPlayers = 2;
int numStates = 2;
vector<bool> unconstrained(2,false);
vector< vector< int > > numActions(numStates,vector<int>(numPlayers,2));
vector<int> numActions_total(numStates,4);
vector< vector< vector<double> > >
payoffs(numStates,vector< vector<double> >(4,vector<double>(numPlayers,0.0)));
payoffs[0][0][0] = 0;
payoffs[0][1][0] = -1;
payoffs[0][2][0] = 2;
payoffs[0][3][0] = 1;
payoffs[0][0][1] = 0;
payoffs[0][1][1] = 2;
payoffs[0][2][1] = -1;
payoffs[0][3][1] = 1;
payoffs[1] = payoffs[0];
payoffs[1][0][0] += 2;
payoffs[1][1][0] += 2;
payoffs[1][2][0] += 2;
payoffs[1][3][0] += 2;
payoffs[1][0][1] += 2;
payoffs[1][1][1] += 2;
payoffs[1][2][1] += 2;
payoffs[1][3][1] += 2;
vector< vector< vector<double> > >
probabilities(numStates,vector< vector<double> >(4,vector<double>(numStates,0.5)));
probabilities[0][0][0] = 1.0/3.0;
probabilities[0][0][1] = 2.0/3.0;
probabilities[0][3][0] = 1.0/3.0;
probabilities[0][3][1] = 2.0/3.0;
probabilities[1][0][0] = 2.0/3.0;
probabilities[1][0][1] = 1.0/3.0;
probabilities[1][3][0] = 2.0/3.0;
probabilities[1][3][1] = 1.0/3.0;
try
{
cout << "Constructing game object" << endl;
numStates,
numActions,
payoffs,
probabilities,
unconstrained);
cout << "Building solver" << endl;
cout << "Starting solve routine" << endl;
clock_t start;
double duration;
start = clock();
duration = ( clock() - start ) / (double) CLOCKS_PER_SEC;
cout << fixed << "Solver time elapsed: "<< duration << " seconds" << endl;
cout << "Saving data... ";
cout << "Done!" << endl;
ofstream ofs ("pd_twostate.log");
iterit++)
{
for (int state = 0; state < numStates; state++)
{
for (int player = 0; player < numPlayers; player++)
{
for (auto stepit = iterit->getSteps().cbegin();
stepit != iterit->getSteps().cend();
stepit++)
{
ofs << stepit->getPivot()[state][player] << " ";
}
ofs << endl;
}
}
}
ofs.close();
}
{
cout << "Caught the following exception:" << endl
}
return 0;
}