Ejemplo n.º 1
0
        protected override IAgent create(IBlauPoint pt, IAgentFactory creator, int id)
        {
            SingletonLogger.Instance().InfoLog(typeof(Agent1x0), "Agent1x0_Factory creating agent " + id);
            IAgent dupe = new Agent1x0(pt, creator, id, _lambda, _gamma, _burnin);

            return(dupe);
        }
Ejemplo n.º 2
0
        protected override IAgent create(IBlauPoint pt, IAgentFactory creator, int id)
        {
            SingletonLogger.Instance().InfoLog(typeof(Agent0x1), "Agent0x1_Factory creating agent " + id);
            IAgent dupe = new Agent0x1(pt, creator, id);

            return(dupe);
        }
Ejemplo n.º 3
0
        public Transaction(IProcessExecutionContext executionContext, IAgentFactory agentFactory, ITransactionFeeListFactory transactionFeeListFactory, ITransactionContextFactory transactionContextFactory,
                           ICustomerFactory customerFactory, ITransactionDeficienciesFactory transactionDeficienciesFactory, IDocumentService documentService, IEvidenceService evidenceService,
                           ILocationFactory locationFactory, IRequirementEvaluator requirementEvaluator, ITransactionHistoryFactory transactionHistoryFactory, ITransactionService transactionService,
                           ITransactionType transactionType, ITransactionRecord record)
            : base(record.RecordType, record.Id)
        {
            this.ExecutionContext = executionContext ?? throw new ArgumentNullException("executionContext");

            this.AgentFactory = agentFactory ?? throw new ArgumentNullException("agentFactory");
            this.TransactionFeeListFactory      = transactionFeeListFactory ?? throw new ArgumentNullException("transactionFeeListFactory");
            this.TransactionContextFactory      = transactionContextFactory ?? throw new ArgumentNullException("transactionContextFactory");
            this.CustomerFactory                = customerFactory ?? throw new ArgumentNullException("customerFactory");
            this.TransactionDeficienciesFactory = transactionDeficienciesFactory ?? throw new ArgumentNullException("transactionDeficienciesFactory");
            this.DocumentService                = documentService ?? throw new ArgumentNullException("documentService");
            this.EvidenceService                = evidenceService ?? throw new ArgumentNullException("evidenceService");
            this.LocationFactory                = locationFactory ?? throw new ArgumentNullException("locationFactory");
            this.RequirementEvaluator           = requirementEvaluator ?? throw new ArgumentNullException("requirementEvaluator");
            this.TransactionHistoryFactory      = transactionHistoryFactory ?? throw new ArgumentNullException("transactionHistoryFactory");
            this.TransactionService             = transactionService ?? throw new ArgumentNullException("transactionService");

            this.TransactionType = transactionType ?? throw new ArgumentNullException("transactionType");

            this.Name                 = record.Name;
            this.ReferenceNumber      = record.ReferenceNumber;
            this.PricingDate          = record.PricingDate ?? DateTime.Now.Date;
            this.InitiatingProcessId  = record.InitiatingProcessId ?? throw new ArgumentNullException("InitiatingProcessId");
            this.CurrentProcessId     = record.CurrentProcessId ?? throw new ArgumentNullException("CurrentProcessId");
            this.CurrentStepId        = record.CurrentStepId ?? throw new ArgumentNullException("CurrentStepId");
            this.ContextRecordId      = record.ContextRecordId ?? throw new ArgumentNullException("contextRecordId");
            this.CustomerId           = record.CustomerId ?? throw new ArgumentNullException("customerId");
            this.InitiatingAgentId    = record.InitiatingAgentId ?? throw new ArgumentNullException("initiatingAgentId");
            this.InitiatingLocationId = record.InitiatingLocationId ?? throw new ArgumentNullException("initiatingLocationId");
        }
Ejemplo n.º 4
0
 public static void Dispose()
 {
     AgentFactory.Dispose();
     agentFactory = null;
     GameTick.Dispose();
     gameTick = null;
 }
