#include "sgrisksharing.hpp"
#include "sgsolver_pencilsharpening.hpp"
#include "sgsolver_jyc.hpp"
#include "sgsolver_maxminmax_grb.hpp"
#include "sgsolver_maxminmax.hpp"
#include <ctime>
void runModels(const int numEndowments,
const int c2e,
const double delta,
bool maxminmax,
bool maxminmaxfixed,
int jycnumdirs);
int main()
{
runModels(2,200,0.7,true,false,0);
runModels(2,200,0.4,true,false,0);
return 0;
runModels(2,20,0.7,true,false,0);
runModels(2,40,0.7,true,false,0);
runModels(5,20,0.7,true,false,0);
runModels(9,15,0.7,true,false,0);
return 0;
runModels(2,20,0.7,false,false,100);
runModels(2,40,0.7,false,false,100);
runModels(5,20,0.7,false,false,100);
runModels(9,15,0.7,false,false,100);
runModels(2,20,0.7,false,false,200);
runModels(2,40,0.7,false,false,200);
runModels(5,20,0.7,false,false,200);
runModels(9,15,0.7,false,false,200);
return 0;
}
void runModels(const int numEndowments,
const int c2e,
const double delta,
bool maxminmax,
bool maxminmaxfixed,
int jycnumdirs)
{
double persistence = 0;
RiskSharingGame::EndowmentMode endowmentMode = RiskSharingGame::Consumption;
c2e,persistence,endowmentMode);
clock_t start;
double duration;
cout << "numEndowments: " << numEndowments
<< ", c2e: " << c2e
<< ", delta: " << delta
<< endl;
if (maxminmaxfixed)
{
start = clock();
try
{
solver4.solve_fixed();
}
catch(std::exception & e)
{
cout << e.what() << endl;
}
duration = ( clock() - start ) / (double) CLOCKS_PER_SEC;
cout << fixed << "Fixed direction time elapsed: "<< duration << " seconds" << endl;
}
if (maxminmax)
{
start = clock();
solver5.solve();
duration = ( clock() - start ) / (double) CLOCKS_PER_SEC;
cout << fixed << "Endogenous direction time elapsed: "<< duration << " seconds" << endl;
stringstream ss;
ss << "./solutions/risksharing_nume=" << numEndowments
<< "_c2e=" << c2e
<< "_delta=" << delta;
ss << ".sln";
}
if (jycnumdirs>0)
{
start = clock();
jycsolver.solve();
duration = ( clock() - start ) / (double) CLOCKS_PER_SEC;
cout << "JYC implementation time elapsed with " << jycnumdirs
<< " directions: "<< duration << " seconds" << endl;
}
}