//Load IO settings public void InitSettings() { this._ioManager = new IOManager(); //this._ioManager.ReInitSettings(); this._log = new Utils.Logger(); //Load sim settings this.simulationSettings = new SimulationSettings(); _log.PrintInit(simulationSettings.ToString()); Console.WriteLine("Loading settings"); this.simulationSettings = new SimulationSettings(this._ioManager.GetSettings()); //Load of python files _interfacePython = this._ioManager.LoadPythonModules(); }
public void Init() { //Init IO-related settings this.InitSettings(); //Init Managers etc this._numUsers = this.simulationSettings.NUM_OF_PLAYERS; this._numFederations = this.simulationSettings.NUM_OF_FEDERATIONS; this.SAVEDB_FLAG = 2; //edit this to save to DB 1 - DB; 2 - text file this._playerManager = new PlayerManager(); this._federationManager = new FederationManager(); this._schemeManager = new SchemeManager(); this._stateManager = new StateManager(); this._allocationManager = new AllocationManager(); this._bidManager = new BidManager(); this._trainingManager = new InTrainingManager(); this.eventsManager = new EventsManager(); this.dbManager = new DBManager(); //init State //Link Python with SchemeManager this._schemeManager.PythonInterfaceReference = this._interfacePython; this._schemeManager.BuildFederationSchemeList(this._numFederations, this._numUsers); if (this.FIXED_SETTINGS_FLAG == 1) { this.FixedSettings(); } else { //Load federation with different schemes //TODO: Random/ scheme spread of federations Admission policy = new Admission(simulationSettings.INIT_DATA_QUALITY, simulationSettings.INIT_DATA_QUANTITY, simulationSettings.INIT_RESOURCE_QUANTITY, simulationSettings.INIT_AMOUNT_BID); _federationManager.PopulateFederations(_numFederations, _schemeManager.PythonSchemeList, policy, simulationSettings.MIN_BID_LENGTH); double split = 100 / this._federationManager.FederationList.Count; for (int i = 0; i < this._federationManager.FederationList.Count; i++) { this._federationManager.FederationList[i].MarketShare = Math.Round(split / 100, 2); this._federationManager.FederationList[i].CollabTrainingQuality = 0.1; this._federationManager.FederationList[i].FederationMarketShareHistory.Add(this._federationManager.FederationList[i].MarketShare); } //Populate Lists _log.PrintInit(this._playerManager.ToString()); _playerManager.PopulatePlayers(_numUsers, this._federationManager.FederationList); this.HumanPlayer = this._playerManager.PlayerList[0]; _log.PrintInit(this._allocationManager.ToString()); _allocationManager.GenerateDifferentHands(_numUsers, this.simulationSettings); //Allocate Hands double dataQualityWeight = simulationSettings.DATA_QUALITY_WEIGHT; double dataQuantityWeight = simulationSettings.DATA_QUANTITY_WEIGHT; for (int i = 0; i < _playerManager.PlayerList.Count; i++) { Tuple <DataObject, Resource, double> tempTuple = this._allocationManager.HandList[i]; _playerManager.AllocatePlayer(i, tempTuple.Item1, tempTuple.Item2, tempTuple.Item3, dataQualityWeight, dataQuantityWeight); } //set up premise for initial DB set up //Game ID, Settings, Initial Federation/ Players this.dbManager.AddGameInstance(simulationSettings, Guid.NewGuid().ToString()); Boolean b = true; foreach (Player p in this._playerManager.PlayerList) { if (p.Pid != 1) { b = false; } this.dbManager.AddParticipant(p, b); this.dbManager.AddParticipantHistory(p, 0, 0); } foreach (Federation f in this._federationManager.FederationList) { this.dbManager.AddFederation(f); this.dbManager.AddFederationHistory(f, 0, 0); } //_ioManager.LoadPythonModules(_schemeManager,strategyManager); } }