public void Initialization(Constants.SimulationType simulationType) { CreateInitializationTables(); DataSetTools dsTools = new DataSetTools(); dataSet = dsTools.parseDateSet("c:\\projects\\QWS_Dataset_v2.txt"); outputLog.AppendText("/*********************** Strategy: " + simulationType.ToString() + " ***********************/\n"); // Generate tasks outputLog.AppendText("Generating Tasks...\n"); for (int i = 0; i < Constants.NumberOfTasks; i++) { Task task = new Task(i); TaskPool.Add(task); FillTaskTable(i, task); } // Generate communities outputLog.AppendText("Generating Communities...\n"); Community community = new Community(1); community.TaskPool = TaskPool; // Generate web services outputLog.AppendText("Generating " + Constants.NumberOfWebservices + " of Web Services...\n"); for (int i = 0; i < Constants.NumberOfWebservices; i++) { WebService ws = new WebService(i); switch (simulationType) { case Constants.SimulationType.AllCompetitive: ws.Type = Constants.WebserviceType.JustCompetitive; break; case Constants.SimulationType.AllRandom: ws.Type = Constants.WebserviceType.Random; break; case Constants.SimulationType.Coopetitive: ws.Type = Constants.WebserviceType.Coopetitive; break; } community.AddMember(ws); ws.CommunityId = community.Id; FillWsTable(i, ws); } Communities.Add(community); // Collaboration Network Initialization outputLog.AppendText("Initializating Collaboration Network...\n"); InitializeNetworks(simulationType); // Computing thresholds and probabilities }
public void CreateGraphInput(Constants.SimulationType simulationType) { ExcelManipulation excelGraph = new ExcelManipulation(); excelGraph.CreateExcelFile(); int grrow = 1; int grcol = 1; excelGraph.createHeaders(grrow, grcol, "Run No", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Simulation Type", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Total Budget", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Average Budget", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Average Reputation", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Min Reputation", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Max Reputation", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Growth Factor ws5", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Growth Factor ws10", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Growth Factor ws15", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Comp prob ws5", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Comp prob ws10", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Comp prob ws15", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Coop prob ws6", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Coop prob ws11", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Coop prob ws16", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Reward Chance ws5", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Reward Chance ws10", "A", "B", 2, true, 10, "n"); excelGraph.createHeaders(grrow, ++grcol, "Reward Chance ws15", "A", "B", 2, true, 10, "n"); for (int i = 0; i < avgBudget.Count; i++) { grrow++; grcol = 1; excelGraph.InsertData(grrow, grcol, i.ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, simulationType.ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, totalBudget[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, avgBudget[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, avgReputation[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, minReputation[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, maxReputation[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, growthFactor5[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, growthFactor10[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, growthFactor15[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, compProb5[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, compProb10[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, compProb15[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, coopProb6[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, coopProb11[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, coopProb16[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, rewardChance5[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, rewardChance10[i].ToString(), "", "", ""); excelGraph.InsertData(grrow, ++grcol, rewardChance15[i].ToString(), "", "", ""); } long ticks = DateTime.Now.Ticks; excelGraph.SaveDocument("coopetitionGraph_" + simulationType + "_" + ticks + ".xls"); }
private void InitializeUsingDataTables(Constants.SimulationType simulationType) { outputLog.AppendText("/*********************** Strategy: " + simulationType.ToString() + " ***********************/\n"); // Generate tasks TaskPool.Clear(); outputLog.AppendText("Generating Tasks...\n"); foreach (DataRow drTask in dtTaskInitialValues.Rows) { Task task = new Task(); task.Id = Int32.Parse(drTask[colTaskId].ToString()); task.QoS = double.Parse(drTask[colTaskQoS].ToString()); task.Fee = Int32.Parse(drTask[colTaskFee].ToString()); task.Assigned = Boolean.Parse(drTask[colTaskAssigned].ToString()); TaskPool.Add(task); } // Generate communities outputLog.AppendText("Generating Communities...\n"); Communities.RemoveAt(0); Community community = new Community(1); community.TaskPool = TaskPool; // Generate web services outputLog.AppendText("Generating " + Constants.NumberOfWebservices + " of Web Services...\n"); community.Members.Clear(); community.IntraNetworks.Clear(); foreach (DataRow drWs in dtWsInitialValues.Rows) { WebService ws = new WebService(); ws.Id = Int32.Parse(drWs[colWsId].ToString()); ws.QoS = double.Parse(drWs[colWsQoS].ToString()); ws.GrowthFactor = double.Parse(drWs[colWsGrowthFactor].ToString()); ws.Reputation = double.Parse(drWs[colWsReputation].ToString()); ws.Budget = Int32.Parse(drWs[colWsBudget].ToString()); switch (simulationType) { case Constants.SimulationType.AllCompetitive: ws.Type = Constants.WebserviceType.JustCompetitive; break; case Constants.SimulationType.AllRandom: ws.Type = Constants.WebserviceType.Random; break; case Constants.SimulationType.Coopetitive: ws.Type = Constants.WebserviceType.Coopetitive; break; } ws.CommunityId = Int32.Parse(drWs[colCmId].ToString()); ws.NetworkId = Int32.Parse(drWs[colWsNetwork].ToString()); community.AddMember(ws); } Communities.Add(community); // Collaboration Network Initialization outputLog.AppendText("Initializating Collaboration Network...\n"); InitializeNetworksUsingDataTable(); }