#include "MpUtil.h" #include "SolveFixed.cpp" int N = 3; // Number of Legislators int J = 121; // Size of Grid double q; double Beta = 0.99; Vector p(N); Vector w(N); Vector vStar(J); Matrix VStar(N,N); Matrix U(N,J); Vector bGrid; Matrix App(N,J); string PrintSet(const Vector &Set1, const Vector &Grid1) { string s = ""; int K = Set1.Size(); if(Grid1.Size() != K) { Print("oiuwer"); HaltExecution(); } bool Started = 0; for(int k=0; k &x, Vector &xNew) { /* Reform V and VNew */ Vector xCopy = x.Copy(); Matrix V(N,J,&xCopy[0]); Matrix VNew(N,J,&xNew[0]); /* Precompute for Efficiency */ for(int n=0; n > vnStar(N); for(int n=0; n(J); /* for(int n=0; n Votes(J); for(int j=0; j= Temp) { vnStar(n)(j) = True; Votes(j) += w(n); } else { vnStar(n)(j) = False; } } if(Votes(j) >= q) vStar(j) = True; else vStar(j) = False; } Print("vStar" ,PrintSet(vStar,bGrid )); Print("vnStar(0)",PrintSet(vnStar(0),bGrid)); Print("vnStar(1)",PrintSet(vnStar(1),bGrid)); Print("vnStar(2)",PrintSet(vnStar(2),bGrid)); //PauseExecution(); /* Update VStar */ for(int n=0; n= q) Util1 = U(n,j); double Util2 = Temp; if(Votesm1 >= q) Util2 = U(n,j); VNew(n,j) = Max(Util1,Util2); } /* Vector Pass(N); Vector Proposal(N); for(int n=0; n Alpha = LoadVector(N,"-1,0,1"); long RandomSeed = -234098234; //Vector Alpha = RandomNormalVector(N,RandomSeed); bGrid = Grid(-3.0,3.0,J); for(int n=0; n xCopy = sf.x.Copy(); Matrix V (N,J,&xCopy[0] ); /* Vector Pass(N); Vector Outcome(N); for(int n=0; n