Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/04/15 00:03:14 (10 years ago)
Author:
abeham
Message:

#2174:

  • Added IImprovmentOperator interface to SingleObjectiveImprover
  • Added Random parameter to Analyze method and IStochasticOperator interface to the resp. analyzer
  • Updated code template text of the compiled single- and multi-objective problem definitions
  • Prevent ProblemDefinitionScript from silently ignoring exceptions
  • Added equality comparer in Encoding's cloning constructor
  • Small adaption of ProblemDefinitionScriptView to changes in new code editor
Location:
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/MultiObjectiveAnalyzer.cs

    r11739 r11880  
    1313  [Item("Multi-objective Analyzer", "Calls the Analyze method of the problem definition.")]
    1414  [StorableClass]
    15   public class MultiObjectiveAnalyzer : SingleSuccessorOperator, IMultiObjectiveAnalysisOperator {
     15  public class MultiObjectiveAnalyzer : SingleSuccessorOperator, IMultiObjectiveAnalysisOperator, IStochasticOperator {
    1616    public bool EnabledByDefault { get { return true; } }
    1717
     
    2828    }
    2929
    30     public Action<Individual[], double[][], ResultCollection> AnalyzeAction { get; set; }
     30    public ILookupParameter<IRandom> RandomParameter {
     31      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     32    }
     33
     34    public Action<Individual[], double[][], ResultCollection, IRandom> AnalyzeAction { get; set; }
    3135
    3236    [StorableConstructor]
     
    4751      var encoding = EncodingParameter.ActualValue;
    4852      var results = ResultsParameter.ActualValue;
     53      var random = RandomParameter.ActualValue;
    4954
    5055      IEnumerable<IScope> scopes = new[] { ExecutionContext.Scope };
     
    5358
    5459      var individuals = scopes.Select(encoding.GetIndividual).ToArray();
    55       AnalyzeAction(individuals, QualitiesParameter.ActualValue.Select(x => x.ToArray()).ToArray(), results);
     60      AnalyzeAction(individuals, QualitiesParameter.ActualValue.Select(x => x.ToArray()).ToArray(), results, random);
    5661      return base.Apply();
    5762    }
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/SingleObjectiveAnalyzer.cs

    r11739 r11880  
    1313  [Item("Single-objective Analyzer", "Calls the script's Analyze method to be able to write into the results collection.")]
    1414  [StorableClass]
    15   public sealed class SingleObjectiveAnalyzer : SingleSuccessorOperator, ISingleObjectiveAnalysisOperator, IAnalyzer {
     15  public sealed class SingleObjectiveAnalyzer : SingleSuccessorOperator, ISingleObjectiveAnalysisOperator, IAnalyzer, IStochasticOperator {
    1616    public bool EnabledByDefault { get { return true; } }
    1717
     
    2828    }
    2929
    30     public Action<Individual[], double[], ResultCollection> AnalyzeAction { get; set; }
     30    public ILookupParameter<IRandom> RandomParameter {
     31      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     32    }
     33
     34    public Action<Individual[], double[], ResultCollection, IRandom> AnalyzeAction { get; set; }
    3135
    3236    [StorableConstructor]
     
    3741      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality of the parameter vector."));
    3842      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The results collection to write to."));
     43      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
    3944    }
    4045
     
    4651      var encoding = EncodingParameter.ActualValue;
    4752      var results = ResultsParameter.ActualValue;
     53      var random = RandomParameter.ActualValue;
    4854
    4955      IEnumerable<IScope> scopes = new[] { ExecutionContext.Scope };
     
    5258
    5359      var individuals = scopes.Select(encoding.GetIndividual).ToArray();
    54       AnalyzeAction(individuals, QualityParameter.ActualValue.Select(x => x.Value).ToArray(), results);
     60      AnalyzeAction(individuals, QualityParameter.ActualValue.Select(x => x.Value).ToArray(), results, random);
    5561      return base.Apply();
    5662    }
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/SingleObjectiveImprover.cs

    r11739 r11880  
    3434  [Item("Single-objective Improver", "Improves a solution by calling GetNeighbors and Evaluate of the corresponding problem definition.")]
    3535  [StorableClass]
    36   public sealed class SingleObjectiveImprover : SingleSuccessorOperator, INeighborBasedOperator, ISingleObjectiveEvaluationOperator, IStochasticOperator {
     36  public sealed class SingleObjectiveImprover : SingleSuccessorOperator, INeighborBasedOperator, IImprovementOperator, ISingleObjectiveEvaluationOperator, IStochasticOperator {
    3737    public ILookupParameter<IRandom> RandomParameter {
    3838      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
Note: See TracChangeset for help on using the changeset viewer.