コード例 #1
0
        public void Initialize()
        {
            //Initial signal config
            signalConfigList = new List<SignalConfig>();
            signalStatusList = new List<int[]>();

            //Initial optimization setting
            optimizationInterval_Cycle = Simulator.IntersectionManager.defaultOptimizeInterval;
            optimizationThreshold_IAWR = Simulator.IntersectionManager.defaultIAWR;

            latestOptimizationCycle = 0;
            currentCycle = 0;
            stability = 0;

            TO = new TrafficOptimization(minGreen, maxGreen, cycleLengthFixed);
            AA = new AdaptiveAdjustment();

            //Register to DM
            Simulator.DataManager.RegisterIntersection(intersectionID);
            cycleEneTime = new List<int>();
        }
コード例 #2
0
        private void button_Start_Click(object sender, EventArgs e)
        {
            int maxGreen = (int)numericUpDown_maxGreen.Value;
            int minGreen = (int)numericUpDown_minGreen.Value;
            int phase = (int)numericUpDown_phase.Value;
            Boolean fixedCycle = checkBox_fixedCycle.Checked;

            int population = (int)numericUpDown_population.Value;
            int generation = (int)numericUpDown_generation.Value;
            double crossover = (double)numericUpDown_crossover.Value;
            double mutation = (double)numericUpDown_mutation.Value;

            double IAWRW = (double)numericUpDown_IAWRW.Value;
            double TDFW = (double)numericUpDown_TDFW.Value;
            double CLFW = (double)numericUpDown_CLFW.Value;

            testPara.Config_GAParameter(population, generation, crossover, mutation);
            testPara.Config_FitnessWeight(IAWRW, TDFW, CLFW);

            TO = new TrafficOptimization(minGreen,maxGreen,fixedCycle);
            TO.setPhases(phase);

            TO.optimization_GA.SetGAParameter(testPara);

            double V1 = (double)numericUpDown_V1.Value;
            double V2 = (double)numericUpDown_V2.Value;
            double V3 = (double)numericUpDown_V3.Value;
            double V4 = (double)numericUpDown_V4.Value;

            int P1 = (int)numericUpDown_P1.Value;
            int P2 = (int)numericUpDown_P2.Value;
            int P3 = (int)numericUpDown_P3.Value;
            int P4 = (int)numericUpDown_P4.Value;

            TO.AddRoad(1, P1, 60, 60, V1,0, 0, 0);
            TO.AddRoad(2, P2, 60, 60, V2,0, 0, 0);
            TO.AddRoad(3, P3, 60, 60, V3,0, 0, 0);
            TO.AddRoad(4, P4, 60, 60, V4,0, 0, 0);

            int testTimes = (int)numericUpDown_testTimes.Value;
            StartTest(testTimes);
        }