public GenderSpecificSelector()
            : base()
        {
            #region Create parameters
            Parameters.Add(new ValueLookupParameter <BoolValue>("Maximization", "True if the problem is a maximization problem."));
            Parameters.Add(new ScopeTreeLookupParameter <DoubleValue>("Quality", "The quality of the solutions."));
            Parameters.Add(new ValueLookupParameter <IntValue>("NumberOfSelectedSubScopes", "The number of scopes that should be selected."));
            Parameters.Add(new ValueLookupParameter <BoolValue>("CopySelected", "True if the scopes should be copied, false if they should be moved.", new BoolValue(true)));
            Parameters.Add(new LookupParameter <IRandom>("Random", "The random number generator to use."));
            Parameters.Add(new ValueParameter <ISelector>("FemaleSelector", "The selection operator to select the first parent."));
            Parameters.Add(new ValueParameter <ISelector>("MaleSelector", "The selection operator to select the second parent."));
            CopySelectedParameter.Hidden = true;
            #endregion

            #region Create operators
            Placeholder        femaleSelector    = new Placeholder();
            SubScopesProcessor maleSelection     = new SubScopesProcessor();
            Placeholder        maleSelector      = new Placeholder();
            EmptyOperator      empty             = new EmptyOperator();
            RightChildReducer  rightChildReducer = new RightChildReducer();
            SubScopesMixer     subScopesMixer    = new SubScopesMixer();

            femaleSelector.OperatorParameter.ActualName = "FemaleSelector";

            maleSelector.OperatorParameter.ActualName = "MaleSelector";

            subScopesMixer.Partitions = new IntValue(2);
            #endregion

            #region Create operator graph
            OperatorGraph.InitialOperator = femaleSelector;
            femaleSelector.Successor      = maleSelection;
            maleSelection.Operators.Add(maleSelector);
            maleSelection.Operators.Add(empty);
            maleSelection.Successor     = rightChildReducer;
            rightChildReducer.Successor = subScopesMixer;
            #endregion

            Initialize();
        }
Beispiel #2
0
 protected RightChildReducer(RightChildReducer original, Cloner cloner) : base(original, cloner)
 {
 }
 protected RightChildReducer(RightChildReducer original, Cloner cloner) : base(original, cloner) { }
    public GenderSpecificSelector()
      : base() {
      #region Create parameters
      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem."));
      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality of the solutions."));
      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSelectedSubScopes", "The number of scopes that should be selected."));
      Parameters.Add(new ValueLookupParameter<BoolValue>("CopySelected", "True if the scopes should be copied, false if they should be moved.", new BoolValue(true)));
      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
      Parameters.Add(new ValueParameter<ISelector>("FemaleSelector", "The selection operator to select the first parent."));
      Parameters.Add(new ValueParameter<ISelector>("MaleSelector", "The selection operator to select the second parent."));
      CopySelectedParameter.Hidden = true;
      #endregion

      #region Create operators
      Placeholder femaleSelector = new Placeholder();
      SubScopesProcessor maleSelection = new SubScopesProcessor();
      Placeholder maleSelector = new Placeholder();
      EmptyOperator empty = new EmptyOperator();
      RightChildReducer rightChildReducer = new RightChildReducer();
      SubScopesMixer subScopesMixer = new SubScopesMixer();

      femaleSelector.OperatorParameter.ActualName = "FemaleSelector";

      maleSelector.OperatorParameter.ActualName = "MaleSelector";

      subScopesMixer.Partitions = new IntValue(2);
      #endregion

      #region Create operator graph
      OperatorGraph.InitialOperator = femaleSelector;
      femaleSelector.Successor = maleSelection;
      maleSelection.Operators.Add(maleSelector);
      maleSelection.Operators.Add(empty);
      maleSelection.Successor = rightChildReducer;
      rightChildReducer.Successor = subScopesMixer;
      #endregion

      Initialize();
    }
    private void BuildOperatorGraph() {
      OperatorGraph.Operators.Clear();

      SubScopesProcessor firstProcessor = new SubScopesProcessor();
      EmptyOperator firstEmpty = new EmptyOperator();
      RightChildReducer firstRightChildReducer = new RightChildReducer();
      OperatorGraph.InitialOperator = firstProcessor;
      firstProcessor.Operators.Add(CheckedSelectors.FirstOrDefault());
      firstProcessor.Operators.Add(firstEmpty);
      firstProcessor.Successor = firstRightChildReducer;

      SingleSuccessorOperator previous = firstRightChildReducer;
      foreach (var selector in CheckedSelectors.Skip(1)) {
        SubScopesProcessor selectionProcessor = new SubScopesProcessor();
        EmptyOperator empty = new EmptyOperator();
        RightChildReducer rightChildReducer = new RightChildReducer();
        previous.Successor = selectionProcessor;
        selectionProcessor.Operators.Add(selector);
        selectionProcessor.Operators.Add(empty);
        selectionProcessor.Successor = rightChildReducer;
        previous = rightChildReducer;
      }
    }