Ejemplo n.º 1
0
        public void RunTest(
            int nodeNumber,
            int messageNumber,
            int simSpeedNumber,
            int tabIndex)
        {
            SimulationEnvironment sim = new SimulationEnvironment();

            sim.GenerateRandomNodes(nodeNumber);
            sim.GenerateRandomMessages(messageNumber);
            new OutputPaneController().PopulateNodesDSR(sim.GetNodes(), tabIndex);
            sim.RunSimulation();
        }
Ejemplo n.º 2
0
        public List <GraphData> RunTest(
            int nodeNumber,
            int messageNumber,
            int simSpeedNumber,
            int tabIndex,
            int nodeRange,
            int pureSelfishNodeNumber,
            int partialSelfishNodeNumber,
            int executionNumber)
        {
            if (executionNumber > 1)
            {
                List <GraphData>           graphDataList;
                List <List <SessionData> > sessionDataList = new List <List <SessionData> >();
                int currentTabIndex = tabIndex;

                for (int currentExecutionNumber = 0; currentExecutionNumber < executionNumber; currentExecutionNumber++)
                {
                    List <SessionData> currentExecutionSessionDataList = new List <SessionData>();
                    List <bool>        tabIndexesDone = new List <bool> {
                        false, false, false
                    };
                    bool isAllTabsDone = false;

                    simulationEnvironment.GenerateRandomNodes(nodeNumber, nodeRange, pureSelfishNodeNumber, partialSelfishNodeNumber);
                    simulationEnvironment.GenerateRandomMessages(messageNumber);

                    while (!isAllTabsDone)
                    {
                        if (tabIndexesDone.Any(x => x == false))
                        {
                            Hub.Clients.All.resetCanvas(currentTabIndex);

                            controller.PopulateNodesOnCanvas(simulationEnvironment.GetNodes(), currentTabIndex);
                            var sessionData = simulationEnvironment.RunSimulation(simSpeedNumber, currentTabIndex);
                            currentExecutionSessionDataList.Add(sessionData);

                            tabIndexesDone[currentTabIndex] = true;

                            if (tabIndexesDone.Any(x => x == false))
                            {
                                currentTabIndex = tabIndexesDone.FindIndex(x => x == false);
                            }
                        }
                        else
                        {
                            isAllTabsDone = true;
                        }
                    }

                    sessionDataList.Add(currentExecutionSessionDataList);
                }

                graphDataList = SessionDataListToGraphDataList(sessionDataList, executionNumber);

                return(graphDataList);
            }
            else
            {
                simulationEnvironment.GenerateRandomNodes(nodeNumber, nodeRange, pureSelfishNodeNumber, partialSelfishNodeNumber); // Generate Random Nodes //<remove once lock fixed
                simulationEnvironment.GenerateRandomMessages(messageNumber);                                                       // Generate Random Messages //<remove once lock fixed
                controller.PopulateNodesOnCanvas(simulationEnvironment.GetNodes(), tabIndex);                                      // Populate Nodes on Canvas //<remove once lock fixed
                simulationEnvironment.RunSimulation(simSpeedNumber, tabIndex);                                                     // Run Simulation on Environment

                return(new List <GraphData>());
            }
        }