Ejemplo n.º 5
0
 public MazeGenerationFactory(
     IMazeModelFactory mazeModelFactory,
     IGrowingTreeAlgorithm growingTreeAlgorithm,
     IMazeFactory mazeFactory,
     IDeadEndFiller deadEndFiller,
     IRandomCarver randomCarver,
     IExtraWallCalculator extraWall,
     IRecursiveBacktrackerAlgorithm recursiveBacktrackerAlgorithm,
     IBinaryTreeAlgorithm binaryTreeAlgorithm,
     IHeuristicsGenerator heuristicsGenerator,
     IAgentFactory agentFactory,
     ITimeRecorder timeRecorder)
 {
     _mazeModelFactory              = mazeModelFactory;
     _growingTreeAlgorithm          = growingTreeAlgorithm;
     _mazeFactory                   = mazeFactory;
     _deadEndFiller                 = deadEndFiller;
     _randomCarver                  = randomCarver;
     _extraWall                     = extraWall;
     _recursiveBacktrackerAlgorithm = recursiveBacktrackerAlgorithm;
     _binaryTreeAlgorithm           = binaryTreeAlgorithm;
     _heuristicsGenerator           = heuristicsGenerator;
     _agentFactory                  = agentFactory;
     _timeRecorder                  = timeRecorder;
 }
 public PlatformService(IPlatformSettingsFactory settingsFactory, IPlatformDataConnector dataConnector, IAgentFactory agentFactory, ILocationFactory locationFactory)
 {
     SettingsFactory = settingsFactory;
     DataConnector   = dataConnector;
     AgentFactory    = agentFactory;
     LocationFactory = locationFactory;
 }
Ejemplo n.º 7
0
        public Agent0xA(IBlauPoint coordinates, IAgentFactory creator, int id) : base(coordinates, creator, id, 0.0)
        {
            _G = coordinates.getCoordinate(coordinates.Space.getAxisIndex(GainCutoff_PROPERTYNAME));
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have set my aggressiveness to: "+_aggressiveness);
            SetMetricValue(GainCutoff_PROPERTYNAME, _G);

            _L = coordinates.getCoordinate(coordinates.Space.getAxisIndex(LossCutoff_PROPERTYNAME));
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have set my optimism to: "+_optimism);
            SetMetricValue(LossCutoff_PROPERTYNAME, _L);

            _Tdouble = coordinates.getCoordinate(coordinates.Space.getAxisIndex(Type_PROPERTYNAME));
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have set my optimism to: "+_optimism);
            if (_Tdouble < 0.0)
            {
                _T = -1;
            }
            else
            {
                _T = +1;
            }
            SetMetricValue(Type_PROPERTYNAME, _T);

            _myTrades = 0;
            SetMetricValue(TotalTrades_METRICNAME, (double)_myTrades);

            _myOrders = 0;
            SetMetricValue(TotalOrders_METRICNAME, (double)_myOrders);
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have iniitialized TotalTrades metric to: "+GetMetricValue(TotalTrades_METRICNAME));
        }
Ejemplo n.º 8
0
        protected static IPopulation CreatePopulation(IAgentFactory afact, int numAgents, string initialOrderbook)
        {
            // SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "pre.");
            IPopulation pop = PopulationFactory.Instance().create(afact, numAgents);
            // SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "post.");

            AgentOrderbookLoader loader = Helpers.MakeAgentOrderbookLoader(initialOrderbook);

            pop.addAgent(loader);

            return(pop);
        }
Ejemplo n.º 9
0
        public Agent0xB(IBlauPoint coordinates, IAgentFactory creator, int id) : base(coordinates, creator, id, 0.0)
        {
            _G = coordinates.getCoordinate(coordinates.Space.getAxisIndex(GainCutoff_PROPERTYNAME));
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have set my aggressiveness to: "+_aggressiveness);
            SetMetricValue(GainCutoff_PROPERTYNAME, _G);
            if (_G < 0.0)
            {
                throw new Exception("Gain cutoff must be positive!");
            }

            _L = coordinates.getCoordinate(coordinates.Space.getAxisIndex(LossCutoff_PROPERTYNAME));
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have set my optimism to: "+_optimism);
            SetMetricValue(LossCutoff_PROPERTYNAME, _L);
            if (_L < 0.0)
            {
                throw new Exception("Loss cutoff must be positive!");
            }

            _TypeDouble = coordinates.getCoordinate(coordinates.Space.getAxisIndex(Type_PROPERTYNAME));
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have set my optimism to: "+_optimism);

            /*
             * double toss = SingletonRandomGenerator.Instance.NextDouble ();
             *
             * if (toss < _TypeDouble) {
             *      _Type = -1; // play short
             *      // Move myself in BlauSpace
             *      coordinates.setCoordinate(coordinates.Space.getAxisIndex (Type_PROPERTYNAME), (double)0.0);
             * } else {
             *      _Type = +1; // play long
             *      // Move myself in BlauSpace
             *      coordinates.setCoordinate(coordinates.Space.getAxisIndex (Type_PROPERTYNAME), (double)1.0);
             * }
             */

            /*
             * if (this.ID % 2 == 0) _Type = -1; // play short
             * else _Type = +1; // play long
             */

            SetMetricValue(Type_PROPERTYNAME, _Type);

            _clock = coordinates.getCoordinate(coordinates.Space.getAxisIndex(Clock_PROPERTYNAME));
            SetMetricValue(Clock_PROPERTYNAME, _clock);

            ResetMetrics();

            _burninResetCompleted = false;
            _startTime            = 0.0;

            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have iniitialized TotalTrades metric to: "+GetMetricValue(TotalTrades_METRICNAME));
        }
