public void AddMember(WebService ws) { WebServiceInfo wsInfo = new WebServiceInfo(); wsInfo.ActivenessFactor = 0; wsInfo.NegativeFeedbacks = 0; wsInfo.NumberOfAcceptedTasks = 0; wsInfo.NumberOfOfferedTasks = 0; wsInfo.NumberOfTasksDone = 0; wsInfo.PositiveFeedbacks = 0; wsInfo.Webservice = ws; this.members.Add(wsInfo); }
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(); }
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 FillWsTable(int i, WebService ws) { DataRow drWsInitialValues = dtWsInitialValues.NewRow(); drWsInitialValues[colCmId] = ws.CommunityId; drWsInitialValues[colWsId] = ws.Id; drWsInitialValues[colWsNetwork] = ws.NetworkId; drWsInitialValues[colWsQoS] = ws.QoS; drWsInitialValues[colWsType] = ws.Type.ToString(); drWsInitialValues[colWsGrowthFactor] = ws.GrowthFactor; drWsInitialValues[colWsReputation] = ws.Reputation; // dtWsInitialValues.Rows[i][colWsNTD] = 0; drWsInitialValues[colWsBudget] = ws.Budget; drWsInitialValues[colWsTotalIncome] = ws.TotalIncome; drWsInitialValues[colWsCompeted] = ws.ReadyToCompete; drWsInitialValues[colCmId] = ws.CommunityId; dtWsInitialValues.Rows.Add(drWsInitialValues); }
public void Initialization(Constants.SimulationType simulationType) { CreateInitializationTables(); // Adding coloumns titles to drWsInitialValues DataSetTools dsTools = new DataSetTools(); dataSet = dsTools.parseDateSet("c:\\projects\\QWS_Dataset_v2.txt"); // Gather all dataset webservice metrics and QoS 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); // adds a row of task[i] to dtTaskInitialValues Thread.Sleep(5); //outputLog.AppendText("Task: " + task.QoS + ", fee: " + task.Fee + "\n"); } // 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); // adds ws to dtWsInitialValues } Communities.Add(community); // Collaboration Network Initialization outputLog.AppendText("Initializating Collaboration Network...\n"); InitializeNetworks(simulationType); // Computing thresholds and probabilities }