Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/25/15 23:24:01 (9 years ago)
Author:
abeham
Message:

#2521:

  • Adapted single-objective test function problem to new problem infrastructure
  • Added additional interfaces to RealVectorEncoding
  • Fixed IParticleUpdater interface (must implement IStochasticOperator if it contains a Random parameter)
Location:
branches/ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Moves
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Moves/AdditiveMoveGenerator.cs

    r12012 r13403  
    3131  [Item("AdditiveMoveGenerator", "Base class for all additive move generators.")]
    3232  [StorableClass]
    33   public abstract class AdditiveMoveGenerator : SingleSuccessorOperator, IAdditiveRealVectorMoveOperator, IMoveGenerator, IStochasticOperator {
     33  public abstract class AdditiveMoveGenerator : SingleSuccessorOperator, IRealVectorAdditiveMoveOperator, IMoveGenerator, IStochasticOperator {
    3434    public override bool CanChangeName {
    3535      get { return false; }
     
    4343    public ILookupParameter<AdditiveMove> AdditiveMoveParameter {
    4444      get { return (LookupParameter<AdditiveMove>)Parameters["AdditiveMove"]; }
    45     }
    46     protected ScopeParameter CurrentScopeParameter {
    47       get { return (ScopeParameter)Parameters["CurrentScope"]; }
    4845    }
    4946    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
     
    5956      Parameters.Add(new LookupParameter<RealVector>("RealVector", "The real vector for which moves should be generated."));
    6057      Parameters.Add(new LookupParameter<AdditiveMove>("AdditiveMove", "The moves that should be generated in subscopes."));
    61       Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes."));
    6258      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "A 2 column matrix specifying the lower and upper bound for each dimension. If there are less rows than dimension the bounds vector is cycled."));
    6359    }
     
    7268        moveScopes[i].Variables.Add(new Variable(AdditiveMoveParameter.ActualName, moves[i]));
    7369      }
    74       CurrentScopeParameter.ActualValue.SubScopes.AddRange(moveScopes);
     70      ExecutionContext.Scope.SubScopes.AddRange(moveScopes);
    7571      return base.Apply();
    7672    }
  • branches/ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Moves/AdditiveMoveMaker.cs

    r12012 r13403  
    3131  [Item("AdditiveMoveMaker", "Peforms an additive move on a given real vector and updates the quality.")]
    3232  [StorableClass]
    33   public class AdditiveMoveMaker : SingleSuccessorOperator, IAdditiveRealVectorMoveOperator, IMoveMaker, ISingleObjectiveOperator {
     33  public class AdditiveMoveMaker : SingleSuccessorOperator, IRealVectorAdditiveMoveQualityOperator, IMoveMaker, ISingleObjectiveOperator {
    3434    public override bool CanChangeName {
    3535      get { return false; }
     
    6363    }
    6464
     65    public static void Apply(RealVector realVector, AdditiveMove move) {
     66      realVector[move.Dimension] += move.MoveDistance;
     67    }
     68
    6569    public override IOperation Apply() {
    66       AdditiveMove move = AdditiveMoveParameter.ActualValue;
    67       RealVector realVector = RealVectorParameter.ActualValue;
    68       DoubleValue moveQuality = MoveQualityParameter.ActualValue;
    69       DoubleValue quality = QualityParameter.ActualValue;
     70      Apply(RealVectorParameter.ActualValue, AdditiveMoveParameter.ActualValue);
     71      var moveQuality = MoveQualityParameter.ActualValue;
     72      var quality = QualityParameter.ActualValue;
    7073
    71       realVector[move.Dimension] += move.MoveDistance;
    7274      quality.Value = moveQuality.Value;
    7375
  • branches/ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Moves/AdditiveMoveTabuChecker.cs

    r12012 r13403  
    3232  [Item("AdditiveMoveTabuChecker", "Prevents falling back into ranges that have been moved over before.")]
    3333  [StorableClass]
    34   public class AdditiveMoveTabuChecker : SingleSuccessorOperator, IAdditiveRealVectorMoveOperator, ITabuChecker {
     34  public class AdditiveMoveTabuChecker : SingleSuccessorOperator, IRealVectorAdditiveMoveQualityOperator, ITabuChecker {
    3535    public override bool CanChangeName {
    3636      get { return false; }
  • branches/ProblemRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Moves/AdditiveMoveTabuMaker.cs

    r12012 r13403  
    2929  [Item("AdditiveMoveTabuMaker", "Sets the move tabu.")]
    3030  [StorableClass]
    31   public class AdditiveMoveTabuMaker : TabuMaker, IAdditiveRealVectorMoveOperator {
     31  public class AdditiveMoveTabuMaker : TabuMaker, IRealVectorAdditiveMoveQualityOperator {
    3232    public ILookupParameter<AdditiveMove> AdditiveMoveParameter {
    3333      get { return (ILookupParameter<AdditiveMove>)Parameters["AdditiveMove"]; }
Note: See TracChangeset for help on using the changeset viewer.