Ejemplo n.º 10
0
        protected static IAgentFactory CreateAgentFactory(IDistribution d, string agentFactoryName)
        {
            Assembly assembly     = typeof(AgentDummy).Assembly;
            string   assemblyName = assembly.GetName().Name;
            Type     type         = assembly.GetType(assemblyName + "." + agentFactoryName);

            object[] args = new object[1];
            args[0] = d;
            var           agentFactory = (IAgentFactory)Activator.CreateInstance(type, args);
            IAgentFactory afact        = (IAgentFactory)agentFactory;

            return(afact);
        }
Ejemplo n.º 11
0
        public Agent0x1(IBlauPoint coordinates, IAgentFactory creator, int id) : base(coordinates, creator, id, 0.0)
        {
            SingletonLogger.Instance().InfoLog(typeof(Agent0x1), "creating agent " + id);

            _aggressiveness = coordinates.getCoordinate(coordinates.Space.getAxisIndex(Aggressiveness_PROPERTYNAME));

            SetMetricValue(Aggressiveness_PROPERTYNAME, _aggressiveness);
            SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I am " + this.ID + " have set my aggressiveness to: " + GetMetricValue(Aggressiveness_PROPERTYNAME));

            SetMetricValue(TotalTrades_METRICNAME, 0.0);
            SetMetricValue(NetWorth_METRICNAME, 0.0);
            SetMetricValue(TotalOrders_METRICNAME, 0.0);

            validateMetrics(7);
            SingletonLogger.Instance().InfoLog(typeof(Agent0x1), "done creating agent " + id);
        }
Ejemplo n.º 12
0
        public Agent0x2(IBlauPoint coordinates, IAgentFactory creator, int id) : base(coordinates, creator, id, 0.0)
        {
            _aggressiveness = coordinates.getCoordinate(coordinates.Space.getAxisIndex(Aggressiveness_PROPERTYNAME));
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have set my aggressiveness to: "+_aggressiveness);
            SetMetricValue(Aggressiveness_PROPERTYNAME, _aggressiveness);

            _optimism = coordinates.getCoordinate(coordinates.Space.getAxisIndex(Optimism_PROPERTYNAME));
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have set my optimism to: "+_optimism);
            SetMetricValue(Optimism_PROPERTYNAME, _optimism);

            _myTrades = 0;
            SetMetricValue(TotalTrades_METRICNAME, (double)_myTrades);

            _myOrders = 0;
            SetMetricValue(TotalOrders_METRICNAME, (double)_myOrders);
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have iniitialized TotalTrades metric to: "+GetMetricValue(TotalTrades_METRICNAME));
        }
Ejemplo n.º 13
0
        public AgentZx0(IBlauPoint coordinates, IAgentFactory creator, int id) : base(coordinates, creator, id, 0.0)
        {
            _clock = coordinates.getCoordinate(coordinates.Space.getAxisIndex(Clock_PROPERTYNAME));
            SetMetricValue(Clock_PROPERTYNAME, _clock);

            _priceOffset = coordinates.getCoordinate(coordinates.Space.getAxisIndex(PriceOffset_PROPERTYNAME));
            SetMetricValue(PriceOffset_PROPERTYNAME, _priceOffset);

            _volumeOffset = coordinates.getCoordinate(coordinates.Space.getAxisIndex(VolumeOffset_PROPERTYNAME));
            SetMetricValue(VolumeOffset_PROPERTYNAME, _volumeOffset);

            _myTrades = 0;
            SetMetricValue(AgentTrades_METRICNAME, (double)_myTrades);

            _myOrders = 0;
            SetMetricValue(AgentOrders_METRICNAME, (double)_myOrders);
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have iniitialized TotalTrades metric to: "+GetMetricValue(TotalTrades_METRICNAME));
        }
