package master; import java.text.NumberFormat; import java.util.Random; import org.apache.commons.math3.distribution.BetaDistribution; import agents.*; /** * Constructs products and sells them. * * @author mbilgic * */ public class Simulator { //Number of days private final static int NUMDAYS = 1000; //The cap on the maximum value of the product private final static double MAXIMUMVALUE = 50000; //The initial money the agent has private final static double INITIALMONEY = 1000; //The amount the agent earns daily from other sources private final static double DAILYEARNINGS = 100; //The markets with the ratio of good v.s. bad products private final static int[] UNFAVORABLE = {1, 3}; private final static int[] FAIR = {1, 1}; private final static int[] FAVORABLE = {3, 1}; //To see the full trace, set it true static boolean debug = false; /** * @param args */ public static void main(String[] args) { int[][] oddslist = {/*Simulator.UNFAVORABLE,Simulator.FAIR,*/Simulator.FAIR}; for(int[] market_odds: oddslist){ //TODO Change this to the last four digits of your A#. int lastfourdigits = 5405; int[] seeds = {0, 1, 2, 3, 4, 5, 6, 7, 8,lastfourdigits }; String[] agentNames = { "FC", "HP", "PB0", "PB25", "PB50", "PB75", "PFCHINETTI", "PB100", "DONT_TAZE_ME_BRO" }; Agent[] agents = { new FlipCoinAgent("FC", lastfourdigits), new HalfProbAgent("HP"), new PercentBeliever("PB0",0), new PercentBeliever("PB25",25), new PercentBeliever("PB50",50), new PercentBeliever("PB75",75), new Agent5405("5405"), new PercentBeliever("PB100",100), new AgentWin("win") }; double[][] average = new double[agents.length][Simulator.NUMDAYS]; int agentIndex = 0; double best = 0,secondBest = 0; int best_name = 0,secondBest_name = 0; double last = 0.0; for(Agent agent: agents){ agentIndex++; //System.out.println(agentNames[agentIndex++]); for(int seed: seeds) { //Simulator.print("Simulating Agent"+agent); double[] dailyBalance = Simulator.noLearningCase(agent, market_odds, seed); for(int d=0; d