コード例 #1
0
        public VariableNeighborhoodSearch()
            : base()
        {
            Parameters.Add(new FixedValueParameter <IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
            Parameters.Add(new FixedValueParameter <BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
            Parameters.Add(new ConstrainedValueParameter <ILocalImprovementOperator>("LocalImprovement", "The local improvement operation"));
            Parameters.Add(new ConstrainedValueParameter <IMultiNeighborhoodShakingOperator>("ShakingOperator", "The operator that performs the shaking of solutions."));
            Parameters.Add(new FixedValueParameter <IntValue>("MaximumIterations", "The maximum number of iterations which should be processed.", new IntValue(50)));
            Parameters.Add(new FixedValueParameter <IntValue>("LocalImprovementMaximumIterations", "The maximum number of iterations which should be performed in the local improvement phase.", new IntValue(50)));
            Parameters.Add(new ValueParameter <MultiAnalyzer>("Analyzer", "The operator used to analyze the solution and moves.", new MultiAnalyzer()));

            RandomCreator    randomCreator              = new RandomCreator();
            SolutionsCreator solutionsCreator           = new SolutionsCreator();
            VariableCreator  variableCreator            = new VariableCreator();
            ResultsCollector resultsCollector           = new ResultsCollector();
            VariableNeighborhoodSearchMainLoop mainLoop = new VariableNeighborhoodSearchMainLoop();

            OperatorGraph.InitialOperator = randomCreator;

            randomCreator.RandomParameter.ActualName          = "Random";
            randomCreator.SeedParameter.ActualName            = SeedParameter.Name;
            randomCreator.SeedParameter.Value                 = null;
            randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
            randomCreator.SetSeedRandomlyParameter.Value      = null;
            randomCreator.Successor = solutionsCreator;

            solutionsCreator.NumberOfSolutions = new IntValue(1);
            solutionsCreator.Successor         = variableCreator;

            variableCreator.Name = "Initialize Evaluated Solutions";

            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("Iterations", new IntValue(0)));
            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("EvaluatedSolutions", new IntValue(0)));
            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("CurrentNeighborhoodIndex", new IntValue(0)));
            variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("NeighborhoodCount", new IntValue(0)));
            variableCreator.Successor = resultsCollector;

            resultsCollector.CollectedValues.Add(new LookupParameter <IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
            resultsCollector.CollectedValues.Add(new LookupParameter <IntValue>("Iterations"));
            resultsCollector.ResultsParameter.ActualName = "Results";
            resultsCollector.Successor = mainLoop;

            mainLoop.IterationsParameter.ActualName = "Iterations";
            mainLoop.CurrentNeighborhoodIndexParameter.ActualName = "CurrentNeighborhoodIndex";
            mainLoop.NeighborhoodCountParameter.ActualName        = "NeighborhoodCount";
            mainLoop.LocalImprovementParameter.ActualName         = LocalImprovementParameter.Name;
            mainLoop.ShakingOperatorParameter.ActualName          = ShakingOperatorParameter.Name;
            mainLoop.MaximumIterationsParameter.ActualName        = MaximumIterationsParameter.Name;
            mainLoop.RandomParameter.ActualName             = RandomCreator.RandomParameter.ActualName;
            mainLoop.ResultsParameter.ActualName            = "Results";
            mainLoop.AnalyzerParameter.ActualName           = AnalyzerParameter.Name;
            mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";

            InitializeLocalImprovementOperators();
            qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
            ParameterizeAnalyzers();
            UpdateAnalyzers();

            RegisterEventHandlers();
        }
コード例 #2
0
 private VariableNeighborhoodSearchMainLoop(VariableNeighborhoodSearchMainLoop original, Cloner cloner)
   : base(original, cloner) {
 }
コード例 #3
0
    public VariableNeighborhoodSearch()
      : base() {
      Parameters.Add(new FixedValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
      Parameters.Add(new FixedValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
      Parameters.Add(new ConstrainedValueParameter<ILocalImprovementOperator>("LocalImprovement", "The local improvement operation"));
      Parameters.Add(new ConstrainedValueParameter<IMultiNeighborhoodShakingOperator>("ShakingOperator", "The operator that performs the shaking of solutions."));
      Parameters.Add(new FixedValueParameter<IntValue>("MaximumIterations", "The maximum number of iterations which should be processed.", new IntValue(50)));
      Parameters.Add(new FixedValueParameter<IntValue>("LocalImprovementMaximumIterations", "The maximum number of iterations which should be performed in the local improvement phase.", new IntValue(50)));
      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the solution and moves.", new MultiAnalyzer()));

      RandomCreator randomCreator = new RandomCreator();
      SolutionsCreator solutionsCreator = new SolutionsCreator();
      VariableCreator variableCreator = new VariableCreator();
      ResultsCollector resultsCollector = new ResultsCollector();
      VariableNeighborhoodSearchMainLoop mainLoop = new VariableNeighborhoodSearchMainLoop();
      OperatorGraph.InitialOperator = randomCreator;

      randomCreator.RandomParameter.ActualName = "Random";
      randomCreator.SeedParameter.ActualName = SeedParameter.Name;
      randomCreator.SeedParameter.Value = null;
      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
      randomCreator.SetSeedRandomlyParameter.Value = null;
      randomCreator.Successor = solutionsCreator;

      solutionsCreator.NumberOfSolutions = new IntValue(1);
      solutionsCreator.Successor = variableCreator;

      variableCreator.Name = "Initialize Evaluated Solutions";

      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0)));
      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0)));
      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("CurrentNeighborhoodIndex", new IntValue(0)));
      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("NeighborhoodCount", new IntValue(0)));
      variableCreator.Successor = resultsCollector;

      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
      resultsCollector.ResultsParameter.ActualName = "Results";
      resultsCollector.Successor = mainLoop;

      mainLoop.IterationsParameter.ActualName = "Iterations";
      mainLoop.CurrentNeighborhoodIndexParameter.ActualName = "CurrentNeighborhoodIndex";
      mainLoop.NeighborhoodCountParameter.ActualName = "NeighborhoodCount";
      mainLoop.LocalImprovementParameter.ActualName = LocalImprovementParameter.Name;
      mainLoop.ShakingOperatorParameter.ActualName = ShakingOperatorParameter.Name;
      mainLoop.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name;
      mainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
      mainLoop.ResultsParameter.ActualName = "Results";
      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
      mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";

      InitializeLocalImprovementOperators();
      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
      ParameterizeAnalyzers();
      UpdateAnalyzers();

      RegisterEventHandlers();
    }
コード例 #4
0
 private VariableNeighborhoodSearchMainLoop(VariableNeighborhoodSearchMainLoop original, Cloner cloner)
     : base(original, cloner)
 {
 }