Ejemplo n.º 14
0
 public StorageHub(ILogger <StorageHub> logger,
                   CredentialsConfiguration credentialsConfiguration,
                   IStorageHubRepository storageHubRepository,
                   ITenantRepository tenantMemoryRepository,
                   IStorageFactory storageFactory,
                   IAgentFactory agentFactory,
                   IConsumerHubService consumerHubService,
                   IProducerHubService producerHubService)
 {
     this.logger = logger;
     this.credentialsConfiguration = credentialsConfiguration;
     this.storageHubRepository     = storageHubRepository;
     this.tenantMemoryRepository   = tenantMemoryRepository;
     this.storageFactory           = storageFactory;
     this.agentFactory             = agentFactory;
     this.consumerHubService       = consumerHubService;
     this.producerHubService       = producerHubService;
 }
Ejemplo n.º 15
0
        public Agent0xA(IBlauPoint coordinates, IAgentFactory creator, int id) : base(coordinates, creator, id, 0.0)
        {
            _G = coordinates.getCoordinate(coordinates.Space.getAxisIndex(GainCutoff_PROPERTYNAME));
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have set my aggressiveness to: "+_aggressiveness);
            SetMetricValue(GainCutoff_PROPERTYNAME, _G);
            if (_G < 0.0)
            {
                throw new Exception("Gain cutoff must be positive!");
            }

            _L = coordinates.getCoordinate(coordinates.Space.getAxisIndex(LossCutoff_PROPERTYNAME));
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have set my optimism to: "+_optimism);
            SetMetricValue(LossCutoff_PROPERTYNAME, _L);
            if (_L < 0.0)
            {
                throw new Exception("Loss cutoff must be positive!");
            }

            _TypeDouble = coordinates.getCoordinate(coordinates.Space.getAxisIndex(Type_PROPERTYNAME));
            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have set my optimism to: "+_optimism);

            if (_TypeDouble < 0.0)
            {
                _Type = -1;                                // play short
            }
            else
            {
                _Type = +1;              // play long
            }
            SetMetricValue(Type_PROPERTYNAME, _Type);

            _clock = coordinates.getCoordinate(coordinates.Space.getAxisIndex(Clock_PROPERTYNAME));
            SetMetricValue(Clock_PROPERTYNAME, _clock);

            ResetMetrics();

            _burninResetCompleted = false;
            _startTime            = 0.0;

            //SingletonLogger.Instance().DebugLog(typeof(Agent0x1), "I have iniitialized TotalTrades metric to: "+GetMetricValue(TotalTrades_METRICNAME));
        }
