Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3121 for trunk/sources


Ignore:
Timestamp:
03/19/10 15:32:52 (15 years ago)
Author:
svonolfe
Message:

Added MoveEvaluator to the OneMax problem (#916)

Location:
trunk/sources/HeuristicLab.Problems.OneMax/3.3
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.OneMax/3.3/HeuristicLab.Problems.OneMax-3.3.csproj

    r3115 r3121  
    8787  <ItemGroup>
    8888    <Compile Include="Interfaces\IOneMaxSolutionsVisualizer.cs" />
     89    <Compile Include="Interfaces\IOneMaxMoveEvaluator.cs" />
     90    <Compile Include="MoveEvaluators\OneMaxMoveEvaluator.cs" />
     91    <Compile Include="MoveEvaluators\OneMaxOneBitflipMoveEvaluator.cs" />
    8992    <Compile Include="Properties\AssemblyInfo.cs" />
    9093    <Compile Include="Evaluators\OneMaxEvaluator.cs" />
  • trunk/sources/HeuristicLab.Problems.OneMax/3.3/Onemax.cs

    r3115 r3121  
    197197      OnVisualizerChanged();
    198198    }
     199    void OneBitflipMoveParameter_ActualNameChanged(object sender, EventArgs e) {
     200      string name = ((ILookupParameter<OneBitflipMove>)sender).ActualName;
     201      foreach (IOneBitflipMoveOperator op in Operators.OfType<IOneBitflipMoveOperator>()) {
     202        op.OneBitflipMoveParameter.ActualName = name;
     203      }
     204    }
    199205    #endregion
    200206
     
    225231        ParameterizeOperators();
    226232      }
     233
     234      InitializeMoveGenerators();
     235    }
     236    private void InitializeMoveGenerators() {
     237      foreach (IOneBitflipMoveOperator op in Operators.OfType<IOneBitflipMoveOperator>()) {
     238        if (op is IMoveGenerator) {
     239          op.OneBitflipMoveParameter.ActualNameChanged += new EventHandler(OneBitflipMoveParameter_ActualNameChanged);
     240        }
     241      }
    227242    }
    228243    private void ParameterizeOperators() {
     
    234249        op.BinaryVectorParameter.ActualName = SolutionCreator.BinaryVectorParameter.ActualName;
    235250      }
     251      foreach (IBinaryVectorMoveOperator op in Operators.OfType<IBinaryVectorMoveOperator>()) {
     252        op.BinaryVectorParameter.ActualName = SolutionCreator.BinaryVectorParameter.ActualName;
     253      }
    236254    }
    237255    #endregion
Note: See TracChangeset for help on using the changeset viewer.