Ejemplo n.º 16
0
		public Agent1x0(IBlauPoint coordinates, IAgentFactory creator, int id, double lambda, double gamma, double burnin) : base(coordinates, creator, id, burnin)
		{
			SingletonLogger.Instance().InfoLog(typeof(Agent1x0), "creating agent "+id);
			
			_clock = coordinates.getCoordinate( coordinates.Space.getAxisIndex(Clock_PROPERTYNAME) );
			_aggressiveness = coordinates.getCoordinate( coordinates.Space.getAxisIndex(Aggressiveness_PROPERTYNAME) );
			_patience = coordinates.getCoordinate( coordinates.Space.getAxisIndex(Patience_PROPERTYNAME) );
			_trendiness = coordinates.getCoordinate( coordinates.Space.getAxisIndex(Trendiness_PROPERTYNAME) );
			_optimism = coordinates.getCoordinate( coordinates.Space.getAxisIndex(Optimism_PROPERTYNAME) );
			_riskiness = coordinates.getCoordinate( coordinates.Space.getAxisIndex(Riskiness_PROPERTYNAME) );
			
			SetMetricValue(Clock_PROPERTYNAME, _clock);
			SetMetricValue(Aggressiveness_PROPERTYNAME, _aggressiveness);
			SetMetricValue(Patience_PROPERTYNAME, _patience);
			SetMetricValue(Trendiness_PROPERTYNAME, _trendiness);
			SetMetricValue(Optimism_PROPERTYNAME, _optimism);
			SetMetricValue(Riskiness_PROPERTYNAME, _riskiness);
			
			SingletonLogger.Instance().DebugLog(typeof(Agent1x0), "I am "+this.ID+" have set my clock to: "+GetMetricValue(Clock_PROPERTYNAME));
			SingletonLogger.Instance().DebugLog(typeof(Agent1x0), "I am "+this.ID+" have set my aggressiveness to: "+GetMetricValue(Aggressiveness_PROPERTYNAME));
			SingletonLogger.Instance().DebugLog(typeof(Agent1x0), "I am "+this.ID+" have set my patience to: "+GetMetricValue(Patience_PROPERTYNAME));
			SingletonLogger.Instance().DebugLog(typeof(Agent1x0), "I am "+this.ID+" have set my trendiness to: "+GetMetricValue(Trendiness_PROPERTYNAME));
			SingletonLogger.Instance().DebugLog(typeof(Agent1x0), "I am "+this.ID+" have set my optimism to: "+GetMetricValue(Optimism_PROPERTYNAME));
			SingletonLogger.Instance().DebugLog(typeof(Agent1x0), "I am "+this.ID+" have set my riskiness to: "+GetMetricValue(Riskiness_PROPERTYNAME));
			
			ResetMetrics();
			
			_haveOrder = false;
			
			_lastBidVolume = 0.0;
			_lastAskVolume = 0.0;
			
			_lambda = lambda;
			_gamma = gamma;
			
			_burninResetCompleted = false;
			_startTime = 0.0;
			
			SingletonLogger.Instance().InfoLog(typeof(Agent1x0), "done creating agent "+id);
		}
Ejemplo n.º 17
0
        // constructor
        protected AbstractAgent(IBlauPoint coordinates, IAgentFactory creator, int id, double burnin)
        {
            _coordinates = coordinates;
            _creator     = creator;
            _burnin      = burnin;

            // implicit assignment, allocates the ID dynamically
            if (id < 0)
            {
                // dynamic assignment
                _id = _nextID;
                _nextID++;
            }
            else
            {
                // explicit assignment (used in cloning, for example)
                _id = id;
            }

            // the ecosystem, initially null
            _sim = null;

            // the metrics associated with this Agent
            _metrics = new Dictionary <string, double>();

            // the list of open orders
            _orders = new List <IOrder>();

            // basic stats that every Agent maintains
            SetMetricValue(NumBids_METRICNAME, 0.0);
            SetMetricValue(NumAsks_METRICNAME, 0.0);
            SetMetricValue(Holdings_METRICNAME, 0.0);

            // boot message
            this.Send(this, new ActionPrompt(), GetTimeToNextActionPrompt());
            if (LoggerDiags.Enabled)
            {
                SingletonLogger.Instance().InfoLog(typeof(AbstractAgent), "AbstractAgent " + GetName() + " Constructed @ " + Scheduler.GetTime());
            }
        }
Ejemplo n.º 18
0
        // use an agentfactory to create the population
        public IPopulation create(IAgentFactory afact, int size)
        {
            IPopulation pop = new Population();

            if (LoggerDiags.Enabled)
            {
                SingletonLogger.Instance().InfoLog(typeof(PopulationFactory), "PopulationFactory creating " + size + " agents using IAgentFactory = " + afact.ToString());
            }

            afact.Distribution.setTotalSamples(size);

            for (int i = 0; i < size; i++)
            {
                IAgent ag = afact.create();
                if (LoggerDiags.Enabled)
                {
                    SingletonLogger.Instance().DebugLog(typeof(PopulationFactory), "PopulationFactory created Agent # " + i + " : " + ag);
                }
                pop.addAgent(ag);
            }

            return(pop);
        }
 public TransactionDeficienciesFactory(ITransactionDataConnector dataConnector, IAgentFactory agentFactory)
 {
     this.DataConnector = dataConnector ?? throw new ArgumentNullException("dataConnector");
     this.AgentFactory  = agentFactory ?? throw new ArgumentNullException("agentFactory");
 }
Ejemplo n.º 20
0
 public Agent0xC(IBlauPoint coordinates, IAgentFactory creator, int id) : base(coordinates, creator, id, 0.0)
 {
 }
 protected override IAgent create(IBlauPoint pt, IAgentFactory creator, int id)
 {
     return(new AgentOrderbookLoader(_path, pt, creator, id));
 }
Ejemplo n.º 22
0
        public override void run()
        {
            LoggerInitialization.SetThreshold(typeof(SingleDistributionExperiment), LogLevel.Debug);

            SingletonLogger.Instance().DebugLog(typeof(SingleDistributionExperiment), "run()");
            SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "distribution => " + theActualDistribution);

            IAgentFactory af = CreateAgentFactory(theActualDistribution, theTableConfig.AgentFactoryClassName);

            SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "agent factory => " + theTableConfig.AgentFactoryClassName);

            af.Initialize(theTableConfig);

            SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "creating initial orderbook");
            IOrderbook_Observable ob = new Orderbook();

            /* No Burnin at this point
             *
             * SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "Executing burnin...");
             * IPopulation popburn = CreatePopulation(af, theTableConfig.NumAgents, Path.Combine(ApplicationConfig.ROOTDIR, theTableConfig.InitialOrderbook));
             * ISimulation simburn = new Simulation(popburn, ob, 0.0, COMMON_BURNIN_TIME_SECONDS, false, "burnin") ;
             * ISimulationResults resultsburn = simburn.run();
             * ob = (IOrderbook_Observable)simburn.Orderbook;
             * SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "Done with burnin.");
             */

            ISimulationBundle        accumulated_simb = null;
            ISimulationResultsBundle accumulated_resb = null;

            for (int popi = 0; popi < theTableConfig.Populations; popi++)
            {
                SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "creating population... " + theTableConfig.NumAgents);
                // Populations all contain an OrderBookLoader agent
                IPopulation pop = CreatePopulation(af, theTableConfig.NumAgents, Path.Combine(ApplicationConfig.ROOTDIR, theTableConfig.InitialOrderbook));
                // SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "done.");

                string popname = POP_FILE_PREFIX + "." + popi + ".Validation";
                string poppath = Path.Combine(_popdir, popname);
                SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "population " + popi + " => " + poppath);
                savePopulation(poppath, pop);

                _simb = new SimulationBundle(pop, ob, 0.0, theTableConfig.DurationHours * 3600.0, LOG_FRAMES, "pop-" + popi);

                if (accumulated_simb == null)
                {
                    accumulated_simb = _simb;
                }

                foreach (TrajectoryFactoryConfig tfc in theTrajConfig.getTrajectories())
                {
                    IPassiveTrajectoryFactory tf = CreatePassiveTrajectoryFactory(tfc);
                    tf.Initialize(theTableConfig);
                    _simb.add(tf);
                }

                /*
                 * foreach (IAgent ag in pop) {
                 *      if (ag is IAgent_NonParticipant) continue;
                 *
                 *      _simb.add (new TrajectoryFactory_AgentNamedMetric(ag, Agent1x0.NetWorth_METRICNAME, 1.0, 0.0));
                 * }
                 */

                double MAX_ALPHA = 0.10;
                double TEMPORAL_GRANULARITY_FOR_ALPHA_SLICES = 1.0;

                for (double alpha = 0.0; alpha <= MAX_ALPHA; alpha += MAX_ALPHA / (double)theTableConfig.NumCombs)
                {
                    TrajectoryFactory_AlphaSlice tf = new TrajectoryFactory_AlphaSlice(TEMPORAL_GRANULARITY_FOR_ALPHA_SLICES, 0.0, alpha, true);
                    tf.Initialize(theTableConfig);
                    _simb.add(tf);
                    TrajectoryFactory_AlphaSlice tf2 = new TrajectoryFactory_AlphaSlice(TEMPORAL_GRANULARITY_FOR_ALPHA_SLICES, 0.0, alpha, false);
                    tf2.Initialize(theTableConfig);
                    _simb.add(tf2);
                }

                foreach (AgentEvaluationConfig aefc in theAgentEvaluationFactorySetConfig.getAgentEvaluations())
                {
                    IAgentEvaluationFactory aef = CreateAgentEvaluationFactory(aefc);
                    _simb.add(aef, aefc);
                }

                _resb = _simb.run(theTableConfig.Trials);

                //popname = POP_FILE_PREFIX+"."+popi+".Validation-Post";
                //poppath = Path.Combine(_popdir, popname);
                //SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "population post "+popi+" => "+poppath);
                //savePopulation(poppath, pop);

                if (accumulated_resb == null)
                {
                    accumulated_resb = _resb;
                }
                else
                {
                    accumulated_resb.add(_resb);
                }

                //WriteTrajectories(popi, _simb, _resb);
            }

            //WriteTrajectories(-1, accumulated_simb, accumulated_resb);

            PresentationConfig.Directory = Path.Combine(OutputDirectory, "results");
            if (!Directory.Exists(PresentationConfig.Directory))
            {
                Directory.CreateDirectory(PresentationConfig.Directory);
            }

            Latex.ClearImages();

            SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "Writing BlauSpaceEvaluations.");

            foreach (IAgentEvaluationBundle aeb in accumulated_resb.getAgentEvaluationBundles())
            {
                IBlauSpaceLattice    bsl      = accumulated_simb.getLattice(theActualDistribution, aeb);
                IBlauSpaceEvaluation meanEval = aeb.MeanEvaluation(bsl);
                IBlauSpaceEvaluation stdEval  = aeb.StdEvaluation(bsl);

                BlauSpaceEvaluationGnuplotPresenter pres = new BlauSpaceEvaluationGnuplotPresenter(_bsedir, PresentationConfig.Directory);
                pres.Present(this, meanEval, stdEval);
            }

            SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "Writing TrajectoryBundles.");
            foreach (ITrajectoryBundle tb in accumulated_resb.getTrajectoryBundles())
            {
                TrajectoryBundleGnuplotPresenter pres = new TrajectoryBundleGnuplotPresenter(_trajdir, PresentationConfig.Directory);
                pres.Present(this, tb);
            }

            SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "Writing Latex.");
            Latex.Instance().Present(this);

            CreateReport(this);

            SingletonLogger.Instance().InfoLog(typeof(SingleDistributionExperiment), "Done.");
        }
Ejemplo n.º 23
0
 public TransactionServiceFactory(IProcessSettingsFactory settingsFactory, ITransactionDataConnector dataConnector, IAgentFactory agentFactory, IAlternateBranchFactory alternateBranchFactory,
                                  ITransactionFeeListFactory transactionFeeListFactory, ITransactionContextFactory transactionContextFactory, ICustomerFactory customerFactory, ITransactionDeficienciesFactory transactionDeficienciesFactory,
                                  IDocumentService documentService, ILogicEvaluatorTypeFactory evaluatorTypeFactory, IEvidenceService evidenceService, ILocationFactory locationFactory,
                                  IParameterSerializer parameterSerializer, IPlatformService platformService, IProcessStepFactory processStepFactory, IProcessStepTypeFactory processStepTypeFactory,
                                  IRequirementEvaluator requirementEvaluator, IRequirementFactory requirementFactory, ITransactionHistoryFactory transactionHistoryFactory,
                                  ITransactionProcessFactory transactionProcessFactory, IFeeList feeList)
 {
     this.SettingsFactory                = settingsFactory ?? throw new ArgumentNullException("settingsFactory");
     this.DataConnector                  = dataConnector ?? throw new ArgumentNullException("dataConnector");
     this.AgentFactory                   = agentFactory ?? throw new ArgumentNullException("agentFactory.");
     this.AlternateBranchFactory         = alternateBranchFactory ?? throw new ArgumentNullException("alternateBrachFactory");
     this.TransactionFeeListFactory      = transactionFeeListFactory ?? throw new ArgumentNullException("transactionFeeListFactory");
     this.TransactionContextFactory      = transactionContextFactory ?? throw new ArgumentNullException("transactionContextFactory");
     this.CustomerFactory                = customerFactory ?? throw new ArgumentNullException("customerFactory.");
     this.TransactionDeficienciesFactory = transactionDeficienciesFactory ?? throw new ArgumentNullException("transactionDeficienciesFactory");
     this.DocumentService                = documentService ?? throw new ArgumentNullException("documentService");
     this.EvaluatorTypeFactory           = evaluatorTypeFactory ?? throw new ArgumentNullException("evaluatorTypeFactory.");
     this.EvidenceService                = evidenceService ?? throw new ArgumentNullException("evidenceService");
     this.LocationFactory                = locationFactory ?? throw new ArgumentNullException("locationFactory.");
     this.PlatformService                = platformService ?? throw new ArgumentNullException("platformService.");
     this.ProcessStepFactory             = processStepFactory ?? throw new ArgumentNullException("processStepFactory.");
     this.ProcessStepTypeFactory         = processStepTypeFactory ?? throw new ArgumentNullException("processStepTypeFactory.");
     this.RequirementEvaluator           = requirementEvaluator ?? throw new ArgumentNullException("requirementEvaluator");
     this.RequirementFactory             = requirementFactory ?? throw new ArgumentNullException("requirementFactory.");
     this.TransactionHistoryFactory      = transactionHistoryFactory ?? throw new ArgumentNullException("transactionHistoryFactory");
     this.TransactionProcessFactory      = transactionProcessFactory ?? throw new ArgumentNullException("transactionProcessFactory.");
     this.ParameterSerializer            = parameterSerializer ?? throw new ArgumentNullException("parameterSerializer");
     this.FeeList = feeList ?? throw new ArgumentNullException("feeList");
 }
Ejemplo n.º 24
0
 void ChangeCurrentAgentFactory(IAgentFactory newAgentFactory)
 {
     Debug.Log("Agent changed" + newAgentFactory.ToString());
     agentFactory = newAgentFactory;
 }
Ejemplo n.º 25
0
 protected override IAgent create(IBlauPoint pt, IAgentFactory creator, int id)
 {
     return(new Agent0x0(pt, creator, id));
 }
Ejemplo n.º 26
0
 // private factory method
 protected abstract IAgent create(IBlauPoint pt, IAgentFactory creator, int id);
        protected internal TransactionService(ITransactionDataConnector dataConnector, IAgentFactory agentFactory, ITransactionFeeListFactory transactionFeeListFactory,
                                              ITransactionContextFactory transactionContextFactory, ICustomerFactory customerFactory, ITransactionDeficienciesFactory transactionDeficienciesFactory, IDocumentService documentService,
                                              IEvidenceService evidenceService, ILocationFactory locationFactory, IRequirementEvaluator requirementEvaluator, ITransactionHistoryFactory transactionHistoryFactory,
                                              IFeeList feeList, IList <ITransactionType> registeredTransactions)
        {
            this.DataConnector                  = dataConnector ?? throw new ArgumentNullException("dataConnector");
            this.AgentFactory                   = agentFactory ?? throw new ArgumentNullException("agentFactory");
            this.TransactionFeeListFactory      = transactionFeeListFactory ?? throw new ArgumentNullException("feeListFactory");
            this.TransactionContextFactory      = transactionContextFactory ?? throw new ArgumentNullException("transactionContextFactory");
            this.CustomerFactory                = customerFactory ?? throw new ArgumentNullException("customerFactory");
            this.TransactionDeficienciesFactory = transactionDeficienciesFactory ?? throw new ArgumentNullException("transactionDeficienciesFactory");
            this.DocumentService                = documentService ?? throw new ArgumentNullException("documentService");
            this.EvidenceService                = evidenceService ?? throw new ArgumentNullException("evidenceService");
            this.LocationFactory                = locationFactory ?? throw new ArgumentNullException("locationFactory");
            this.RequirementEvaluator           = requirementEvaluator ?? throw new ArgumentNullException("requirementEvaluator");
            this.TransactionHistoryFactory      = transactionHistoryFactory ?? throw new ArgumentNullException("transactionHistoryFactory");
            this.FeeList = feeList ?? throw new ArgumentNullException("feeList");

            if (registeredTransactions == null)
            {
                this.RegisteredTransactionTypes = new List <ITransactionType>();
            }
            else
            {
                this.RegisteredTransactionTypes = registeredTransactions.ToList();
            }
        }
Ejemplo n.º 28
0
 public AgentOrderbookLoader(string path, IBlauPoint coordinates, IAgentFactory creator, int id) : base(coordinates, creator, id, 0.0)
 {
     _drain = false;
     _path  = path;
     _shots = 0;
 }
Ejemplo n.º 29
0
 public Agency(IAgentFactory agentFactory)
 {
     AgentFactory = agentFactory;
     Agents       = new ExclusiveConcurrentDictionary <Type, IAgent>();
 }